{"components":{"schemas":{"AccountAdjustmentBody":{"properties":{"adjusted_on":{"description":"YYYY-MM-DD; defaults to the shop's local today","type":["string","null"]},"amount_cents":{"description":"Positive cents","format":"int64","type":"integer"},"kind":{"description":"\"debit\" (raises the balance) or \"credit\" (lowers it)","type":"string"},"reason":{"type":["string","null"]},"reference":{"type":["string","null"]}},"type":"object"},"CloseBody":{"description":"Optional body for close. `charge_to_account` posts the unpaid balance to\nthe customer's account (spec D10; any customer — cash terms add a\n`cash_terms_charged` warning, O1). `invoice_date` (`YYYY-MM-DD`) defaults to\nthe shop's today and must fall inside the posting window (O2). `tenders`\n(plan 67) takes the payment in the same step: without `charge_to_account`\nthey must cover the balance exactly.","properties":{"by_order_terms":{"description":"The order's terms decide cash or charge (plan 408): cash terms need\n`tenders` covering the balance; other terms take none and charge it","type":"boolean"},"cash_received_cents":{"description":"The cash the customer handed over for the cash tender (plan 1599): stored with the change\nso a reprinted receipt shows both. Never refuses the post (`cash_received_ignored`).","format":"int64","type":["integer","null"]},"charge_to_account":{"type":"boolean"},"complete_first":{"description":"Complete and post an in-progress order in one step (plan 408)","type":"boolean"},"expected_invoice_number":{"description":"The invoice number printed from `close/preview/document`; a post that\nwould assign another number is refused (409 `conflict`).","format":"int64","type":["integer","null"]},"invoice_date":{"type":["string","null"]},"tenders":{"items":{"$ref":"#/components/schemas/TenderBody"},"type":"array"}},"type":"object"},"CreateAgentTokenBody":{"properties":{"expires_in_days":{"description":"Days until this token stops working, 1 to 365; absent = never.","format":"int64","type":["integer","null"]},"irreversible":{"description":"Whether tools that need confirmation may run; absent = yes.","type":["boolean","null"]},"name":{"description":"Shown in `GET /agent-tokens`, e.g. \"claude\".","type":"string"},"permissions":{"description":"Permissions this token is limited to; absent = all the user holds.","items":{"type":"string"},"type":["array","null"]},"scope":{"description":"`read` or `write`.","type":"string"},"write_budget":{"description":"This connection's writes per rolling hour (plan 1482); absent = the\nserver's `[agents] writes_per_hour`.","format":"int64","type":["integer","null"]}},"required":["name","scope"],"type":"object"},"CreateAttachmentBody":{"properties":{"byte_size":{"description":"The file's size in bytes, when the client knows it (plan 1426): over the upload limit\nthe stage is refused with 422 `too_large`. Optional: released clients do not send it.","format":"int64","type":["integer","null"]},"concern_key":{"description":"The concern this file is the media of (plan 3124): the client's key for the concern,\nmatching its create `Idempotency-Key`. Work orders only; a request with it on another\nparent is refused with 422 `unsupported_attachable`. Optional: released clients do not\nsend it.","type":["string","null"]},"content_type":{"type":"string"},"inspection_item_id":{"description":"The inspection item this photo shows (plan 1211): an item of an inspection on this\nwork order.","format":"int64","type":["integer","null"]},"public_id":{"description":"The client's own id for this attachment (plan 1441): a second call with it answers the\nsame row.","type":["string","null"]}},"required":["content_type"],"type":"object"},"CreateContributionBody":{"properties":{"byte_size":{"description":"The file's size in bytes, when the client knows it: over the contribution limit the\nstage is refused with 422 `too_large` before anything is written.","format":"int64","type":["integer","null"]},"content_type":{"description":"The file's content type; absent = `application/octet-stream` (the kind is checked on\nthe name).","type":["string","null"]},"file_name":{"description":"The file's name as the shop knows it: 1 to 255 characters, a CSV, Excel, ZIP, PDF,\ntext or DBF file.","type":"string"},"note":{"description":"The shop's own note.","type":["string","null"]},"system":{"description":"The shop's program, as the shop chose it.","type":"string"}},"required":["file_name"],"type":"object"},"CreateExpenseReceiptBody":{"description":"A receipt photo staged against a location, before a quick expense files it (plan 1543):\n`CreateAttachmentBody` has no location, so this route has its own body.","properties":{"content_type":{"type":"string"},"location_id":{"format":"int64","type":["integer","null"]}},"required":["content_type"],"type":"object"},"CreateLaborConsentBody":{"properties":{"text_version":{"description":"The labour site's version of the words agreed to, 1 to 64 characters.","type":["string","null"]}},"type":"object"},"CreditApplicationBody":{"properties":{"allow_future_date":{"description":"`true`: accept a future date inside the posting window (FoxPro view)","type":"boolean"},"applied_on":{"description":"YYYY-MM-DD; defaults to the shop's local today","type":["string","null"]},"legs":{"items":{"$ref":"#/components/schemas/CreditLegBody"},"type":"array"}},"type":"object"},"CreditLegBody":{"properties":{"amount_cents":{"format":"int64","type":"integer"},"payment_id":{"format":"int64","type":["integer","null"]},"work_order_id":{"format":"int64","type":["integer","null"]}},"required":["amount_cents"],"type":"object"},"CrudBody":{"properties":{"attrs":{}},"type":"object"},"FeedbackBody":{"description":"`PUT /concerns/{id}/feedback` body.","properties":{"feedback":{"description":"What was found; empty or null clears it.","type":["string","null"]}},"type":"object"},"LinePreviewBody":{"description":"Body of the line preview (plan 405).","properties":{"attrs":{"description":"The body of the create (`item_type`, `part_id` or `part_number`, `quantity_hundredths`, …)"},"line_id":{"description":"The line being edited: its quantity is left out of the committed figure","format":"int64","type":["integer","null"]},"per_location":{"description":"Compare stock with the work order's location and skip not-stocked parts (plan 1002)","type":"boolean"},"resource":{"description":"`line_item` (default) or `sublet`","type":["string","null"]}},"type":"object"},"LinkUserBody":{"properties":{"user_id":{"format":"int64","type":["integer","null"]}},"type":"object"},"ManualInvoiceBody":{"properties":{"amount_cents":{"description":"Gross cents as typed, tax included","format":"int64","type":"integer"},"code":{"description":"\"I\" (invoice) or \"C\" (credit)","type":"string"},"customer_name":{"type":["string","null"]},"date":{"description":"YYYY-MM-DD; defaults to the shop's local today","type":["string","null"]},"gst":{"type":["boolean","null"]},"invoice_number":{"description":"Digits only; none = the next invoice number","format":"int64","type":["integer","null"]},"legs":{"description":"The sales legs, in entry order","items":{"$ref":"#/components/schemas/ManualInvoiceLegBody"},"type":"array"},"pst":{"type":["boolean","null"]},"reference":{"description":"ORDER #, at most 8 characters","type":["string","null"]},"salesman":{"type":["string","null"]},"terms_code":{"type":["string","null"]}},"type":"object"},"ManualInvoiceLegBody":{"properties":{"account":{"description":"G/L account number","type":"string"},"amount_cents":{"description":"Signed cents, FoxPro's sign","format":"int64","type":"integer"}},"required":["account","amount_cents"],"type":"object"},"ReceiptApplicationBody":{"properties":{"discount_cents":{"format":"int64","type":"integer"},"payment_cents":{"description":"Cents; negative against a credit or unapplied money","format":"int64","type":"integer"},"payment_id":{"description":"Unapplied money to consume (then `payment_cents` is negative)","format":"int64","type":["integer","null"]},"work_order_id":{"description":"Posted work order (invoice or credit); 0 or absent when `payment_id` names the item","format":"int64","type":"integer"}},"type":"object"},"ReceiptBody":{"properties":{"allow_future_date":{"description":"Accept a date after today when it is inside the posting window","type":"boolean"},"amount_cents":{"format":"int64","type":"integer"},"applications":{"items":{"$ref":"#/components/schemas/ReceiptApplicationBody"},"type":"array"},"card_last4":{"description":"The card's last 4 digits (debit, visa, mastercard, amex, other)","type":["string","null"]},"method":{"description":"Payment method; may be left out when `payment_type` is sent","type":"string"},"payer_name":{"description":"The name typed for a miscellaneous (`…999`) customer's receipt","type":["string","null"]},"payment_type":{"description":"FoxPro payment-type letter; sets the method","type":["string","null"]},"received_on":{"description":"YYYY-MM-DD; defaults to today (UTC)","type":["string","null"]},"reference":{"type":["string","null"]},"remainder":{"description":"`\"refuse\"` refuses a receipt whose balance to distribute is not 0","type":["string","null"]},"unapplied":{"description":"Money left on account, each with a reference","items":{"$ref":"#/components/schemas/ReceiptUnappliedBody"},"type":"array"}},"required":["amount_cents"],"type":"object"},"ReceiptUnappliedBody":{"properties":{"amount_cents":{"description":"Money left on account, cents (> 0)","format":"int64","type":"integer"},"reference":{"description":"Order number or reference, at most 8 characters","type":"string"}},"required":["amount_cents"],"type":"object"},"RecordBody":{"description":"`PATCH /inspection_items/{id}`: either field may be left out.","properties":{"note":{"type":["string","null"]},"rating":{"type":["string","null"]}},"type":"object"},"RecordRecentSearchBody":{"description":"Request mirror of `domain::wire::search::RecordRecentSearch` (utoipa needs a local\n`ToSchema` type). `type` is a wire name such as `customer` or `work_order`.","properties":{"id":{"format":"int64","type":"integer"},"key":{"type":["string","null"]},"subtitle":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"}},"required":["type","title"],"type":"object"},"RegisterDeviceBody":{"description":"Request mirror of `operations::devices::RegisterDevice` (utoipa needs a\nlocal `ToSchema` type).","properties":{"apns_environment":{"type":["string","null"]},"app_version":{"type":["string","null"]},"platform":{"type":"string"},"token":{"type":"string"}},"required":["platform","token"],"type":"object"},"ReorderBody":{"properties":{"ordinals":{"items":{"$ref":"#/components/schemas/ReorderEntry"},"type":"array"}},"required":["ordinals"],"type":"object"},"ReorderEntry":{"properties":{"id":{"format":"int64","type":"integer"},"ordinal":{"format":"int64","type":"integer"}},"required":["id","ordinal"],"type":"object"},"RepriceBody":{"description":"Body of `POST /work_orders/{id}/reprice` (plan 518).","properties":{"level":{"description":"Price level: 0 = list, 1 to 4 = the part's level price.","format":"int64","type":"integer"}},"required":["level"],"type":"object"},"RingRequest":{"properties":{"label":{"description":"The words on the notification (the person's name, \"Ada Lovelace\").","type":["string","null"]},"number":{"description":"The number to dial.","type":"string"}},"required":["number"],"type":"object"},"ServiceCreateBody":{"description":"`POST /work_orders/{id}/services` (plan 1109): `attrs` as before, or `from` to start the\nservice from a concern, package, declined service or history row (`service_sources`).","properties":{"attrs":{},"from":{"description":"`{kind: concern|package|declined|history, id}`"}},"type":"object"},"SkipBody":{"description":"Request mirror of `domain::wire::first_run::SkipFirstRunSteps` (utoipa needs a local\n`ToSchema` type). Each entry is a step key such as `labour_rate`.","properties":{"steps":{"items":{"type":"string"},"type":"array"}},"required":["steps"],"type":"object"},"TenderBody":{"description":"One payment type's share of a cash-terms post (plan 67).","properties":{"amount_cents":{"description":"Cents: > 0 when the order's balance is owed; < 0 (money handed back) on a\ncredit order whose balance is negative. Never 0.","format":"int64","type":"integer"},"card_last4":{"description":"The card's last 4 digits (debit, visa, mastercard, amex, other)","type":["string","null"]},"method":{"description":"cash | cheque | debit | visa | mastercard | amex | other","type":"string"},"reference":{"description":"Cheque or authorization number","type":["string","null"]}},"required":["method","amount_cents"],"type":"object"},"UpdateAgentTokenBody":{"description":"`PATCH /agent-tokens/{id}`: replaces every limit. Absent = `NULL` = no\nlimit, so an empty body clears them.","properties":{"irreversible":{"description":"Whether tools that need confirmation may run; absent = yes.","type":["boolean","null"]},"permissions":{"description":"Permissions this token is limited to; absent = all the user holds.","items":{"type":"string"},"type":["array","null"]},"write_budget":{"description":"This connection's writes per rolling hour (plan 1482); absent = the\nserver's `[agents] writes_per_hour`.","format":"int64","type":["integer","null"]}},"type":"object"}},"securitySchemes":{"bearer":{"scheme":"bearer","type":"http"}}},"info":{"description":"","license":{"name":""},"title":"Wenmar API","version":"0.1.0"},"openapi":"3.1.0","paths":{"/agent-tokens":{"get":{"operationId":"agent_tokens_list","responses":{"200":{"content":{"application/json":{"schema":{"items":{"type":"object"},"type":"array"}}},"description":"your agent tokens (users.manage: the account's)"},"401":{"description":"unauthenticated"}},"security":[{"bearer":[]}],"tags":["Agent Tokens"]},"post":{"operationId":"agent_tokens_create","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateAgentTokenBody"}}},"required":true},"responses":{"201":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"agent token created; `token` is shown only here"},"401":{"description":"unauthenticated"},"403":{"description":"agent tokens cannot mint agent tokens"},"422":{"description":"invalid name, scope, limits or expires_in_days"}},"security":[{"bearer":[]}],"tags":["Agent Tokens"]}},"/agent-tokens/{id}":{"delete":{"operationId":"agent_tokens_revoke","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"204":{"description":"agent token revoked"},"401":{"description":"unauthenticated"},"403":{"description":"agent tokens cannot revoke agent tokens"},"404":{"description":"no such agent token visible to you"}},"security":[{"bearer":[]}],"tags":["Agent Tokens"]},"patch":{"operationId":"agent_tokens_update","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateAgentTokenBody"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"limits replaced; the token as listed"},"401":{"description":"unauthenticated"},"403":{"description":"agent tokens cannot update agent tokens"},"404":{"description":"no such agent token, or no users.manage"},"422":{"description":"invalid permission list"}},"security":[{"bearer":[]}],"tags":["Agent Tokens"]}},"/ai/actions":{"post":{"operationId":"ai_actions_run","requestBody":{"content":{"application/json":{"schema":{"properties":{"action":{"oneOf":[{"const":"reword","description":"Clearer and complete, same facts.","type":"string"},{"const":"friendlier","description":"Warm and plain, for the customer to read.","type":"string"},{"const":"summarize","description":"One or two sentences.","type":"string"}]},"reference":{"anyOf":[{"description":"A record the user hands the assistant: a chip in the client, never pasted text. `field`\nnames the part of the record meant (`description`, `notes`).","properties":{"field":{"type":["string","null"]},"id":{"format":"int64","type":"integer"},"kind":{"type":"string"}},"required":["kind","id"],"type":"object"},{"type":"null"}],"default":null,"description":"The record and field to rework: kind concern (field body), line_item (description,\nnotes) or service (customer_notes, cause, correction, name). Send this or `text`"},"text":{"default":null,"description":"Text on its own, when it is not on a record yet","type":["string","null"]}},"required":["action"],"type":"object"}}},"required":false},"responses":{"201":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the proposal; nothing is saved (Idempotency-Key replays it)"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized or ai_data_sharing_off"},"404":{"description":"not found"},"409":{"description":"work_order_not_editable"},"422":{"description":"invalid request or idempotency_key_reused"},"503":{"description":"unavailable"}},"security":[{"bearer":[]}],"tags":["Assistant"]}},"/ai/proposals/{id}/accept":{"post":{"operationId":"ai_proposals_accept","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the proposal, saved into its field"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized"},"404":{"description":"not found"},"409":{"description":"target_changed, proposal_decided or work_order_not_editable"}},"security":[{"bearer":[]}],"tags":["Assistant"]}},"/ai/proposals/{id}/reject":{"post":{"operationId":"ai_proposals_reject","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the proposal, rejected"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized"},"404":{"description":"not found"},"409":{"description":"proposal_decided"}},"security":[{"bearer":[]}],"tags":["Assistant"]}},"/appointment_codes":{"delete":{"operationId":"appointment_codes_delete","parameters":[{"description":"the appointment code to delete","in":"query","name":"code","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"`{ code, deleted: true }`"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs catalog.write)"},"404":{"description":"no such code"},"422":{"description":"appointment_code_in_use: an appointment uses the code"}},"security":[{"bearer":[]}],"tags":["Appointments"]},"get":{"operationId":"appointment_codes_index","responses":{"200":{"content":{"application/json":{"schema":{"items":{"type":"object"},"type":"array"}}},"description":"every appointment code in code order: code, description, interval_days, interval_km"},"401":{"description":"unauthenticated"}},"security":[{"bearer":[]}],"tags":["Appointments"]},"put":{"operationId":"appointment_codes_upsert","requestBody":{"content":{"application/json":{"schema":{"properties":{"code":{"default":"","description":"One or two characters, no blanks inside; stored trimmed, upper case","type":"string"},"description":{"default":"","description":"At most 20 characters, plain; trailing blanks trimmed; may be blank","type":"string"},"interval_days":{"default":0,"description":"Days until the next appointment, 0-999","format":"int64","type":"integer"},"interval_km":{"default":0,"description":"Kilometres until the next appointment, 0-999999","format":"int64","type":"integer"}},"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the stored row plus `created`"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs catalog.write)"},"422":{"description":"validation_failed: code, description, interval_days, interval_km"}},"security":[{"bearer":[]}],"tags":["Appointments"]}},"/appointment_codes/{code}/proposal":{"get":{"operationId":"appointment_codes_proposal","parameters":[{"description":"the appointment code","in":"path","name":"code","required":true,"schema":{"type":"string"}},{"description":"YYYY-MM-DD; default: the location's today","in":"query","name":"base_on","required":false,"schema":{"type":"string"}},{"description":"default 0","in":"query","name":"base_km","required":false,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"`{ code, description, due_on, due_km }`: the base plus the code's intervals"},"401":{"description":"unauthenticated"},"404":{"description":"no such code"},"422":{"description":"base_on is not a date"}},"security":[{"bearer":[]}],"tags":["Appointments"]}},"/appointments/{id}":{"delete":{"operationId":"appointments_delete","parameters":[{"description":"appointment id","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"`{ id, deleted: true }`"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs customers.write)"},"404":{"description":"not found"}},"security":[{"bearer":[]}],"tags":["Appointments"]},"patch":{"operationId":"appointments_update","parameters":[{"description":"appointment id","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"properties":{"code":{"default":null,"description":"An appointment code on file","type":["string","null"]},"customer_id":{"default":null,"description":"The customer (create)","format":"int64","type":["integer","null"]},"due_km":{"default":null,"description":"Kilometre mark, 0 to 99999999","format":"int64","type":["integer","null"]},"due_on":{"default":null,"description":"YYYY-MM-DD, or \"\" for blank","type":["string","null"]},"license_plate":{"default":null,"description":"The vehicle's plate, at most 7 characters; stored upper case","type":["string","null"]},"make":{"default":null,"description":"At most 10 characters","type":["string","null"]},"model":{"default":null,"description":"At most 15 characters","type":["string","null"]},"year":{"default":null,"description":"At most 4 characters","type":["string","null"]}},"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the appointment"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs customers.write)"},"404":{"description":"not found"},"422":{"description":"validation_failed"}},"security":[{"bearer":[]}],"tags":["Appointments"]}},"/ar_options":{"get":{"operationId":"ar_options_show","parameters":[{"description":"the location; default: the user's own","in":"query","name":"location_id","required":false,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the A/R option document: location_id, buckets (four of title and days), over_days, discounts_enabled, last_invoice_number, last_receipt_number, last_unapplied_number (each a number or null), legacy (the AROPTION values Wenmar shows and never uses)"},"401":{"description":"unauthenticated"},"403":{"description":"the user may not read this location"},"404":{"description":"no such location"}},"security":[{"bearer":[]}],"tags":["Workflow Config"]},"patch":{"operationId":"ar_options_update","parameters":[{"description":"the location; default: the user's own","in":"query","name":"location_id","required":false,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"properties":{"buckets":{"default":null,"description":"The four aging columns, first to fourth; left out = not changed","items":{"properties":{"days":{"default":0,"description":"Upper limit of the column in days, 1-999; each larger than the one before","format":"int64","type":"integer"},"title":{"default":"","description":"Column title, 1 to 8 characters; stored trimmed","type":"string"}},"type":"object"},"type":["array","null"]},"discounts_enabled":{"default":null,"description":"Allow a discount when a payment is taken; left out = not changed","type":["boolean","null"]},"location_id":{"default":null,"description":"The location whose options are changed; default: the user's own","format":"int64","type":["integer","null"]}},"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the document after the change"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs settings.manage)"},"404":{"description":"no such location"},"422":{"description":"validation_failed, field buckets: not four entries, days not 1-999 or not increasing, a title blank or longer than 8"}},"security":[{"bearer":[]}],"tags":["Workflow Config"]}},"/attachments/{id}":{"get":{"operationId":"attachment_show","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"attachment"},"401":{"description":"unauthenticated"},"404":{"description":"not found"}},"security":[{"bearer":[]}],"tags":["Attachments"]}},"/attachments/{id}/files/{variant}":{"get":{"operationId":"attachment_file","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}},{"in":"path","name":"variant","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"file bytes"},"401":{"description":"unauthenticated"},"404":{"description":"not found"}},"security":[{"bearer":[]}],"tags":["Attachments"]}},"/attachments/{id}/finalize":{"post":{"operationId":"attachment_finalize","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}}],"responses":{"202":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"queued for processing"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized"},"404":{"description":"not found"},"409":{"description":"upload missing"},"422":{"description":"invalid request"}},"security":[{"bearer":[]}],"tags":["Attachments"]}},"/attachments/{id}/upload":{"put":{"operationId":"attachment_upload","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/octet-stream":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"required":true},"responses":{"204":{"description":"bytes stored"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized"},"404":{"description":"not found"},"409":{"description":"not pending"},"413":{"description":"too large"},"422":{"description":"invalid request"}},"security":[{"bearer":[]}],"tags":["Attachments"]}},"/auto_reminder_runs":{"get":{"operationId":"auto_reminder_runs_index","parameters":[{"description":"only this location's runs","in":"query","name":"location_id","required":false,"schema":{"format":"int64","type":"integer"}},{"description":"default 20, at most 100","in":"query","name":"limit","required":false,"schema":{"format":"int32","minimum":0,"type":"integer"}},{"description":"default 0","in":"query","name":"offset","required":false,"schema":{"format":"int32","minimum":0,"type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"`{ data, total, next_offset }`: the runs, newest first"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs customers.read)"}},"security":[{"bearer":[]}],"tags":["Automatic reminders"]}},"/bank/lines":{"get":{"operationId":"bank_lines_index","parameters":[{"description":"only this bank account","in":"query","name":"account","required":false,"schema":{"type":"string"}},{"description":"true: only lines neither matched nor given an entry, each with suggested_ledger_line_id","in":"query","name":"unmatched","required":false,"schema":{"type":"boolean"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"`{data}`: the statement lines, oldest first"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs reports.view)"}},"security":[{"bearer":[]}],"tags":["Bank"]}},"/bank/lines/{id}/entry":{"post":{"operationId":"bank_lines_entry","parameters":[{"description":"statement line id","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"properties":{"memo":{"default":"","description":"At most 120 characters; the line's description when blank","type":"string"},"offset_account":{"default":"","description":"The other side of the entry (chart of accounts), 1 to 10 characters, e.g. a bank fee account","type":"string"}},"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the statement line, with created_entry_id"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs ledger.manage)"},"404":{"description":"no such statement line"},"409":{"description":"conflict: matched, reconciled or with an entry"},"422":{"description":"validation_failed: offset_account, memo; locked (the date is locked)"}},"security":[{"bearer":[]}],"tags":["Bank"]}},"/bank/lines/{id}/match":{"post":{"operationId":"bank_lines_match","parameters":[{"description":"statement line id","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"properties":{"ledger_line_id":{"default":0,"description":"The ledger line on the same bank account, with the same amount","format":"int64","type":"integer"}},"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the statement line, matched"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs ledger.manage)"},"404":{"description":"no such statement line"},"409":{"description":"conflict: matched, reconciled or with an entry; the ledger line is taken"},"422":{"description":"validation_failed: ledger_line_id (another account or amount)"}},"security":[{"bearer":[]}],"tags":["Bank"]}},"/bank/lines/{id}/unmatch":{"post":{"operationId":"bank_lines_unmatch","parameters":[{"description":"statement line id","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the statement line, unmatched"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs ledger.manage)"},"404":{"description":"no such statement line"},"409":{"description":"conflict: not matched, or reconciled"}},"security":[{"bearer":[]}],"tags":["Bank"]}},"/bank/reconciliations":{"get":{"operationId":"bank_reconciliations_index","parameters":[{"description":"only this bank account","in":"query","name":"account","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"`{data}`: reconciliations, newest statement date first"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs reports.view)"}},"security":[{"bearer":[]}],"tags":["Bank"]},"post":{"operationId":"bank_reconciliations_create","requestBody":{"content":{"application/json":{"schema":{"properties":{"account_number":{"default":"","description":"The bank account, 1 to 10 characters","type":"string"},"statement_balance_cents":{"default":0,"description":"The statement's closing balance in cents","format":"int64","type":"integer"},"statement_date":{"default":"","description":"The statement's date, YYYY-MM-DD","type":"string"}},"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the reconciliation"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs ledger.manage)"},"422":{"description":"validation_failed: statement_date (lines not handled), statement_balance_cents (the difference is in the message)"}},"security":[{"bearer":[]}],"tags":["Bank"]}},"/bank/statements":{"post":{"operationId":"bank_statements_import","requestBody":{"content":{"application/json":{"schema":{"properties":{"account_number":{"default":"","description":"The bank account (chart of accounts, bank_account true), 1 to 10 characters","type":"string"},"csv":{"anyOf":[{"description":"The column layout of a CSV statement (0-based columns). Without any `*_column`, the date is\ncolumn 1, the amount column 2 and the description column 3, after the header.","properties":{"amount_column":{"default":null,"description":"One signed amount column: deposits +, withdrawals -","format":"uint","minimum":0,"type":["integer","null"]},"credit_column":{"default":null,"description":"With debit_column: money in (an unsigned column)","format":"uint","minimum":0,"type":["integer","null"]},"date_column":{"default":null,"description":"The date column (default 0)","format":"uint","minimum":0,"type":["integer","null"]},"date_format":{"default":null,"description":"A date format such as %Y-%m-%d (default) or %m/%d/%Y","type":["string","null"]},"debit_column":{"default":null,"description":"With credit_column: money out (an unsigned column)","format":"uint","minimum":0,"type":["integer","null"]},"description_column":{"default":null,"description":"The description column (default 2)","format":"uint","minimum":0,"type":["integer","null"]},"has_header":{"default":null,"description":"The first row names the columns and is skipped (default true)","type":["boolean","null"]}},"type":"object"},{"type":"null"}],"default":null,"description":"The CSV's columns; ignored for ofx and qfx"},"format":{"default":"","description":"csv (default), ofx or qfx","type":"string"},"text":{"default":"","description":"The statement file's text","type":"string"}},"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"`{account_number, format, imported, skipped}`: lines already imported are skipped"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs ledger.manage)"},"422":{"description":"validation_failed: account_number (not a bank account), format, text (the row that is wrong), csv; idempotency_key_reused"}},"security":[{"bearer":[]}],"tags":["Bank"]}},"/bay":{"get":{"operationId":"bay","parameters":[{"description":"location to list; a scoped user's own location always wins","in":"query","name":"location_id","required":false,"schema":{"format":"int64","type":"integer"}},{"description":"orders per list; default and at most 100","in":"query","name":"limit","required":false,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the bay's two lists: `date`, `time_zone`, `location` (null = every location), `technician` (null = the caller has none), `not_picked_up` and `mine` (Today rows, oldest first, at most 100)"},"401":{"description":"unauthenticated"},"403":{"description":"location is outside the caller's access"},"404":{"description":"location not found"}},"security":[{"bearer":[]}],"tags":["Work Orders"]}},"/bays":{"get":{"operationId":"bays_list","parameters":[{"description":"one location; a scoped user's location always wins","in":"query","name":"location_id","required":false,"schema":{"format":"int64","type":"integer"}},{"description":"true = only active bays","in":"query","name":"active","required":false,"schema":{"type":"boolean"}}],"responses":{"200":{"content":{"application/json":{"schema":{"items":{"type":"object"},"type":"array"}}},"description":"bays, by position"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden"}},"security":[{"bearer":[]}],"tags":["Calendar"]},"post":{"operationId":"bays_create","requestBody":{"content":{"application/json":{"schema":{}}},"required":true},"responses":{"201":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"bay created"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs work_orders.create)"},"422":{"description":"invalid request"}},"security":[{"bearer":[]}],"tags":["Calendar"]}},"/bays/{id}":{"delete":{"operationId":"bays_delete","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"204":{"description":"bay removed (soft)"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs work_orders.create)"},"404":{"description":"not found"}},"security":[{"bearer":[]}],"tags":["Calendar"]},"get":{"operationId":"bays_show","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"bay"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden"},"404":{"description":"not found"}},"security":[{"bearer":[]}],"tags":["Calendar"]},"patch":{"operationId":"bays_update","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"bay updated"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs work_orders.create)"},"404":{"description":"not found"},"422":{"description":"invalid request"}},"security":[{"bearer":[]}],"tags":["Calendar"]}},"/bill_payments/{id}/void":{"post":{"operationId":"bill_payments_void","parameters":[{"description":"bill payment id","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the bill, without the voided payment"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs ledger.manage)"},"404":{"description":"no such payment"},"409":{"description":"conflict: already void"}},"security":[{"bearer":[]}],"tags":["Bills"]}},"/billing/usage":{"get":{"operationId":"billing_usage","parameters":[{"description":"`YYYY-MM`; omitted = this month in the shop's first location's zone.","in":"query","name":"month","required":false,"schema":{"type":["string","null"]}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the month's charge under the account's plan, and its posted invoices"},"401":{"description":"unauthenticated"},"403":{"description":"needs settings.manage"},"422":{"description":"validation_failed: month is not YYYY-MM"}},"security":[{"bearer":[]}],"tags":["Billing"]}},"/bills":{"get":{"operationId":"bills_index","parameters":[{"description":"first bill date, YYYY-MM-DD","in":"query","name":"from","required":false,"schema":{"type":"string"}},{"description":"last bill date, YYYY-MM-DD","in":"query","name":"to","required":false,"schema":{"type":"string"}},{"description":"only this vendor's bills","in":"query","name":"vendor_id","required":false,"schema":{"format":"int64","type":"integer"}},{"description":"true: only bills not void with something left to pay","in":"query","name":"open","required":false,"schema":{"type":"boolean"}},{"description":"1-100, default 50","in":"query","name":"limit","required":false,"schema":{"format":"int64","type":"integer"}},{"description":"rows to skip","in":"query","name":"offset","required":false,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"`{data, total, next_offset}`: bills newest date first, each with paid_cents and remaining_cents"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs reports.view)"},"422":{"description":"validation_failed: from, to"}},"security":[{"bearer":[]}],"tags":["Bills"]},"post":{"operationId":"bills_create","requestBody":{"content":{"application/json":{"schema":{"properties":{"bill_date":{"default":"","description":"The bill's date, YYYY-MM-DD","type":"string"},"due_date":{"default":null,"description":"When it is due, YYYY-MM-DD; absent = due on the bill date for aging","type":["string","null"]},"lines":{"default":[],"description":"One or more lines","items":{"properties":{"account_number":{"default":"","description":"The expense account (chart of accounts), 1 to 10 characters","type":"string"},"amount_cents":{"default":0,"description":"The amount before tax, in cents","format":"int64","type":"integer"},"description":{"default":"","description":"What was bought; at most 120 characters","type":"string"},"tax_cents":{"default":0,"description":"The tax on the line, in cents; 0 for none","format":"int64","type":"integer"},"tax_code":{"default":"","description":"gst, hst, pst or none (the default)","type":"string"}},"type":"object"},"type":"array"},"location_id":{"default":null,"description":"The location the bill belongs to; absent = the whole account","format":"int64","type":["integer","null"]},"memo":{"default":"","description":"At most 120 characters","type":"string"},"number":{"default":"","description":"The vendor's invoice number; at most 30 characters","type":"string"},"paid":{"anyOf":[{"properties":{"bank_account":{"default":"","description":"The bank account it was paid from, 1 to 10 characters","type":"string"},"paid_on":{"default":"","description":"The date it was paid, YYYY-MM-DD","type":"string"},"reference":{"default":"","description":"The cheque number or reference; at most 60 characters","type":"string"}},"type":"object"},{"type":"null"}],"default":null,"description":"Paid at once: the bill is an expense and its full payment is recorded with it"},"payable_account":{"default":null,"description":"The payable account credited with the total (default 21000)","type":["string","null"]},"payee":{"default":"","description":"Who was paid when there is no vendor (an expense); at most 60 characters","type":"string"},"vendor_id":{"default":null,"description":"The vendor (from the vendor file); required unless a payee is given","format":"int64","type":["integer","null"]}},"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the new bill with its lines and payments"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs ledger.manage)"},"422":{"description":"validation_failed: vendor_id, payee, bill_date, due_date, lines, paid, payable_account, location_id; idempotency_key_reused"}},"security":[{"bearer":[]}],"tags":["Bills"]}},"/bills/{id}":{"get":{"operationId":"bills_show","parameters":[{"description":"bill id","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the bill with its lines, payments and remaining_cents"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs reports.view)"},"404":{"description":"no such bill"}},"security":[{"bearer":[]}],"tags":["Bills"]}},"/bills/{id}/attachments":{"get":{"operationId":"bill_attachment_index","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the bill's receipt photos, newest first"},"401":{"description":"unauthenticated"},"403":{"description":"needs ledger.manage"},"404":{"description":"no such bill"}},"security":[{"bearer":[]}],"tags":["Attachments"]}},"/bills/{id}/payments":{"post":{"operationId":"bills_pay","parameters":[{"description":"bill id","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"properties":{"amount_cents":{"default":0,"description":"The amount, in cents; at most what is left to pay","format":"int64","type":"integer"},"bank_account":{"default":"","description":"The bank account paid from, 1 to 10 characters","type":"string"},"paid_on":{"default":"","description":"The date paid, YYYY-MM-DD","type":"string"},"reference":{"default":"","description":"The cheque number or reference; at most 60 characters","type":"string"}},"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the bill with the new payment"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs ledger.manage)"},"404":{"description":"no such bill"},"409":{"description":"conflict: the bill is void"},"422":{"description":"validation_failed: paid_on, bank_account, amount_cents (more than remains), reference; idempotency_key_reused"}},"security":[{"bearer":[]}],"tags":["Bills"]}},"/bills/{id}/void":{"post":{"operationId":"bills_void","parameters":[{"description":"bill id","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the voided bill"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs ledger.manage)"},"404":{"description":"no such bill"},"409":{"description":"conflict: already void, or it has a live payment"}},"security":[{"bearer":[]}],"tags":["Bills"]}},"/blocked_times":{"get":{"operationId":"blocked_times_list","parameters":[{"description":"one location; a scoped user's location always wins","in":"query","name":"location_id","required":false,"schema":{"format":"int64","type":"integer"}},{"description":"RFC 3339 UTC; lower bound","in":"query","name":"from","required":false,"schema":{"type":"string"}},{"description":"RFC 3339 UTC; upper bound","in":"query","name":"to","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"items":{"type":"object"},"type":"array"}}},"description":"blocked times, by start"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden"}},"security":[{"bearer":[]}],"tags":["Calendar"]},"post":{"operationId":"blocked_times_create","requestBody":{"content":{"application/json":{"schema":{}}},"required":true},"responses":{"201":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"blocked time created"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs work_orders.create)"},"422":{"description":"invalid request"}},"security":[{"bearer":[]}],"tags":["Calendar"]}},"/blocked_times/{id}":{"delete":{"operationId":"blocked_times_delete","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"204":{"description":"blocked time removed (soft)"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs work_orders.create)"},"404":{"description":"not found"}},"security":[{"bearer":[]}],"tags":["Calendar"]},"get":{"operationId":"blocked_times_show","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"blocked time"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden"},"404":{"description":"not found"}},"security":[{"bearer":[]}],"tags":["Calendar"]},"patch":{"operationId":"blocked_times_update","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"blocked time updated"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs work_orders.create)"},"404":{"description":"not found"},"422":{"description":"invalid request"}},"security":[{"bearer":[]}],"tags":["Calendar"]}},"/bookings":{"get":{"operationId":"bookings_list","parameters":[{"description":"one location; a scoped user's location always wins","in":"query","name":"location_id","required":false,"schema":{"format":"int64","type":"integer"}},{"in":"query","name":"customer_id","required":false,"schema":{"format":"int64","type":"integer"}},{"description":"true = not converted, cancelled or removed","in":"query","name":"open","required":false,"schema":{"type":"boolean"}},{"description":"RFC 3339; inclusive lower bound on expected_at","in":"query","name":"from","required":false,"schema":{"type":"string"}},{"description":"RFC 3339; exclusive upper bound","in":"query","name":"to","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"items":{"type":"object"},"type":"array"}}},"description":"bookings, timed first by time, then untimed"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden"}},"security":[{"bearer":[]}],"tags":["Bookings"]},"post":{"operationId":"bookings_create","requestBody":{"content":{"application/json":{"schema":{}}},"required":true},"responses":{"201":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"booking created (a customer, a name or a phone required)"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs work_orders.create)"},"422":{"description":"invalid request"}},"security":[{"bearer":[]}],"tags":["Bookings"]}},"/bookings/{id}":{"delete":{"operationId":"bookings_delete","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"204":{"description":"booking removed (soft); it stays readable by id"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs work_orders.create)"},"404":{"description":"not found"}},"security":[{"bearer":[]}],"tags":["Bookings"]},"get":{"operationId":"bookings_show","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"booking"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden"},"404":{"description":"not found"}},"security":[{"bearer":[]}],"tags":["Bookings"]},"patch":{"operationId":"bookings_update","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"booking updated"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs work_orders.create)"},"404":{"description":"not found or removed"},"409":{"description":"already converted to a work order"},"422":{"description":"invalid request"}},"security":[{"bearer":[]}],"tags":["Bookings"]}},"/bookings/{id}/check_in":{"post":{"operationId":"bookings_check_in","parameters":[{"description":"the booking","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"{booking_id, draft: {customer, vehicle, concerns, intake, bay_id, technician_id, location_id, booking_id}, odometer: {vehicle_id, reading, on, km_per_day, km_per_day_is_default}}: the draft for a New work order filled from the booking (plan 2603)"},"401":{"description":"unauthenticated"},"404":{"description":"no such booking"}},"security":[{"bearer":[]}],"tags":["Bookings"]}},"/bookings/{id}/convert":{"post":{"operationId":"bookings_convert","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"201":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the new work order's document (Idempotency-Key replays it)"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized (needs work_orders.create) or another location's booking"},"404":{"description":"not found"},"409":{"description":"the booking is already a work order, or was removed"},"422":{"description":"validation_failed (customer_id: the booking has no customer) or idempotency_key_reused"}},"security":[{"bearer":[]}],"tags":["Work Orders"]}},"/calendar":{"get":{"operationId":"calendar","parameters":[{"description":"the location to read; default the user's home location, else the account's first","in":"query","name":"location_id","required":false,"schema":{"format":"int64","type":"integer"}},{"description":"first day, YYYY-MM-DD, in the location's local time; default today there","in":"query","name":"from","required":false,"schema":{"type":"string"}},{"description":"1-7 days, default 7","in":"query","name":"days","required":false,"schema":{"format":"int32","minimum":0,"type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the calendar: `location_id`, `from`, `columns` (active bays by position, then `not assigned`), and `days` (per day: `items` with `overlaps`, `all_day`, `promised`)"},"401":{"description":"unauthenticated"},"403":{"description":"location is outside the caller's access"},"404":{"description":"location not found"},"422":{"description":"invalid `from`"}},"security":[{"bearer":[]}],"tags":["Calendar"]}},"/calls":{"post":{"operationId":"calls_create","requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"description":"The `log_call` params. Every link is optional: a call may be logged with only its outcome,\nand the links it can work out (the order's customer and driver, the driver's customer) are\nfilled in.","properties":{"called_at":{"default":null,"description":"When the call happened (RFC 3339); left out for now.","type":["string","null"]},"conversation_id":{"default":null,"description":"The conversation the call belongs to; left out to use the customer's or the driver's.","format":"int64","type":["integer","null"]},"customer_id":{"default":null,"description":"The customer who was called; left out when the work order or the driver names them.","format":"int64","type":["integer","null"]},"driver_id":{"default":null,"description":"The customer's driver who was called.","format":"int64","type":["integer","null"]},"note":{"default":null,"description":"What was said, in the caller's words.","type":["string","null"]},"number":{"default":null,"description":"The number dialled (E.164 when it has one).","type":["string","null"]},"outcome":{"description":"The only required field: `talked`, `voicemail` or `no_answer`.","type":"string"},"work_order_id":{"default":null,"description":"The work order the call was about.","format":"int64","type":["integer","null"]}},"required":["outcome"],"type":"object"}}},"required":false},"responses":{"201":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the logged call (Idempotency-Key replays it)"},"403":{"description":"needs customers.write"},"404":{"description":"no such work order, customer, driver or conversation"},"422":{"description":"validation_failed (outcome, note, called_at, the links) or idempotency_key_reused"}},"security":[{"bearer":[]}],"summary":"`POST /calls` (plan 2646): log a call — how it went is the only required field. Keyed on\n`Idempotency-Key`; audited. The call shows in the person's conversation and the order's\nHistory.","tags":["Messages"]}},"/campaigns":{"get":{"operationId":"campaigns_list","parameters":[{"in":"query","name":"status","required":false,"schema":{"type":["string","null"]}},{"in":"query","name":"limit","required":false,"schema":{"format":"int64","type":["integer","null"]}},{"in":"query","name":"offset","required":false,"schema":{"format":"int64","type":["integer","null"]}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"campaigns newest first: `{data, total, next_offset}`"},"403":{"description":"needs customers.read"}},"security":[{"bearer":[]}],"tags":["Campaigns"]},"post":{"operationId":"campaigns_create","parameters":[{"description":"replays the first draft","in":"header","name":"Idempotency-Key","required":false,"schema":{"type":["string","null"]}}],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"audience":{"description":"{\"source\": \"due_for\", \"kind\": \"service\", \"within_days\": 30} or\n{\"source\": \"customers\", \"customer_ids\": [1, 2]}"},"body":{"description":"The message. {first_name}, {name}, {vehicle}, {due_on}, {code}, {shop} are filled per\ncustomer.","type":"string"},"channel":{"description":"sms or email","type":"string"},"kind":{"default":null,"description":"reminder or broadcast (default broadcast)","type":["string","null"]},"location_id":{"default":null,"description":"The location whose name is {shop}","format":"int64","type":["integer","null"]},"name":{"description":"A name for the shop's own list (\"Fall oil change\")","type":"string"},"subject":{"default":null,"description":"E-mail subject (e-mail only)","type":["string","null"]}},"required":["name","channel","body","audience"],"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the draft campaign"},"403":{"description":"needs campaigns.send and messages.send"},"422":{"description":"validation_failed or idempotency_key_reused"}},"security":[{"bearer":[]}],"tags":["Campaigns"]}},"/campaigns/{id}":{"get":{"operationId":"campaigns_show","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the campaign, and its recipients once sent"},"404":{"description":"no such campaign"}},"security":[{"bearer":[]}],"tags":["Campaigns"]},"patch":{"operationId":"campaigns_update","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"audience":{"default":null,"description":"The audience document"},"body":{"default":null,"description":"The message, with {first_name}, {name}, {vehicle}, {due_on}, {code}, {shop}","type":["string","null"]},"channel":{"default":null,"description":"sms or email","type":["string","null"]},"kind":{"default":null,"description":"reminder or broadcast","type":["string","null"]},"location_id":{"default":null,"description":"The location whose name is {shop}","format":"int64","type":["integer","null"]},"name":{"default":null,"description":"A new name","type":["string","null"]},"subject":{"default":null,"description":"E-mail subject (e-mail only)","type":["string","null"]}},"required":[],"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the changed draft"},"409":{"description":"conflict: it is no longer a draft"},"422":{"description":"validation_failed"}},"security":[{"bearer":[]}],"tags":["Campaigns"]}},"/campaigns/{id}/cancel":{"post":{"operationId":"campaigns_cancel","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the cancelled campaign"},"409":{"description":"conflict: it is no longer a draft"}},"security":[{"bearer":[]}],"tags":["Campaigns"]}},"/campaigns/{id}/preview":{"get":{"operationId":"campaigns_preview","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"who would receive it, who is skipped and why, and samples"},"404":{"description":"no such campaign"}},"security":[{"bearer":[]}],"tags":["Campaigns"]}},"/campaigns/{id}/send":{"post":{"operationId":"campaigns_send","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the sent campaign"},"409":{"description":"conflict: it is cancelled"}},"security":[{"bearer":[]}],"tags":["Campaigns"]}},"/chart_accounts":{"delete":{"operationId":"chart_accounts_delete","parameters":[{"description":"the account number to delete","in":"query","name":"number","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"`{ number, deleted: true }`"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs settings.manage)"},"404":{"description":"no such account"},"422":{"description":"chart_account_in_use: details name where (parts, technicians, vendors, manual_invoices, locations)"}},"security":[{"bearer":[]}],"tags":["Chart of Accounts"]},"get":{"operationId":"chart_accounts_index","parameters":[{"description":"true: without the location's A/R account and its bank accounts","in":"query","name":"exclude_control","required":false,"schema":{"type":"boolean"}}],"responses":{"200":{"content":{"application/json":{"schema":{"items":{"type":"object"},"type":"array"}}},"description":"the accounts in number order: number, description, class_type (A L E S C X O T or blank), normal_balance (+, - or blank)"},"401":{"description":"unauthenticated"}},"security":[{"bearer":[]}],"tags":["Chart of Accounts"]},"put":{"operationId":"chart_accounts_upsert","requestBody":{"content":{"application/json":{"schema":{"properties":{"archived":{"default":null,"description":"true retires the account (it stays on the chart and in every report; no new ledger line\nmay use it); false brings it back. Absent = keep. A number itself never changes.","type":["boolean","null"]},"bank_account":{"default":null,"description":"Reconcilable with the bank. Absent = keep the stored flag","type":["boolean","null"]},"class_type":{"default":"","description":"A Asset, L Liability, E Equity, S Sales, C Cost Of Sales, X G/A Expenses, O Other Income, T Income Taxes; blank = not classified","type":"string"},"description":{"default":"","description":"At most 35 characters; case kept; may be blank","type":"string"},"fox":{"default":false,"description":"true = the rules of FoxPro's account editor: class_type and normal_balance are required. Default false","type":"boolean"},"gifi_code":{"default":null,"description":"CRA GIFI code, 4 digits; blank = not mapped. Absent = keep the stored code","type":["string","null"]},"normal_balance":{"default":"","description":"The normal balance: + (debit) or - (credit); blank = not set","type":"string"},"number":{"default":"","description":"The account number, 1-10 characters without blanks; stored trimmed, upper case","type":"string"},"quickbooks_name":{"default":null,"description":"The account's name in the accountant's QuickBooks (Parent:Child for a sub-account), at\nmost 100 characters; blank = use the description. Absent = keep the stored name","type":["string","null"]}},"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the stored account plus `created`"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs settings.manage)"},"422":{"description":"validation_failed: number, description, class_type, normal_balance (with `fox: true` the last two are required and carry FoxPro's messages)"}},"security":[{"bearer":[]}],"tags":["Chart of Accounts"]}},"/concerns/{id}":{"delete":{"operationId":"concerns_delete","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"204":{"description":"concern deleted; a service made from it stays"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized or another location's work order"},"404":{"description":"not found"},"409":{"description":"already_posted or work_order_not_editable"}},"security":[{"bearer":[]}],"tags":["Work Orders"]},"get":{"operationId":"concerns_show","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"concern"},"401":{"description":"unauthenticated"},"403":{"description":"another location's work order"},"404":{"description":"not found"}},"security":[{"bearer":[]}],"tags":["Work Orders"]},"patch":{"operationId":"concerns_update","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CrudBody"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"concern updated (attrs: body, source)"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized or another location's work order"},"404":{"description":"not found"},"409":{"description":"already_posted or work_order_not_editable"},"422":{"description":"invalid request"}},"security":[{"bearer":[]}],"tags":["Work Orders"]}},"/concerns/{id}/convert":{"post":{"operationId":"concerns_convert","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"201":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the service made from the concern (Idempotency-Key replays it)"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized or another location's work order"},"404":{"description":"not found"},"409":{"description":"the concern is already a service, already_posted or work_order_not_editable"},"422":{"description":"idempotency_key_reused"}},"security":[{"bearer":[]}],"tags":["Work Orders"]}},"/concerns/{id}/feedback":{"put":{"operationId":"concerns_feedback","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FeedbackBody"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the concern with its feedback, who wrote it and when (an empty feedback clears all three)"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized or another location's work order"},"404":{"description":"not found"},"409":{"description":"already_posted or work_order_not_editable"},"422":{"description":"feedback too long or with a control character"}},"security":[{"bearer":[]}],"tags":["Work Orders"]}},"/contacts":{"get":{"operationId":"contacts","parameters":[{"description":"The work order: its customer, its driver (or the vehicle's), and a fleet's other drivers.","in":"query","name":"work_order_id","required":false,"schema":{"format":"int64","type":["integer","null"]}},{"description":"One customer.","in":"query","name":"customer_id","required":false,"schema":{"format":"int64","type":["integer","null"]}},{"description":"One vehicle: its customer and its usual driver.","in":"query","name":"vehicle_id","required":false,"schema":{"format":"int64","type":["integer","null"]}},{"description":"One driver: its customer and the driver.","in":"query","name":"driver_id","required":false,"schema":{"format":"int64","type":["integer","null"]}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"`{work_order_id, customer_id, vehicle_id, driver_id, contacts, templates, estimate_link}`: the people to contact about the record, each with its numbers, addresses, conversation and last message; for a work order, the templates that fit its stage first and whether the estimate link can be added"},"403":{"description":"needs customers.read, or another location's work order"},"404":{"description":"no such record"},"422":{"description":"not exactly one of work_order_id, customer_id, vehicle_id, driver_id"}},"security":[{"bearer":[]}],"summary":"`GET /contacts` (plan 2646): the contact sheet of a customer, vehicle, driver or work order.\nA read helper, not a registry tool: an agent reads the customer's `contact_options`.","tags":["Messages"]}},"/conversations":{"get":{"operationId":"conversations_list","parameters":[{"in":"query","name":"unread_only","required":false,"schema":{"type":["boolean","null"]}},{"in":"query","name":"page","required":false,"schema":{"format":"int64","type":["integer","null"]}},{"in":"query","name":"per_page","required":false,"schema":{"format":"int64","type":["integer","null"]}},{"description":"`waiting` = the customer wrote last, `replied` = we wrote last.","in":"query","name":"tier","required":false,"schema":{"type":["string","null"]}}],"responses":{"200":{"content":{"application/json":{"schema":{"items":{"type":"object"},"type":"array"}}},"description":"conversations, newest first"}},"security":[{"bearer":[]}],"tags":["Messages"]}},"/conversations/{id}":{"get":{"operationId":"conversations_show","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}},{"in":"query","name":"before_id","required":false,"schema":{"format":"int64","type":["integer","null"]}},{"in":"query","name":"limit","required":false,"schema":{"format":"int64","type":["integer","null"]}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"one conversation"},"404":{"description":"not found"}},"security":[{"bearer":[]}],"tags":["Messages"]}},"/conversations/{id}/link":{"post":{"operationId":"conversations_link","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"description":"`conversations.link`: the conversation's address goes to a customer (an existing one, or a\nnew one made here); the conversation becomes that customer's.","properties":{"customer_id":{"default":null,"description":"Link to this existing customer.","format":"int64","type":["integer","null"]},"new_customer":{"anyOf":[{"additionalProperties":false,"description":"The new customer a link makes, when it does not point at an existing one (plan 2624).","properties":{"company_name":{"default":null,"type":["string","null"]},"first_name":{"default":null,"type":["string","null"]},"last_name":{"default":null,"type":["string","null"]}},"type":"object"},{"type":"null"}],"description":"Create a new customer with this name (first, last or company) and link it."}},"required":[],"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the linked conversation and its customer"},"404":{"description":"no such conversation"},"409":{"description":"already_linked, customer_has_conversation"}},"security":[{"bearer":[]}],"tags":["Messages"]}},"/conversations/{id}/read":{"post":{"operationId":"conversations_read","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"description":"`conversations.mark_read`: the user's own read mark, no permission.","properties":{"message_id":{"default":null,"description":"Up to this message; the newest one when left out.","format":"int64","type":["integer","null"]}},"required":[],"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the user's read mark"}},"security":[{"bearer":[]}],"tags":["Messages"]}},"/cores":{"get":{"operationId":"cores_index","parameters":[{"description":"supplier (default) or customer","in":"query","name":"side","required":false,"schema":{"type":"string"}},{"description":"supplier: open (default), owed, returned, credited, all; customer: open (default), all","in":"query","name":"status","required":false,"schema":{"type":"string"}},{"description":"only this vendor; 0 = no vendor","in":"query","name":"vendor_id","required":false,"schema":{"format":"int64","type":"integer"}},{"description":"only this location","in":"query","name":"location_id","required":false,"schema":{"format":"int64","type":"integer"}},{"description":"1-100, default 50","in":"query","name":"limit","required":false,"schema":{"format":"int64","type":"integer"}},{"description":"rows to skip","in":"query","name":"offset","required":false,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"`{data, total, next_offset, total_cents, vendors: [{vendor_id, vendor_name, count, core_cents}]}`; supplier rows by vendor then oldest first"},"401":{"description":"unauthenticated"},"422":{"description":"validation_failed: side, status, limit"}},"security":[{"bearer":[]}],"tags":["Parts"]}},"/cores/credit":{"post":{"operationId":"cores_credit","requestBody":{"content":{"application/json":{"schema":{"properties":{"credited_on":{"default":null,"description":"credit: the day the supplier credited the cores; the same as `on`","type":["string","null"]},"line_item_ids":{"default":[],"description":"The part lines (work_order_line_items ids) whose cores this is about, 1 to 100","items":{"format":"int64","type":"integer"},"type":"array"},"on":{"default":null,"description":"YYYY-MM-DD: the day the old parts went back (return) or were credited (credit); default the shop's today","type":["string","null"]},"reference":{"default":null,"description":"credit: the supplier's credit memo or receipt number","type":["string","null"]},"returned_on":{"default":null,"description":"return: the day the old parts went back; the same as `on`","type":["string","null"]},"vendor_id":{"default":null,"description":"return: the vendor the cores went back to; fills lines that name none","format":"int64","type":["integer","null"]}},"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"`{data: [rows]}`: `{line_item_ids, on?, reference?}`, the supplier credited the cores"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs catalog.write)"},"422":{"description":"validation_failed: line_item_ids, on, reference"}},"security":[{"bearer":[]}],"tags":["Parts"]}},"/cores/reopen":{"post":{"operationId":"cores_reopen","requestBody":{"content":{"application/json":{"schema":{"properties":{"credited_on":{"default":null,"description":"credit: the day the supplier credited the cores; the same as `on`","type":["string","null"]},"line_item_ids":{"default":[],"description":"The part lines (work_order_line_items ids) whose cores this is about, 1 to 100","items":{"format":"int64","type":"integer"},"type":"array"},"on":{"default":null,"description":"YYYY-MM-DD: the day the old parts went back (return) or were credited (credit); default the shop's today","type":["string","null"]},"reference":{"default":null,"description":"credit: the supplier's credit memo or receipt number","type":["string","null"]},"returned_on":{"default":null,"description":"return: the day the old parts went back; the same as `on`","type":["string","null"]},"vendor_id":{"default":null,"description":"return: the vendor the cores went back to; fills lines that name none","format":"int64","type":["integer","null"]}},"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"`{data: [rows]}`: `{line_item_ids}`, the cores are owed again"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs catalog.write)"},"422":{"description":"validation_failed: line_item_ids"}},"security":[{"bearer":[]}],"tags":["Parts"]}},"/cores/return":{"post":{"operationId":"cores_return","requestBody":{"content":{"application/json":{"schema":{"properties":{"credited_on":{"default":null,"description":"credit: the day the supplier credited the cores; the same as `on`","type":["string","null"]},"line_item_ids":{"default":[],"description":"The part lines (work_order_line_items ids) whose cores this is about, 1 to 100","items":{"format":"int64","type":"integer"},"type":"array"},"on":{"default":null,"description":"YYYY-MM-DD: the day the old parts went back (return) or were credited (credit); default the shop's today","type":["string","null"]},"reference":{"default":null,"description":"credit: the supplier's credit memo or receipt number","type":["string","null"]},"returned_on":{"default":null,"description":"return: the day the old parts went back; the same as `on`","type":["string","null"]},"vendor_id":{"default":null,"description":"return: the vendor the cores went back to; fills lines that name none","format":"int64","type":["integer","null"]}},"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"`{data: [rows]}`: `{line_item_ids, on?, vendor_id?}`, owed cores went back to the supplier"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs catalog.write)"},"422":{"description":"validation_failed: line_item_ids, on, vendor_id"}},"security":[{"bearer":[]}],"tags":["Parts"]}},"/courtesy_car_loans":{"get":{"operationId":"courtesy_car_loans_index","responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"loans newest first: `{data, total, next_offset}`"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden"},"404":{"description":"not found"},"409":{"description":"conflict"},"422":{"description":"validation_failed"}},"security":[{"bearer":[]}],"tags":["Courtesy cars"]}},"/courtesy_car_loans/lend":{"post":{"operationId":"courtesy_car_loans_lend","requestBody":{"content":{"application/json":{"schema":{"properties":{"courtesy_car_id":{"description":"The car to lend","format":"int64","type":"integer"},"customer_id":{"default":null,"description":"Who has it; default: the work order's customer","format":"int64","type":["integer","null"]},"driver_id":{"default":null,"description":"Who drives it (one of the customer's drivers); default: the work order's driver","format":"int64","type":["integer","null"]},"due_back_at":{"default":null,"description":"When it is due back (UTC time)","type":["string","null"]},"fuel_out_eighths":{"default":null,"description":"Fuel going out, 0-8 eighths; default: what the last return left","format":"int64","type":["integer","null"]},"odometer_out":{"default":null,"description":"The odometer going out; default: the car's","format":"int64","type":["integer","null"]},"work_order_id":{"default":null,"description":"The work order it is lent on; without one a customer is needed","format":"int64","type":["integer","null"]}},"required":["courtesy_car_id"],"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the loan, out; 409 car_not_available, car_out_of_service; adds the location's fee line when it has one"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden"},"404":{"description":"not found"},"409":{"description":"conflict"},"422":{"description":"validation_failed"}},"security":[{"bearer":[]}],"tags":["Courtesy cars"]}},"/courtesy_car_loans/reserve":{"post":{"operationId":"courtesy_car_loans_reserve","requestBody":{"content":{"application/json":{"schema":{"properties":{"booking_id":{"default":null,"description":"The booking it is for","format":"int64","type":["integer","null"]},"courtesy_car_id":{"description":"The car to hold","format":"int64","type":"integer"},"customer_id":{"default":null,"description":"Who it is for; default: the work order's or booking's customer","format":"int64","type":["integer","null"]},"reserved_for_at":{"default":null,"description":"When the reservation starts (UTC time)","type":["string","null"]},"work_order_id":{"default":null,"description":"The work order it is for","format":"int64","type":["integer","null"]}},"required":["courtesy_car_id"],"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the reservation; 409 car_not_available, car_out_of_service"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden"},"404":{"description":"not found"},"409":{"description":"conflict"},"422":{"description":"validation_failed"}},"security":[{"bearer":[]}],"tags":["Courtesy cars"]}},"/courtesy_car_loans/{id}/agreement":{"post":{"operationId":"courtesy_car_loans_agreement","parameters":[{"description":"id","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"properties":{"attachment_id":{"description":"The signature image, an attachment of the loan's work order","type":"string"}},"required":["attachment_id"],"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the loan with its agreement attachment"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden"},"404":{"description":"not found"},"409":{"description":"conflict"},"422":{"description":"validation_failed"}},"security":[{"bearer":[]}],"tags":["Courtesy cars"]}},"/courtesy_car_loans/{id}/cancel":{"post":{"operationId":"courtesy_car_loans_cancel","parameters":[{"description":"id","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"properties":{},"required":[],"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the cancelled reservation"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden"},"404":{"description":"not found"},"409":{"description":"conflict"},"422":{"description":"validation_failed"}},"security":[{"bearer":[]}],"tags":["Courtesy cars"]}},"/courtesy_car_loans/{id}/return":{"post":{"operationId":"courtesy_car_loans_return","parameters":[{"description":"id","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"properties":{"damage_note":{"default":null,"description":"Damage found (\"scratch rear bumper\")","type":["string","null"]},"fuel_in_eighths":{"default":null,"description":"Fuel coming in, 0-8 eighths","format":"int64","type":["integer","null"]},"odometer_in":{"default":null,"description":"The odometer coming in; sets the car's odometer","format":"int64","type":["integer","null"]}},"required":[],"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the returned loan with `warnings` (odometer_in_lower)"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden"},"404":{"description":"not found"},"409":{"description":"conflict"},"422":{"description":"validation_failed"}},"security":[{"bearer":[]}],"tags":["Courtesy cars"]}},"/courtesy_car_loans/{id}/sign":{"post":{"operationId":"courtesy_car_loans_sign","parameters":[{"description":"id","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"properties":{"method":{"description":"in_person (a signature image), paper (the customer signed the printed terms) or portal","type":"string"},"signature_attachment_id":{"default":null,"description":"The signature image, an attachment of the loan's work order; required for in_person","type":["string","null"]},"signer_name":{"description":"Who signed","type":"string"}},"required":["method","signer_name"],"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the loan with its agreement"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden"},"404":{"description":"not found"},"409":{"description":"conflict"},"422":{"description":"validation_failed"}},"security":[{"bearer":[]}],"tags":["Courtesy cars"]}},"/courtesy_cars":{"get":{"operationId":"courtesy_cars_index","responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the location's courtesy cars with their state and open loan: `{data, total, next_offset}`"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden"},"404":{"description":"not found"},"409":{"description":"conflict"},"422":{"description":"validation_failed"}},"security":[{"bearer":[]}],"tags":["Courtesy cars"]},"post":{"operationId":"courtesy_cars_create","requestBody":{"content":{"application/json":{"schema":{"properties":{"license_plate":{"default":null,"type":["string","null"]},"location_id":{"default":null,"description":"The location the car belongs to; default: the user's own (or the first)","format":"int64","type":["integer","null"]},"make":{"default":null,"type":["string","null"]},"model":{"default":null,"type":["string","null"]},"name":{"description":"The car's name on the board, e.g. \"Blue Corolla\"; unique among the location's live cars","type":"string"},"notes":{"default":null,"type":["string","null"]},"odometer":{"default":null,"description":"The odometer now, in the car's unit","format":"int64","type":["integer","null"]},"odometer_unit":{"default":null,"description":"0 = km, 1 = mi (default 0)","format":"int64","type":["integer","null"]},"vin":{"default":null,"type":["string","null"]},"year":{"default":null,"format":"int64","type":["integer","null"]}},"required":["name"],"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the new car (needs settings.manage)"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden"},"404":{"description":"not found"},"409":{"description":"conflict"},"422":{"description":"validation_failed"}},"security":[{"bearer":[]}],"tags":["Courtesy cars"]}},"/courtesy_cars/{id}":{"get":{"operationId":"courtesy_cars_show","parameters":[{"description":"id","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"one car with its state and open loan"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden"},"404":{"description":"not found"},"409":{"description":"conflict"},"422":{"description":"validation_failed"}},"security":[{"bearer":[]}],"tags":["Courtesy cars"]},"patch":{"operationId":"courtesy_cars_update","parameters":[{"description":"id","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"properties":{"license_plate":{"default":null,"description":"A new plate; an empty string clears it","type":["string","null"]},"make":{"default":null,"type":["string","null"]},"model":{"default":null,"type":["string","null"]},"name":{"default":null,"description":"A new name","type":["string","null"]},"notes":{"default":null,"type":["string","null"]},"odometer":{"default":null,"format":"int64","type":["integer","null"]},"odometer_unit":{"default":null,"description":"0 = km, 1 = mi","format":"int64","type":["integer","null"]},"vin":{"default":null,"type":["string","null"]},"year":{"default":null,"format":"int64","type":["integer","null"]}},"required":[],"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the changed car (needs settings.manage)"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden"},"404":{"description":"not found"},"409":{"description":"conflict"},"422":{"description":"validation_failed"}},"security":[{"bearer":[]}],"tags":["Courtesy cars"]}},"/courtesy_cars/{id}/archive":{"post":{"operationId":"courtesy_cars_archive","parameters":[{"description":"id","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"properties":{},"required":[],"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the archived car; 409 car_has_open_loan while a loan is open"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden"},"404":{"description":"not found"},"409":{"description":"conflict"},"422":{"description":"validation_failed"}},"security":[{"bearer":[]}],"tags":["Courtesy cars"]}},"/courtesy_cars/{id}/out_of_service":{"post":{"operationId":"courtesy_cars_out_of_service","parameters":[{"description":"id","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"properties":{"note":{"default":null,"description":"Why, kept on the car's notes","type":["string","null"]},"out":{"description":"true: not lendable (\"at the body shop\"); false: back in service","type":"boolean"}},"required":["out"],"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the car, out of service or back"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden"},"404":{"description":"not found"},"409":{"description":"conflict"},"422":{"description":"validation_failed"}},"security":[{"bearer":[]}],"tags":["Courtesy cars"]}},"/customer_emails/{id}":{"delete":{"operationId":"customer_emails_delete","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"204":{"description":"removed; the FoxPro slot it mirrored is cleared"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs customers.write)"},"404":{"description":"not found"}},"security":[{"bearer":[]}],"tags":["Customers"]},"get":{"operationId":"customer_emails_show","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"e-mail address"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs customers.read)"},"404":{"description":"not found"}},"security":[{"bearer":[]}],"tags":["Customers"]},"patch":{"operationId":"customer_emails_update","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"e-mail address updated"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs customers.write)"},"404":{"description":"not found"},"422":{"description":"invalid request"}},"security":[{"bearer":[]}],"tags":["Customers"]}},"/customer_notes/{id}":{"delete":{"operationId":"customer_notes_delete","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"204":{"description":"removed (soft delete)"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs customers.write)"},"404":{"description":"not found"}},"security":[{"bearer":[]}],"tags":["Customers"]},"get":{"operationId":"customer_notes_show","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"note or alert"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs customers.read)"},"404":{"description":"not found"}},"security":[{"bearer":[]}],"tags":["Customers"]},"patch":{"operationId":"customer_notes_update","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"note updated"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs customers.write)"},"404":{"description":"not found"},"422":{"description":"invalid request"}},"security":[{"bearer":[]}],"tags":["Customers"]}},"/customer_phones/{id}":{"delete":{"operationId":"customer_phones_delete","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"204":{"description":"removed; the FoxPro slot it mirrored is cleared"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs customers.write)"},"404":{"description":"not found"}},"security":[{"bearer":[]}],"tags":["Customers"]},"get":{"operationId":"customer_phones_show","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"phone"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs customers.read)"},"404":{"description":"not found"}},"security":[{"bearer":[]}],"tags":["Customers"]},"patch":{"operationId":"customer_phones_update","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"phone updated"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs customers.write)"},"404":{"description":"not found"},"422":{"description":"invalid request"}},"security":[{"bearer":[]}],"tags":["Customers"]}},"/customer_ship_tos/{id}":{"delete":{"operationId":"customer_ship_tos_delete","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"204":{"description":"ship-to deleted (soft)"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs customers.write)"},"404":{"description":"not found"},"422":{"description":"ship-to 000 cannot be deleted"}},"security":[{"bearer":[]}],"tags":["Customers"]},"patch":{"operationId":"customer_ship_tos_update","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"ship-to updated"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs customers.write)"},"404":{"description":"not found"},"422":{"description":"invalid request"}},"security":[{"bearer":[]}],"tags":["Customers"]}},"/customer_tags":{"get":{"operationId":"customer_tags_index","responses":{"200":{"content":{"application/json":{"schema":{"items":{"type":"object"},"type":"array"}}},"description":"the shop's tags, A–Z, each with its customer count"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs customers.read)"}},"security":[{"bearer":[]}],"tags":["Customers"]},"post":{"operationId":"customer_tags_create","requestBody":{"content":{"application/json":{"schema":{}}},"required":true},"responses":{"201":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"tag created (name required)"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs customers.write)"},"422":{"description":"invalid request (blank, taken or over-long name; bad color)"}},"security":[{"bearer":[]}],"tags":["Customers"]}},"/customer_tags/{id}":{"delete":{"operationId":"customer_tags_delete","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"204":{"description":"tag removed; its customers lose the tag"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs customers.write)"},"404":{"description":"not found"}},"security":[{"bearer":[]}],"tags":["Customers"]},"get":{"operationId":"customer_tags_show","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the tag"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs customers.read)"},"404":{"description":"not found"}},"security":[{"bearer":[]}],"tags":["Customers"]},"patch":{"operationId":"customer_tags_update","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"tag updated"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs customers.write)"},"404":{"description":"not found"},"422":{"description":"invalid request"}},"security":[{"bearer":[]}],"tags":["Customers"]}},"/customers":{"get":{"operationId":"customers_index","parameters":[{"description":"legacy customer number; `ABC?` scans numbers starting ABC (FoxPro SESCAN)","in":"query","name":"customer_number","required":false,"schema":{"type":"string"}},{"description":"name substring, case-insensitive","in":"query","name":"name","required":false,"schema":{"type":"string"}},{"description":"phone; matched on its last 7 digits","in":"query","name":"phone","required":false,"schema":{"type":"string"}},{"description":"vehicle licence plate, exact, case-insensitive","in":"query","name":"license","required":false,"schema":{"type":"string"}},{"description":"work order or invoice number (location-scoped)","in":"query","name":"order_number","required":false,"schema":{"type":"string"}},{"description":"with order_number: `open` matches only an open order (in progress or completed, not posted, not cancelled) by its order number, never an invoice number (FoxPro SERORDER)","in":"query","name":"order_scope","required":false,"schema":{"type":"string"}},{"description":"one search box: tries every criterion above","in":"query","name":"q","required":false,"schema":{"type":"string"}},{"description":"plain list only; a lookup keeps its own order. `owing`: customers who owe money first, then the rest, each A–Z by name. `name`: display name A–Z. `number`: customer number. `balance`: outstanding balance","in":"query","name":"sort","required":false,"schema":{"type":"string"}},{"description":"`asc` (default) or `desc`; the direction of `sort` (plain list only)","in":"query","name":"dir","required":false,"schema":{"type":"string"}},{"description":"only customers carrying one of these tags (a name, any case, or a tag id; a comma list is any of them); plain list only","in":"query","name":"tag","required":false,"schema":{"type":"string"}},{"description":"only customers with one of these lead sources (a comma list is any of them); plain list only","in":"query","name":"lead_source_id","required":false,"schema":{"type":"string"}},{"description":"only customers with one of these statuses (`active`, `inactive`, `trashed`; a comma list is any of them). Without it, the trashed rows are hidden; plain list only","in":"query","name":"status","required":false,"schema":{"type":"string"}},{"description":"page, 1-based","in":"query","name":"page","required":false,"schema":{"format":"int64","type":"integer"}},{"description":"rows per page, 1-100 (default 50)","in":"query","name":"per_page","required":false,"schema":{"format":"int64","type":"integer"}},{"description":"rows updated after this RFC 3339 timestamp (plain list only)","in":"query","name":"updated_since","required":false,"schema":{"type":"string"}},{"description":"keyset paging: rows with id greater than this, in id order (plain list only)","in":"query","name":"after","required":false,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"items":{"type":"object"},"type":"array"}}},"description":"customer list; lookup rows carry `match`"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden"},"422":{"description":"invalid lookup (two criteria, short phone, unknown order_scope), or `after` on a non-plain list"}},"security":[{"bearer":[]}],"tags":["Customers"]},"post":{"operationId":"customers_create","parameters":[{"description":"`1`: only the checks of before plan 1309, no `warnings` (the FoxPro view)","in":"query","name":"legacy_validation","required":false,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{}}},"required":true},"responses":{"201":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"customer created"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden"},"422":{"description":"invalid request"}},"security":[{"bearer":[]}],"tags":["Customers"]}},"/customers/by_public_id/{public_id}":{"get":{"operationId":"customers_show_by_public_id","parameters":[{"description":"The ULID the client made for the record","in":"path","name":"public_id","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the customer, as GET /customers/{id}"},"401":{"description":"unauthenticated"},"404":{"description":"no customer you can see has this public id"}},"security":[{"bearer":[]}],"tags":["Customers"]}},"/customers/due_for":{"get":{"operationId":"customers_due_for","parameters":[{"description":"service, tires, inspection or reminder (every kind)","in":"query","name":"kind","required":false,"schema":{"type":"string"}},{"description":"due on or before today + N days (default 30)","in":"query","name":"within_days","required":false,"schema":{"format":"int64","type":"integer"}},{"description":"leave out rows due more than N days ago (default 365)","in":"query","name":"overdue_days","required":false,"schema":{"format":"int64","type":"integer"}},{"description":"also due within this many km of the due km (default 1000)","in":"query","name":"km_window","required":false,"schema":{"format":"int64","type":"integer"}},{"description":"the location of the vehicle's last posted order","in":"query","name":"location_id","required":false,"schema":{"format":"int64","type":"integer"}},{"description":"at most 100 (default 50)","in":"query","name":"limit","required":false,"schema":{"format":"int64","type":"integer"}},{"description":"rows to skip","in":"query","name":"offset","required":false,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"{data: [due rows], total, next_offset}"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized"},"422":{"description":"a parameter out of range"}},"security":[{"bearer":[]}],"tags":["Customers"]}},"/customers/number_range":{"get":{"operationId":"customers_number_range","responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the smallest and largest customer number on file (`first`, `last`; null when no customer has a number), in byte order"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs customers.read)"}},"security":[{"bearer":[]}],"tags":["Customers"]}},"/customers/{id}":{"delete":{"operationId":"customers_delete","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"204":{"description":"customer trashed"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden"},"404":{"description":"not found"}},"security":[{"bearer":[]}],"tags":["Customers"]},"get":{"operationId":"customers_show","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"customer"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden"},"404":{"description":"not found"}},"security":[{"bearer":[]}],"tags":["Customers"]},"patch":{"operationId":"customers_update","parameters":[{"description":"ETag from the last read (plan 105)","in":"header","name":"If-Match","required":false,"schema":{"type":["string","null"]}},{"description":"`1`: only the checks of before plan 1309, no `warnings` (the FoxPro view)","in":"query","name":"legacy_validation","required":false,"schema":{"type":"string"}},{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"customer updated"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden"},"404":{"description":"not found"},"412":{"description":"record changed since If-Match; body.current is the record now"},"422":{"description":"invalid request"}},"security":[{"bearer":[]}],"tags":["Customers"]}},"/customers/{id}/adjustments":{"post":{"operationId":"customers_adjustments_create","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"properties":{"adjusted_on":{"default":null,"description":"YYYY-MM-DD; defaults to the shop's local today; inside the posting window","type":["string","null"]},"amount_cents":{"default":0,"description":"Positive cents","format":"int64","type":"integer"},"kind":{"default":"","description":"\"debit\" raises the balance (refund cheque paid out, NSF, correction up);\n\"credit\" lowers it (write-off, correction down)","type":"string"},"reason":{"default":null,"description":"Why (required; printed on the Credit Applied Journal)","type":["string","null"]},"reference":{"default":null,"description":"Cheque number or other reference","type":["string","null"]}},"required":[],"type":"object"}}},"required":false},"responses":{"201":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"account adjustment stored (one A/R payment row, ADJ<n>)"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs payments.void)"},"404":{"description":"customer not found"},"422":{"description":"invalid adjustment"}},"security":[{"bearer":[]}],"tags":["Customers"]}},"/customers/{id}/adjustments/preview":{"post":{"operationId":"customers_adjustments_preview","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccountAdjustmentBody"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the balance before and after, and field errors; writes nothing"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs payments.void)"},"404":{"description":"customer not found"}},"security":[{"bearer":[]}],"tags":["Customers"]}},"/customers/{id}/appointments":{"get":{"operationId":"customers_appointments_index","parameters":[{"description":"customer id","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}},{"description":"only this plate","in":"query","name":"license_plate","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"items":{"type":"object"},"type":"array"}}},"description":"the customer's appointments by plate, code, id"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs customers.read)"},"404":{"description":"customer not found"}},"security":[{"bearer":[]}],"tags":["Appointments"]},"post":{"operationId":"customers_appointments_create","parameters":[{"description":"customer id","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}},{"description":"replays the first create with this key","in":"header","name":"Idempotency-Key","required":false,"schema":{"type":["string","null"]}}],"requestBody":{"content":{"application/json":{"schema":{"properties":{"code":{"default":null,"description":"An appointment code on file","type":["string","null"]},"due_km":{"default":null,"description":"Kilometre mark, 0 to 99999999","format":"int64","type":["integer","null"]},"due_on":{"default":null,"description":"YYYY-MM-DD, or \"\" for blank","type":["string","null"]},"id":{"default":null,"description":"The appointment (update, delete)","format":"int64","type":["integer","null"]},"license_plate":{"default":null,"description":"The vehicle's plate, at most 7 characters; stored upper case","type":["string","null"]},"make":{"default":null,"description":"At most 10 characters","type":["string","null"]},"model":{"default":null,"description":"At most 15 characters","type":["string","null"]},"year":{"default":null,"description":"At most 4 characters","type":["string","null"]}},"type":"object"}}},"required":false},"responses":{"201":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the appointment"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs customers.write)"},"404":{"description":"customer not found"},"422":{"description":"validation_failed or idempotency_key_reused"}},"security":[{"bearer":[]}],"tags":["Appointments"]}},"/customers/{id}/ar_cheques":{"get":{"operationId":"customers_ar_cheques","parameters":[{"description":"cheque / transaction number (case-insensitive)","in":"query","name":"reference","required":false,"schema":{"type":"string"}},{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"items":{"type":"object"},"type":"array"}}},"description":"payment rows with that reference and their item balances"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs customers.read)"},"404":{"description":"not found"}},"security":[{"bearer":[]}],"tags":["Customers"]}},"/customers/{id}/ar_items":{"get":{"operationId":"customers_ar_items","parameters":[{"description":"`open` (default, oldest first) or `closed` (newest first)","in":"query","name":"status","required":false,"schema":{"type":"string"}},{"description":"only that invoice","in":"query","name":"invoice_number","required":false,"schema":{"format":"int64","type":"integer"}},{"description":"page, 1-based","in":"query","name":"page","required":false,"schema":{"format":"int64","type":"integer"}},{"description":"items per page, 1-100 (default 100)","in":"query","name":"per_page","required":false,"schema":{"format":"int64","type":"integer"}},{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"items":{"type":"object"},"type":"array"}}},"description":"A/R items with their rows"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs customers.read)"},"404":{"description":"not found"}},"security":[{"bearer":[]}],"tags":["Customers"]}},"/customers/{id}/ar_rows":{"get":{"operationId":"customers_ar_rows","parameters":[{"description":"`open` (default) or `history`","in":"query","name":"status","required":false,"schema":{"type":"string"}},{"description":"YYYY-MM-DD: whole items dated after it are left out (`hidden_by_date`)","in":"query","name":"as_of","required":false,"schema":{"type":"string"}},{"description":"item number to find; all digits are right-aligned to 8 (`start_index`, `not_found`)","in":"query","name":"from_invoice","required":false,"schema":{"type":"string"}},{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the customer's ledger as flat rows in FoxPro's item-number order (FoxPro ARCASHE, ARCRED, ARINQ lists)"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs customers.read)"},"404":{"description":"not found"},"422":{"description":"invalid status or as_of"}},"security":[{"bearer":[]}],"tags":["Customers"]}},"/customers/{id}/ar_summary":{"get":{"operationId":"customers_ar_summary","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"A/R header and aging as of the shop's local today (FoxPro ARINQ); `shop_credit_cents`: the customer's available shop credit"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs customers.read)"},"404":{"description":"not found"}},"security":[{"bearer":[]}],"tags":["Customers"]}},"/customers/{id}/contact_options":{"get":{"operationId":"customer_contact_options","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}},{"description":"The work order the message is about: the order's driver's phone and e-mail join the options.","in":"query","name":"work_order_id","required":false,"schema":{"format":"int64","type":["integer","null"]}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"`{customer_id, options, default}`: every way to reach the customer, with the server's rules for which are usable"},"403":{"description":"needs customers.read"},"404":{"description":"no such customer"}},"security":[{"bearer":[]}],"tags":["Messages"]}},"/customers/{id}/credit_applications":{"post":{"operationId":"customers_credit_applications_create","parameters":[{"description":"replays the original application","in":"header","name":"Idempotency-Key","required":false,"schema":{"type":["string","null"]}},{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"properties":{"allow_future_date":{"description":"`true`: a date after the shop's today is accepted when it is inside the posting window (FoxPro's rule)","type":"boolean"},"applied_on":{"default":null,"description":"YYYY-MM-DD; defaults to the shop's local today","type":["string","null"]},"legs":{"default":[],"description":"The legs; they must sum to zero","items":{"properties":{"amount_cents":{"description":"FoxPro PAYMENT, cents: + on an invoice, − on a credit or unapplied money","format":"int64","type":"integer"},"payment_id":{"default":null,"description":"Unapplied payment (money with no work order) the leg consumes","format":"int64","type":["integer","null"]},"work_order_id":{"default":null,"description":"Posted work order (invoice or credit) the leg applies to","format":"int64","type":["integer","null"]}},"required":["amount_cents"],"type":"object"},"type":"array"}},"required":[],"type":"object"}}},"required":false},"responses":{"201":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"credit application stored (grouped adjustment payments)"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs payments.take)"},"404":{"description":"customer not found"},"422":{"description":"invalid or unbalanced application"}},"security":[{"bearer":[]}],"tags":["Customers"]}},"/customers/{id}/credit_applications/preview":{"post":{"operationId":"customers_credit_applications_preview","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreditApplicationBody"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the application as it would be stored (application_number null) and field errors; writes nothing"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs payments.take)"},"404":{"description":"customer not found"}},"security":[{"bearer":[]}],"tags":["Customers"]}},"/customers/{id}/credit_applications/{application_number}/void":{"post":{"operationId":"customers_credit_applications_void","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}},{"in":"path","name":"application_number","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"properties":{"reason":{"default":null,"description":"Why the application is voided (e.g. applied to the wrong invoice)","type":["string","null"]}},"required":[],"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the application with every leg voided (voided_at, void_reason)"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs credit_applications.void)"},"404":{"description":"customer or application not found"},"409":{"description":"already voided, or a later application used the same unapplied money"},"422":{"description":"the application is dated outside the posting window"}},"security":[{"bearer":[]}],"tags":["Customers"]}},"/customers/{id}/drivers":{"get":{"operationId":"customers_drivers","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"items":{"type":"object"},"type":"array"}}},"description":"the customer's live drivers, by name"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs customers.read)"},"404":{"description":"customer not found"}},"security":[{"bearer":[]}],"tags":["Customers"]},"post":{"operationId":"customers_drivers_create","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{}}},"required":true},"responses":{"201":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"driver created (full_name required)"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs customers.write)"},"404":{"description":"customer not found"},"422":{"description":"invalid request"}},"security":[{"bearer":[]}],"tags":["Customers"]}},"/customers/{id}/duplicates":{"get":{"operationId":"customers_duplicates","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"possible duplicates: {data: [{id, name, reasons}], total}"},"401":{"description":"unauthenticated"},"403":{"description":"needs customers.read"},"404":{"description":"customer not found"}},"security":[{"bearer":[]}],"tags":["Customers"]}},"/customers/{id}/emails":{"get":{"operationId":"customers_emails","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"items":{"type":"object"},"type":"array"}}},"description":"the customer's e-mail addresses, primary first"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs customers.read)"},"404":{"description":"customer not found"}},"security":[{"bearer":[]}],"tags":["Customers"]},"post":{"operationId":"customers_emails_create","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{}}},"required":true},"responses":{"201":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"e-mail address added (address required)"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs customers.write)"},"404":{"description":"customer not found"},"422":{"description":"invalid request"}},"security":[{"bearer":[]}],"tags":["Customers"]}},"/customers/{id}/history":{"get":{"operationId":"customers_history","parameters":[{"description":"`newest` (default) or `oldest` (the FoxPro order)","in":"query","name":"order","required":false,"schema":{"type":"string"}},{"description":"page, 1-based","in":"query","name":"page","required":false,"schema":{"format":"int64","type":"integer"}},{"description":"rows per page, 1-100 (default 50)","in":"query","name":"per_page","required":false,"schema":{"format":"int64","type":"integer"}},{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"items":{"type":"object"},"type":"array"}}},"description":"the customer's posted invoices"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden"},"404":{"description":"not found"}},"security":[{"bearer":[]}],"tags":["Customers"]}},"/customers/{id}/manual_invoices":{"post":{"operationId":"customers_manual_invoices_create","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"properties":{"amount_cents":{"default":0,"description":"Gross cents as typed, tax included; the code forces the sign","format":"int64","type":"integer"},"code":{"default":"","description":"\"I\" (invoice) or \"C\" (credit)","type":"string"},"customer_name":{"default":null,"description":"Name typed for a `...999` customer, at most 40 characters","type":["string","null"]},"date":{"default":null,"description":"YYYY-MM-DD; none = the location's today","type":["string","null"]},"gst":{"default":null,"description":"Take GST out of the amount; none = true","type":["boolean","null"]},"invoice_number":{"default":null,"description":"Digits only; none = the next invoice number","format":"int64","type":["integer","null"]},"legs":{"default":[],"description":"The sales legs, in entry order","items":{"properties":{"account":{"description":"G/L account number","type":"string"},"amount_cents":{"description":"Signed cents, FoxPro's sign (a sales leg of an invoice is negative)","format":"int64","type":"integer"}},"required":["account","amount_cents"],"type":"object"},"type":"array"},"pst":{"default":null,"description":"Take PST out of the amount; none = the location's `fox.ar_options.sj_pst`","type":["boolean","null"]},"reference":{"default":null,"description":"ORDER #, at most 8 characters, upper-cased","type":["string","null"]},"salesman":{"default":null,"description":"Salesman, at most 3 characters, upper-cased","type":["string","null"]},"terms_code":{"default":null,"description":"Charge terms code; none = the customer's","type":["string","null"]}},"required":[],"type":"object"}}},"required":false},"responses":{"201":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"manual invoice or credit stored as a posted work order"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs work_orders.post)"},"404":{"description":"customer not found"},"409":{"description":"invoice number in use"},"422":{"description":"invalid entry"}},"security":[{"bearer":[]}],"tags":["Customers"]}},"/customers/{id}/manual_invoices/defaults":{"get":{"operationId":"customers_manual_invoices_defaults","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the next invoice number, date, terms, accounts"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs work_orders.post)"},"404":{"description":"customer not found"},"409":{"description":"conflict"},"422":{"description":"invalid"}},"security":[{"bearer":[]}],"tags":["Customers"]}},"/customers/{id}/manual_invoices/preview":{"post":{"operationId":"customers_manual_invoices_preview","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ManualInvoiceBody"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the computed entry and field errors; writes nothing"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs work_orders.post)"},"404":{"description":"customer not found"},"409":{"description":"conflict"},"422":{"description":"invalid"}},"security":[{"bearer":[]}],"tags":["Customers"]}},"/customers/{id}/merge":{"post":{"operationId":"customers_merge","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"properties":{"into_id":{"description":"The record to keep","format":"int64","type":"integer"}},"required":["into_id"],"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"{from_id, into_id, moved, left}: rows moved and rows a unique index kept on the trashed customer"},"401":{"description":"unauthenticated"},"403":{"description":"needs records.merge and customers.write"},"422":{"description":"same customer, unknown or trashed customer"}},"security":[{"bearer":[]}],"tags":["Customers"]}},"/customers/{id}/messages":{"get":{"operationId":"customer_messages","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}},{"in":"query","name":"before_id","required":false,"schema":{"format":"int64","type":["integer","null"]}},{"in":"query","name":"limit","required":false,"schema":{"format":"int64","type":["integer","null"]}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the customer's conversation, oldest message first"},"404":{"description":"no such customer"}},"security":[{"bearer":[]}],"tags":["Messages"]},"post":{"operationId":"customer_messages_send","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"description":"`messages.send`'s params: the draft's, plus a client-made id.","properties":{"args":{"default":[],"description":"The words the other arguments stand for, in the customer's language, parallel to\n`values`.","items":{"description":"One fill-in of a template. The server knows the record values; the caller's `values` put\nthe words in the customer's language.","enum":["customer","vehicle","work_order","amount","reply_text","when","recommended_work"],"type":"string"},"type":"array"},"as_of":{"description":"The statement's e-mail (plan 4002): the date the statement is built on, `YYYY-MM-DD`.\nLeft out: the shop's local today. Used only with the `statement` template.","type":["string","null"]},"ask_again":{"default":null,"description":"With an estimate share: the jobs already answered go back to waiting, so the customer\nanswers the estimate again. Off by default.","type":["boolean","null"]},"attachment_ids":{"description":"The files sent with the message (plan 3274): attachments already staged on one of the\ncustomer's work orders and uploaded. E-mail only; the delivery reads their bytes.","items":{"type":"string"},"type":"array"},"body":{"default":null,"description":"The user's words, for `custom` (at most 1600 characters).","type":["string","null"]},"channel":{"description":"`sms` (Wenmar texts it), `email`, or `phone_sms` (the user sends it from their own phone).","type":"string"},"driver_id":{"default":null,"description":"Plan 2642: send to the driver directly (the New Message dialog): the driver's customer\nis the customer. With a work order, it must be the order's driver.","format":"int64","type":["integer","null"]},"option":{"default":null,"description":"A contact option id from `customers.contact_options` (`phone:<id>`, `email:<id>`,\n`driver_phone:<id>`, `driver_email:<id>` or `phone_sms`): it names the address the\nmessage goes to. `portal` is not a send channel.","type":["string","null"]},"public_id":{"default":null,"description":"A client-made ULID; a second send with the same one answers the first message.","type":["string","null"]},"purpose":{"default":null,"description":"`transactional` (the default: the customer's car, estimate, invoice or booking) or\n`marketing` (reminders and offers; needs the customer's consent).","type":["string","null"]},"share":{"default":null,"description":"A share option id from `customers.share_options` (`estimate:<id>`, `inspection:<id>`,\n`statement:<id>`, `finding:<concern>` or `sign_in`): the send makes the share link and\nputs it in the message. A statement goes by e-mail. A finding share (plan 3127) is the\norder's estimate approval link, at the finding's job.","type":["string","null"]},"subject":{"default":null,"description":"The e-mail subject, for `custom` e-mails.","type":["string","null"]},"tech_name":{"description":"A finding share (plan 3127): the finder's name, in the words. Filled by the server\n(the concern's author); the words show no name when it is left out.","type":["string","null"]},"template":{"default":null,"description":"`custom` (the user's words in `body`), `car_ready`, `estimate_ready`, `invoice_ready`,\n`inspection_ready`, `payment_received`, `appointment_booked`, `declined_work,\n`reply_to_text`, `finding_ready` (a finding with its video, plan 3127; it shares\n`finding:<concern>`), `statement` (the customer's A/R statement as a PDF, plan 4002;\ne-mail only, not about a work order).","type":["string","null"]},"to":{"default":null,"description":"`customer` or `driver`. Left out: a message about a work order that names a driver goes\nto the driver when they can take it (a live, not opted-out number or address), else to\nthe customer. Marketing always goes to the customer. `option` wins over this.","type":["string","null"]},"values":{"default":[],"description":"The words for `args`, in order.","items":{"type":"string"},"type":"array"},"with_price":{"description":"A finding share (plan 3127): the link shows the price. On by default; used only with a\n`finding` share.","type":["boolean","null"]},"with_sound":{"description":"A finding share (plan 3127): the link offers the video's sound. On by default (the\nserver sends a muted copy when it is off); used only with a `finding` share.","type":["boolean","null"]},"with_video":{"description":"A finding share (plan 3127): the words offer the video. On by default; used only with\na `finding` share.","type":["boolean","null"]},"work_order_id":{"default":null,"description":"The work order the message is about; every template but `custom` is about a work order.","format":"int64","type":["integer","null"]}},"required":["channel"],"type":"object"}}},"required":false},"responses":{"201":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"stored: `{message, compose}`; compose only for phone_sms"},"403":{"description":"needs messages.send"},"409":{"description":"not_posted: an invoice e-mail for an order with no invoice yet"},"422":{"description":"invalid, no_contact, recipient_opted_out, no_consent"}},"security":[{"bearer":[]}],"tags":["Messages"]}},"/customers/{id}/messages/preview":{"post":{"operationId":"customer_messages_preview","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"description":"The words a message would use, before sending. `messages.draft` and `messages.send` share\nthese: `send` adds a client-made `public_id`.","properties":{"args":{"default":[],"description":"The words the other arguments stand for, in the customer's language, parallel to\n`values`.","items":{"description":"One fill-in of a template. The server knows the record values; the caller's `values` put\nthe words in the customer's language.","enum":["customer","vehicle","work_order","amount","reply_text","when","recommended_work"],"type":"string"},"type":"array"},"as_of":{"description":"The statement's e-mail (plan 4002): the date the statement is built on, `YYYY-MM-DD`.\nLeft out: the shop's local today. Used only with the `statement` template.","type":["string","null"]},"ask_again":{"default":null,"description":"With an estimate share: the jobs already answered go back to waiting, so the customer\nanswers the estimate again. Off by default.","type":["boolean","null"]},"attachment_ids":{"description":"The files sent with the message (plan 3274): attachments already staged on one of the\ncustomer's work orders and uploaded. E-mail only; the delivery reads their bytes.","items":{"type":"string"},"type":"array"},"body":{"default":null,"description":"The user's words, for `custom` (at most 1600 characters).","type":["string","null"]},"channel":{"description":"`sms` (Wenmar texts it), `email`, or `phone_sms` (the user sends it from their own phone).","type":"string"},"driver_id":{"default":null,"description":"Plan 2642: send to the driver directly (the New Message dialog): the driver's customer\nis the customer. With a work order, it must be the order's driver.","format":"int64","type":["integer","null"]},"option":{"default":null,"description":"A contact option id from `customers.contact_options` (`phone:<id>`, `email:<id>`,\n`driver_phone:<id>`, `driver_email:<id>` or `phone_sms`): it names the address the\nmessage goes to. `portal` is not a send channel.","type":["string","null"]},"purpose":{"default":null,"description":"`transactional` (the default: the customer's car, estimate, invoice or booking) or\n`marketing` (reminders and offers; needs the customer's consent).","type":["string","null"]},"share":{"default":null,"description":"A share option id from `customers.share_options` (`estimate:<id>`, `inspection:<id>`,\n`statement:<id>`, `finding:<concern>` or `sign_in`): the send makes the share link and\nputs it in the message. A statement goes by e-mail. A finding share (plan 3127) is the\norder's estimate approval link, at the finding's job.","type":["string","null"]},"subject":{"default":null,"description":"The e-mail subject, for `custom` e-mails.","type":["string","null"]},"tech_name":{"description":"A finding share (plan 3127): the finder's name, in the words. Filled by the server\n(the concern's author); the words show no name when it is left out.","type":["string","null"]},"template":{"default":null,"description":"`custom` (the user's words in `body`), `car_ready`, `estimate_ready`, `invoice_ready`,\n`inspection_ready`, `payment_received`, `appointment_booked`, `declined_work,\n`reply_to_text`, `finding_ready` (a finding with its video, plan 3127; it shares\n`finding:<concern>`), `statement` (the customer's A/R statement as a PDF, plan 4002;\ne-mail only, not about a work order).","type":["string","null"]},"to":{"default":null,"description":"`customer` or `driver`. Left out: a message about a work order that names a driver goes\nto the driver when they can take it (a live, not opted-out number or address), else to\nthe customer. Marketing always goes to the customer. `option` wins over this.","type":["string","null"]},"values":{"default":[],"description":"The words for `args`, in order.","items":{"type":"string"},"type":"array"},"with_price":{"description":"A finding share (plan 3127): the link shows the price. On by default; used only with a\n`finding` share.","type":["boolean","null"]},"with_sound":{"description":"A finding share (plan 3127): the link offers the video's sound. On by default (the\nserver sends a muted copy when it is off); used only with a `finding` share.","type":["boolean","null"]},"with_video":{"description":"A finding share (plan 3127): the words offer the video. On by default; used only with\na `finding` share.","type":["boolean","null"]},"work_order_id":{"default":null,"description":"The work order the message is about; every template but `custom` is about a work order.","format":"int64","type":["integer","null"]}},"required":["channel"],"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the rendered message; nothing stored"},"422":{"description":"invalid or not sendable"}},"security":[{"bearer":[]}],"tags":["Messages"]}},"/customers/{id}/no_reminders":{"put":{"operationId":"customers_no_reminders_set","parameters":[{"description":"customer id","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"properties":{"no_reminders":{"description":"true = this customer gets no automatic reminders; false = they may again","type":"boolean"}},"required":["no_reminders"],"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"`{ customer_id, no_reminders }`"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs customers.write)"},"404":{"description":"no such customer"}},"security":[{"bearer":[]}],"tags":["Automatic reminders"]}},"/customers/{id}/notes":{"get":{"operationId":"customers_notes","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"items":{"type":"object"},"type":"array"}}},"description":"the customer's notes and alerts, pinned first, then newest first"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs customers.read)"},"404":{"description":"customer not found"}},"security":[{"bearer":[]}],"tags":["Customers"]},"post":{"operationId":"customers_notes_create","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{}}},"required":true},"responses":{"201":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"note added (body required; kind is note or alert)"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs customers.write)"},"404":{"description":"customer not found"},"422":{"description":"invalid request"}},"security":[{"bearer":[]}],"tags":["Customers"]}},"/customers/{id}/open_estimates":{"get":{"operationId":"customers_open_estimates","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"items":{"type":"object"},"type":"array"}}},"description":"the customer's estimates (stage 0, not cancelled, not posted) in number order, within the user's location; each row is a work order plus `vehicle` {id, license_plate, year, make, model, id_number} or null (FoxPro estimate offer)"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden"},"404":{"description":"customer not found"}},"security":[{"bearer":[]}],"tags":["Customers"]}},"/customers/{id}/open_items":{"get":{"operationId":"customers_open_items","parameters":[{"description":"YYYY-MM-DD: items dated after it are left out","in":"query","name":"as_of","required":false,"schema":{"type":"string"}},{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"items":{"type":"object"},"type":"array"}}},"description":"open invoices, credits and unapplied receipts, oldest first"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden"},"404":{"description":"customer not found"},"422":{"description":"invalid as_of"}},"security":[{"bearer":[]}],"tags":["Customers"]}},"/customers/{id}/open_orders":{"get":{"operationId":"customers_open_orders","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"items":{"type":"object"},"type":"array"}}},"description":"the customer's open orders (in progress or completed, not posted, not cancelled) in order-number order, within the user's location; each row is a work order plus `vehicle` {id, license_plate, year, make, model} or null (FoxPro order list)"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden"},"404":{"description":"customer not found"}},"security":[{"bearer":[]}],"tags":["Customers"]}},"/customers/{id}/payments":{"get":{"operationId":"customer_payments_list","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"items":{"type":"object"},"type":"array"}}},"description":"the customer's payments, applied and unapplied"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized"}},"security":[{"bearer":[]}],"tags":["Payments"]}},"/customers/{id}/phones":{"get":{"operationId":"customers_phones","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"items":{"type":"object"},"type":"array"}}},"description":"the customer's phones, primary first"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs customers.read)"},"404":{"description":"customer not found"}},"security":[{"bearer":[]}],"tags":["Customers"]},"post":{"operationId":"customers_phones_create","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{}}},"required":true},"responses":{"201":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"phone added (number required)"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs customers.write)"},"404":{"description":"customer not found"},"422":{"description":"invalid request"}},"security":[{"bearer":[]}],"tags":["Customers"]}},"/customers/{id}/portal_qr":{"post":{"operationId":"customers_portal_qr","parameters":[{"description":"the customer the code signs in","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the 10-minute sign-in link: url and expires_at"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs customers.write)"},"404":{"description":"customer not found"}},"security":[{"bearer":[]}],"summary":"The advisor's screen QR (plan 1667, carryover C2): `POST\n/customers/{id}/portal_qr` answers `{url, expires_at}`, a sign-in link that\nlives 10 minutes. The desk draws it as a QR; the customer scans it and is\nsigned in.","tags":["Customers"]}},"/customers/{id}/receipts":{"post":{"operationId":"customers_receipts_create","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"properties":{"allow_future_date":{"default":false,"description":"Accept a date after today when it is inside the posting window","type":"boolean"},"amount_cents":{"description":"Money received, cents (> 0)","format":"int64","type":"integer"},"applications":{"default":[],"items":{"properties":{"discount_cents":{"default":0,"description":"Discount applied, cents (>= 0); needs ar.discounts_enabled","format":"int64","type":"integer"},"payment_cents":{"default":0,"description":"Money applied, cents (>= 0)","format":"int64","type":"integer"},"payment_id":{"default":null,"description":"Unapplied money to consume (plan 454); `payment_cents` is then negative","format":"int64","type":["integer","null"]},"work_order_id":{"default":0,"description":"Posted work order (invoice or credit) to apply to. 0 = not given\n(then `payment_id` names the item).","format":"int64","type":"integer"}},"type":"object"},"type":"array"},"card_last4":{"default":null,"description":"The card's last 4 digits (debit, visa, mastercard, amex, other). Never the full number","type":["string","null"]},"method":{"default":"","description":"cash | cheque | debit | visa | mastercard | amex | etransfer | other","type":"string"},"payer_name":{"default":null,"description":"The name typed for a miscellaneous (`…999`) customer's receipt, at most 40\ncharacters (FoxPro `ARCASHH.C_NAME`). Refused for any other customer.","type":["string","null"]},"payment_type":{"default":null,"description":"FoxPro payment-type letter (location setting fox.payment_types); sets `method`","type":["string","null"]},"received_on":{"default":null,"description":"YYYY-MM-DD; defaults to today (UTC)","type":["string","null"]},"reference":{"default":null,"description":"Cheque/transaction number","type":["string","null"]},"remainder":{"default":null,"description":"\"refuse\": refuse a receipt whose balance to distribute is not 0.\nAbsent or \"unapplied\": what is left becomes unapplied money","type":["string","null"]},"unapplied":{"default":[],"description":"Money left on account, each with a reference","items":{"description":"Money of a receipt left on account, with the reference the operator\ntypes (FoxPro `[U]napplied`, plan 454).","properties":{"amount_cents":{"description":"Money left on account, cents (> 0)","format":"int64","type":"integer"},"reference":{"default":"","description":"Order number or reference, at most 8 characters","type":"string"}},"required":["amount_cents"],"type":"object"},"type":"array"}},"required":["amount_cents"],"type":"object"}}},"required":false},"responses":{"201":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"receipt recorded (grouped payments)"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden"},"404":{"description":"customer not found"},"409":{"description":"duplicate reference"},"422":{"description":"invalid receipt"}},"security":[{"bearer":[]}],"tags":["Customers"]}},"/customers/{id}/receipts/preview":{"post":{"operationId":"customers_receipts_preview","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReceiptBody"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"result: balance to distribute, each item's balance after the receipt, auto_apply, the CHECKDATE code of the date, the duplicate; errors: one message per field. Writes nothing"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden"},"404":{"description":"customer not found"}},"security":[{"bearer":[]}],"tags":["Customers"]}},"/customers/{id}/restore":{"post":{"operationId":"customers_restore","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"customer restored"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden"},"404":{"description":"not found"}},"security":[{"bearer":[]}],"tags":["Customers"]}},"/customers/{id}/review":{"post":{"operationId":"customers_review","parameters":[{"description":"the customer under review","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object"}}},"required":true},"responses":{"200":{"description":"the review applied: kept, merged, or deleted"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs customers.write)"},"404":{"description":"customer not found"},"409":{"description":"the customer is trashed, or has open A/R items (delete)"},"422":{"description":"the action's words are missing (merge without into_customer_id)"}},"security":[{"bearer":[]}],"summary":"The advisor's review of a counter sign-up (plan 1666, carryover C2b):\n`POST /customers/{id}/review` with `{action: keep|merge|delete,\ninto_customer_id?}`. Reviewing is not a gate: work never waits on it.","tags":["Customers"]}},"/customers/{id}/share_options":{"get":{"operationId":"customer_share_options","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"`{customer_id, options}`: what to share (open orders' estimate and inspection links, unpaid statements, the portal sign-in link)"},"403":{"description":"needs customers.read"},"404":{"description":"no such customer"}},"security":[{"bearer":[]}],"tags":["Messages"]}},"/customers/{id}/ship_tos":{"get":{"operationId":"customers_ship_tos","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"items":{"type":"object"},"type":"array"}}},"description":"the customer's ship-to addresses (ARSHIPTO), code order"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs customers.read)"},"404":{"description":"customer not found"}},"security":[{"bearer":[]}],"tags":["Customers"]},"post":{"operationId":"customers_ship_tos_create","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{}}},"required":true},"responses":{"201":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"ship-to created; with no line fields it is filled from the billing address"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs customers.write)"},"404":{"description":"customer not found"},"422":{"description":"invalid request"}},"security":[{"bearer":[]}],"tags":["Customers"]}},"/customers/{id}/statement/send":{"post":{"operationId":"customer_statement_send","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"description":"`messages.send`'s params: the draft's, plus a client-made id.","properties":{"args":{"default":[],"description":"The words the other arguments stand for, in the customer's language, parallel to\n`values`.","items":{"description":"One fill-in of a template. The server knows the record values; the caller's `values` put\nthe words in the customer's language.","enum":["customer","vehicle","work_order","amount","reply_text","when","recommended_work"],"type":"string"},"type":"array"},"as_of":{"description":"The statement's e-mail (plan 4002): the date the statement is built on, `YYYY-MM-DD`.\nLeft out: the shop's local today. Used only with the `statement` template.","type":["string","null"]},"ask_again":{"default":null,"description":"With an estimate share: the jobs already answered go back to waiting, so the customer\nanswers the estimate again. Off by default.","type":["boolean","null"]},"attachment_ids":{"description":"The files sent with the message (plan 3274): attachments already staged on one of the\ncustomer's work orders and uploaded. E-mail only; the delivery reads their bytes.","items":{"type":"string"},"type":"array"},"body":{"default":null,"description":"The user's words, for `custom` (at most 1600 characters).","type":["string","null"]},"channel":{"description":"`sms` (Wenmar texts it), `email`, or `phone_sms` (the user sends it from their own phone).","type":"string"},"driver_id":{"default":null,"description":"Plan 2642: send to the driver directly (the New Message dialog): the driver's customer\nis the customer. With a work order, it must be the order's driver.","format":"int64","type":["integer","null"]},"option":{"default":null,"description":"A contact option id from `customers.contact_options` (`phone:<id>`, `email:<id>`,\n`driver_phone:<id>`, `driver_email:<id>` or `phone_sms`): it names the address the\nmessage goes to. `portal` is not a send channel.","type":["string","null"]},"public_id":{"default":null,"description":"A client-made ULID; a second send with the same one answers the first message.","type":["string","null"]},"purpose":{"default":null,"description":"`transactional` (the default: the customer's car, estimate, invoice or booking) or\n`marketing` (reminders and offers; needs the customer's consent).","type":["string","null"]},"share":{"default":null,"description":"A share option id from `customers.share_options` (`estimate:<id>`, `inspection:<id>`,\n`statement:<id>`, `finding:<concern>` or `sign_in`): the send makes the share link and\nputs it in the message. A statement goes by e-mail. A finding share (plan 3127) is the\norder's estimate approval link, at the finding's job.","type":["string","null"]},"subject":{"default":null,"description":"The e-mail subject, for `custom` e-mails.","type":["string","null"]},"tech_name":{"description":"A finding share (plan 3127): the finder's name, in the words. Filled by the server\n(the concern's author); the words show no name when it is left out.","type":["string","null"]},"template":{"default":null,"description":"`custom` (the user's words in `body`), `car_ready`, `estimate_ready`, `invoice_ready`,\n`inspection_ready`, `payment_received`, `appointment_booked`, `declined_work,\n`reply_to_text`, `finding_ready` (a finding with its video, plan 3127; it shares\n`finding:<concern>`), `statement` (the customer's A/R statement as a PDF, plan 4002;\ne-mail only, not about a work order).","type":["string","null"]},"to":{"default":null,"description":"`customer` or `driver`. Left out: a message about a work order that names a driver goes\nto the driver when they can take it (a live, not opted-out number or address), else to\nthe customer. Marketing always goes to the customer. `option` wins over this.","type":["string","null"]},"values":{"default":[],"description":"The words for `args`, in order.","items":{"type":"string"},"type":"array"},"with_price":{"description":"A finding share (plan 3127): the link shows the price. On by default; used only with a\n`finding` share.","type":["boolean","null"]},"with_sound":{"description":"A finding share (plan 3127): the link offers the video's sound. On by default (the\nserver sends a muted copy when it is off); used only with a `finding` share.","type":["boolean","null"]},"with_video":{"description":"A finding share (plan 3127): the words offer the video. On by default; used only with\na `finding` share.","type":["boolean","null"]},"work_order_id":{"default":null,"description":"The work order the message is about; every template but `custom` is about a work order.","format":"int64","type":["integer","null"]}},"required":["channel"],"type":"object"}}},"required":false},"responses":{"201":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"stored: `{message, compose}`; the e-mail carries the statement PDF"},"403":{"description":"needs messages.send and reports.view"},"409":{"description":"no_statements: the customer has nothing owed on that day"},"422":{"description":"invalid, no_email, recipient_opted_out, no_consent"}},"security":[{"bearer":[]}],"summary":"`POST /customers/{id}/statement/send` (plan 4002): e-mail the customer their statement —\nthe customer's A/R statement as of `as_of` (the shop's local today when left out), the\nsame PDF `GET /statements?mode=individual` answers. A `messages.send` with the\n`statement` template: it finds or opens the customer's conversation and stores the\nmessage there. `Idempotency-Key` is required like every other send.","tags":["Messages"]}},"/customers/{id}/vehicles":{"get":{"operationId":"customers_vehicles","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"items":{"type":"object"},"type":"array"}}},"description":"the customer's vehicles"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden"}},"security":[{"bearer":[]}],"tags":["Customers"]}},"/customers/{id}/work_orders":{"get":{"operationId":"customers_work_orders","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"items":{"type":"object"},"type":"array"}}},"description":"the customer's work orders"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden"}},"security":[{"bearer":[]}],"tags":["Customers"]}},"/dashboard":{"get":{"operationId":"dashboard_show","parameters":[{"description":"week, month (default), quarter or year: that period to date","in":"query","name":"period","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"tiles {key, value, kind, previous, change_bp, better, complete, note} against the same days one period earlier, weekly_sales, as_of"},"401":{"description":"unauthenticated"},"403":{"description":"needs reports.view; analytics covers every location"},"422":{"description":"an unknown period"},"429":{"description":"analytics is busy for this shop; try again"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/devices":{"get":{"operationId":"devices_index","responses":{"200":{"content":{"application/json":{"schema":{"items":{"type":"object"},"type":"array"}}},"description":"the caller's devices"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden"}},"security":[{"bearer":[]}],"tags":["Devices"]},"post":{"operationId":"devices_create","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RegisterDeviceBody"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"device already registered"},"201":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"device registered"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden"},"422":{"description":"invalid request"}},"security":[{"bearer":[]}],"tags":["Devices"]}},"/devices/{id}":{"delete":{"operationId":"devices_destroy","parameters":[{"description":"device id","in":"path","name":"id","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"device removed"},"401":{"description":"unauthenticated"},"404":{"description":"not found"}},"security":[{"bearer":[]}],"tags":["Devices"]}},"/devices/{id}/test":{"post":{"operationId":"devices_test","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}}],"responses":{"202":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"test notification queued"},"401":{"description":"unauthenticated"},"404":{"description":"not your device"},"503":{"description":"job queue unavailable"}},"security":[{"bearer":[]}],"tags":["Devices"]}},"/documents/offline":{"get":{"operationId":"documents_offline","parameters":[{"description":"the oldest invoice date to keep, YYYY-MM-DD (the client sends 30 days back)","in":"query","name":"invoices_since","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"`{ documents: [...], job_cards: [...] }`: `documents` are the open orders (the job card), estimates, and invoices posted on or after `invoices_since` (newest first, at most 500), in the user's location scope; each row is `{ work_order_id, kind, number, location_id, customer_id, updated_at, data }`, with `data` the PDF route's `DocumentData`. `job_cards` are the blank job card of every location the user may see (plan 2778): `{ location_id, data }`, no customer, vehicle or lines"},"401":{"description":"unauthenticated"},"422":{"description":"invoices_since is missing or malformed"}},"security":[{"bearer":[]}],"tags":["Work Orders"]}},"/documents/preview":{"get":{"operationId":"documents_preview","parameters":[{"description":"the kind to preview: invoice","in":"query","name":"kind","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"the preview as a Letter-size PDF"},"401":{"description":"unauthenticated"},"403":{"description":"not_authorized: the user may not manage the location's settings"},"422":{"description":"unknown_kind: kind is missing or not invoice"}},"security":[{"bearer":[]}],"summary":"The Documents page's invoice preview (plan 3097): the location's most recent posted\ninvoice, or the built-in `ZZ` sample when it has none, rendered with the location's\ncurrent letterhead, notices, foot and line settings. Read access, but only for a settings\nmanager: the preview shows what the shop prints, and a read never writes.","tags":["Work Orders"]}},"/driver_emails/{id}":{"delete":{"operationId":"driver_emails_delete","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"204":{"description":"removed (kept with its opt-out, status trashed)"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs customers.write)"},"404":{"description":"not found"}},"security":[{"bearer":[]}],"tags":["Customers"]},"get":{"operationId":"driver_emails_show","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"e-mail address"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs customers.read)"},"404":{"description":"not found"}},"security":[{"bearer":[]}],"tags":["Customers"]},"patch":{"operationId":"driver_emails_update","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"e-mail address updated"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs customers.write)"},"404":{"description":"not found"},"422":{"description":"invalid request"}},"security":[{"bearer":[]}],"tags":["Customers"]}},"/driver_phones/{id}":{"delete":{"operationId":"driver_phones_delete","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"204":{"description":"removed (kept with its opt-out, status trashed)"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs customers.write)"},"404":{"description":"not found"}},"security":[{"bearer":[]}],"tags":["Customers"]},"get":{"operationId":"driver_phones_show","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"phone"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs customers.read)"},"404":{"description":"not found"}},"security":[{"bearer":[]}],"tags":["Customers"]},"patch":{"operationId":"driver_phones_update","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"phone updated"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs customers.write)"},"404":{"description":"not found"},"422":{"description":"invalid request"}},"security":[{"bearer":[]}],"tags":["Customers"]}},"/drivers":{"get":{"operationId":"drivers_index","parameters":[{"description":"driver name, phone, e-mail, or the customer's name, case-insensitive","in":"query","name":"q","required":false,"schema":{"type":"string"}},{"description":"page, 1-based","in":"query","name":"page","required":false,"schema":{"format":"int64","type":"integer"}},{"description":"rows per page, 1-100 (default 50)","in":"query","name":"per_page","required":false,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"items":{"type":"object"},"type":"array"}}},"description":"every customer's live drivers, newest visit first, with `customer_name`, `last_visit_on` and `usual_vehicle`"},"401":{"description":"unauthenticated"}},"security":[{"bearer":[]}],"tags":["Customers"]}},"/drivers/{id}":{"delete":{"operationId":"drivers_delete","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"204":{"description":"driver removed (soft); orders that name it keep it"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs customers.write)"},"404":{"description":"not found"}},"security":[{"bearer":[]}],"tags":["Customers"]},"get":{"operationId":"drivers_show","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"driver"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs customers.read)"},"404":{"description":"not found"}},"security":[{"bearer":[]}],"tags":["Customers"]},"patch":{"operationId":"drivers_update","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"driver updated"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs customers.write)"},"404":{"description":"not found or removed"},"422":{"description":"invalid request"}},"security":[{"bearer":[]}],"tags":["Customers"]}},"/drivers/{id}/emails":{"get":{"operationId":"drivers_emails","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"items":{"type":"object"},"type":"array"}}},"description":"the driver's e-mail addresses, primary first"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs customers.read)"},"404":{"description":"driver not found"}},"security":[{"bearer":[]}],"tags":["Customers"]},"post":{"operationId":"drivers_emails_create","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{}}},"required":true},"responses":{"201":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"e-mail address added (address required)"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs customers.write)"},"404":{"description":"driver not found"},"422":{"description":"invalid request"}},"security":[{"bearer":[]}],"tags":["Customers"]}},"/drivers/{id}/phones":{"get":{"operationId":"drivers_phones","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"items":{"type":"object"},"type":"array"}}},"description":"the driver's phones, primary first"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs customers.read)"},"404":{"description":"driver not found"}},"security":[{"bearer":[]}],"tags":["Customers"]},"post":{"operationId":"drivers_phones_create","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{}}},"required":true},"responses":{"201":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"phone added (number required)"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs customers.write)"},"404":{"description":"driver not found"},"422":{"description":"invalid request"}},"security":[{"bearer":[]}],"tags":["Customers"]}},"/employees":{"get":{"operationId":"employees_index","parameters":[{"description":"part of the name, or the number","in":"query","name":"q","required":false,"schema":{"type":"string"}},{"description":"one employee, by number (28 finds    28)","in":"query","name":"number","required":false,"schema":{"type":"string"}},{"description":"part of the surname; the list is then in surname order","in":"query","name":"last_name","required":false,"schema":{"type":"string"}},{"description":"digits of the phone number","in":"query","name":"phone","required":false,"schema":{"type":"string"}},{"description":"true: active employees only","in":"query","name":"active","required":false,"schema":{"type":"boolean"}},{"description":"one department's","in":"query","name":"department_id","required":false,"schema":{"format":"int64","type":"integer"}},{"description":"the employee linked to this technician","in":"query","name":"technician_id","required":false,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"items":{"type":"object"},"type":"array"}}},"description":"employees by number; sin masked and bank fields null unless the caller is a person holding payroll.manage; rates and amounts null without payroll.manage"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs payroll.view)"}},"security":[{"bearer":[]}],"tags":["Payroll"]},"post":{"operationId":"employees_create","requestBody":{"content":{"application/json":{"schema":{"type":"object"}}},"required":true},"responses":{"201":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"employee created"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs payroll.manage)"},"422":{"description":"validation_failed: the field named in details"}},"security":[{"bearer":[]}],"tags":["Payroll"]}},"/employees/{id}":{"get":{"operationId":"employees_show","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the employee; sin masked and bank fields null unless the caller is a person holding payroll.manage"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs payroll.view)"},"404":{"description":"not found"}},"security":[{"bearer":[]}],"tags":["Payroll"]},"patch":{"operationId":"employees_update","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the employee after the change"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs payroll.manage)"},"404":{"description":"not found"},"422":{"description":"validation_failed: the field named in details"}},"security":[{"bearer":[]}],"tags":["Payroll"]}},"/employees/{id}/items":{"get":{"operationId":"employee_items_index","parameters":[{"description":"true: active items only","in":"query","name":"active","required":false,"schema":{"type":"boolean"}},{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"items":{"type":"object"},"type":"array"}}},"description":"the employee's recurring pay items; amount fields null without payroll.manage"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs payroll.view)"},"404":{"description":"no such employee"}},"security":[{"bearer":[]}],"tags":["Payroll"]},"post":{"operationId":"employee_items_create","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object"}}},"required":true},"responses":{"201":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the pay item"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs payroll.manage)"},"404":{"description":"no such employee"},"422":{"description":"validation_failed: the field named in details"}},"security":[{"bearer":[]}],"tags":["Payroll"]}},"/employees/{id}/items/{item_id}":{"get":{"operationId":"employee_items_show","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}},{"in":"path","name":"item_id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the pay item"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs payroll.view)"},"404":{"description":"not found (or another employee's item)"}},"security":[{"bearer":[]}],"tags":["Payroll"]},"patch":{"operationId":"employee_items_update","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}},{"in":"path","name":"item_id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the pay item after the change"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs payroll.manage)"},"404":{"description":"not found (or another employee's item)"},"422":{"description":"validation_failed: the field named in details"}},"security":[{"bearer":[]}],"tags":["Payroll"]}},"/employees/{id}/terminate":{"post":{"operationId":"employees_terminate","parameters":[{"description":"employee id","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"final_pay":{"default":false,"description":"Make the final pay now as an off-cycle run with the employee's open time cards","type":"boolean"},"final_period_end":{"default":null,"description":"ROE block 12; absent = found from pay history","type":["string","null"]},"last_day_paid":{"default":null,"description":"ROE block 11, YYYY-MM-DD; absent = the termination date","type":["string","null"]},"pay_date":{"default":null,"description":"The final pay's cheque date; absent = today","type":["string","null"]},"pay_out_vacation":{"default":false,"description":"With final_pay: pay out the accrued vacation pay","type":"boolean"},"period_end":{"default":null,"description":"The final pay's period end; absent = the last day paid","type":["string","null"]},"reason_code":{"default":"","description":"ROE block 16: ROE Web's separation code (A00, E00, M00 ...) or its letter","type":"string"},"termination_date":{"default":"","description":"YYYY-MM-DD","type":"string"}},"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"`{employee, run, roe}`: the termination date set, the final pay's off-cycle run (or null) and the draft ROE (null for a sub-contractor)"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs payroll.manage)"},"404":{"description":"no such employee"},"409":{"description":"conflict: already terminated; on an unposted pay run"},"422":{"description":"validation_failed: termination_date, last_day_paid, reason_code, pay_out_vacation, pay_date, period_end; idempotency_key_reused"}},"security":[{"bearer":[]}],"tags":["Payroll"]}},"/employees/{id}/time_off":{"get":{"operationId":"employee_time_off","parameters":[{"description":"YYYY-MM-DD; default the location's today","in":"query","name":"as_of","required":false,"schema":{"type":"string"}},{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the sick and personal grants with the hours taken and left in the calendar year of `as_of`, the vacation hours recorded and the accrued vacation pay (null without payroll.manage)"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs payroll.view)"},"404":{"description":"no such employee"},"422":{"description":"as_of is not a date"}},"security":[{"bearer":[]}],"tags":["Payroll"]}},"/employees/{id}/time_off/{kind}":{"put":{"operationId":"employee_time_off_set","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}},{"in":"path","name":"kind","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"annual_hundredths":{"default":0,"description":"Hours granted per calendar year, in hundredths (6 days of 8 h = 4800); 0 ends the grant","format":"int64","type":"integer"},"paid":{"default":false,"description":"Whether the leave is paid at the employee's rate","type":"boolean"}},"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the new balances"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs payroll.manage)"},"422":{"description":"kind is not sick or personal, or the hours are out of range"}},"security":[{"bearer":[]}],"tags":["Payroll"]}},"/employees/{id}/ytd":{"get":{"operationId":"employee_ytd","parameters":[{"description":"the calendar year (required)","in":"query","name":"year","required":false,"schema":{"format":"int32","type":"integer"}},{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the employee's year-to-date figures, with income tax, deductions, net and vacation paid, derived from the opening and the year's posted pay lines"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs payroll.manage)"},"404":{"description":"no such employee"},"422":{"description":"year missing or out of range"}},"security":[{"bearer":[]}],"tags":["Payroll"]}},"/employees/{id}/ytd_openings":{"get":{"operationId":"employee_ytd_openings_index","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"items":{"type":"object"},"type":"array"}}},"description":"the employee's year-to-date openings, one per year"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs payroll.manage)"}},"security":[{"bearer":[]}],"tags":["Payroll"]},"post":{"operationId":"employee_ytd_openings_create","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object"}}},"required":true},"responses":{"201":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the opening"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs payroll.manage)"},"404":{"description":"no such employee"},"422":{"description":"validation_failed: the field named in details"}},"security":[{"bearer":[]}],"tags":["Payroll"]}},"/employees/{id}/ytd_openings/{opening_id}":{"get":{"operationId":"employee_ytd_openings_show","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}},{"in":"path","name":"opening_id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the opening"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs payroll.manage)"},"404":{"description":"not found (or another employee's opening)"}},"security":[{"bearer":[]}],"tags":["Payroll"]},"patch":{"operationId":"employee_ytd_openings_update","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}},{"in":"path","name":"opening_id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the opening after the change"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs payroll.manage)"},"404":{"description":"not found (or another employee's opening)"},"422":{"description":"validation_failed: the field named in details"}},"security":[{"bearer":[]}],"tags":["Payroll"]}},"/events":{"get":{"operationId":"events_index","parameters":[{"description":"resume after this seq","in":"query","name":"after","required":false,"schema":{"format":"int64","type":"integer"}},{"description":"resume after this seq (wins over after)","in":"header","name":"Last-Event-ID","required":false,"schema":{"format":"int64","type":["integer","null"]}}],"responses":{"200":{"content":{"text/event-stream":{}},"description":"server-sent events of the caller's shop: `event: change` with data {seq, kind, id, version, actor {kind, id}, summary, at, op, work_order_id, location_id} (pointers only, never record content; a user scoped to one location gets that location's and the location-less ones); `event: reset` with data {seq} when the cursor is no longer held (reload everything). Ends after 15 minutes; reconnect with the last seq"},"401":{"description":"unauthenticated"},"406":{"description":"not_acceptable: send Accept: text/event-stream"}},"security":[{"bearer":[]}],"tags":["Events"]}},"/expense_categories":{"get":{"operationId":"expense_categories_index","parameters":[{"description":"also retired categories","in":"query","name":"include_inactive","required":false,"schema":{"type":"boolean"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the categories in display order, each with the account it posts to and the claimable share of GST/HST"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs reports.view or ledger.manage)"}},"security":[{"bearer":[]}],"tags":["Expenses"]},"post":{"operationId":"expense_category_create","parameters":[{"description":"replays the first create with this key","in":"header","name":"idempotency-key","required":false,"schema":{"type":["string","null"]}}],"requestBody":{"content":{"application/json":{"schema":{"properties":{"account_number":{"default":"","description":"The chart account it posts to","type":"string"},"itc_bp":{"default":null,"description":"The share of the GST/HST the shop may claim back, in basis points (default 10000)","format":"int64","type":["integer","null"]},"key":{"default":"","description":"The key the receipt reader and old bills name it with: 1 to 30 of a-z, 0-9 and _","type":"string"},"label":{"default":"","description":"What the shop calls it; at most 40 characters","type":"string"},"position":{"default":null,"description":"Where it sorts in the list","format":"int64","type":["integer","null"]},"tax_code":{"default":"","description":"The usual sales tax on such a purchase: gst, hst, pst or none (default gst)","type":"string"}},"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the new category"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs ledger.manage)"},"409":{"description":"a category already uses this key"},"422":{"description":"validation_failed: key, label, account_number, tax_code, itc_bp; idempotency_key_reused"}},"security":[{"bearer":[]}],"tags":["Expenses"]}},"/expense_categories/{id}":{"patch":{"operationId":"expense_category_update","parameters":[{"description":"category id","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"properties":{"account_number":{"default":null,"description":"The chart account it posts to","type":["string","null"]},"active":{"default":null,"description":"false retires the category: quick expenses stop naming it","type":["boolean","null"]},"itc_bp":{"default":null,"description":"The claimable share of the GST/HST, in basis points","format":"int64","type":["integer","null"]},"label":{"default":null,"description":"The shop's name for it","type":["string","null"]},"position":{"default":null,"description":"Where it sorts in the list","format":"int64","type":["integer","null"]},"tax_code":{"default":null,"description":"The usual sales tax on such a purchase","type":["string","null"]}},"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the category after the change"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs ledger.manage)"},"404":{"description":"no such category"},"422":{"description":"validation_failed: label, account_number, tax_code, itc_bp"}},"security":[{"bearer":[]}],"tags":["Expenses"]}},"/expenses":{"post":{"operationId":"expenses_quick_add","parameters":[{"description":"replays the first create with this key","in":"header","name":"idempotency-key","required":false,"schema":{"type":["string","null"]}}],"requestBody":{"content":{"application/json":{"schema":{"properties":{"attachment_ids":{"default":[],"description":"Receipt photos (staged as `ExpenseReceipt` at the location) to file on the bill","items":{"type":"string"},"type":"array"},"category":{"default":"","description":"The category key (expense_categories.list): fuel, parts, shop_supplies, meals, tools,\nutilities, other, or the shop's own","type":"string"},"date":{"default":null,"description":"The receipt's date, YYYY-MM-DD; absent = today at the location","type":["string","null"]},"description":{"default":null,"description":"What was bought; at most 120 characters (default the category's name)","type":["string","null"]},"extraction_id":{"default":null,"description":"The receipt reading (POST /extractions) the figures came from, if any","format":"int64","type":["integer","null"]},"gst_hst_cents":{"default":0,"description":"GST or HST on the receipt, in cents","format":"int64","type":"integer"},"location_id":{"default":null,"description":"The location; absent = the user's own","format":"int64","type":["integer","null"]},"paid_with":{"default":"","description":"cash (from the till), debit, credit_card, cheque, other (from the bank), or account\n(not paid yet: the bill stays owing)","type":"string"},"payee":{"default":"","description":"Who was paid, as on the receipt, when there is no vendor; at most 60 characters","type":"string"},"pst_cents":{"default":0,"description":"PST (or QST) on the receipt, in cents","format":"int64","type":"integer"},"reference":{"default":"","description":"The receipt or cheque number; at most 60 characters","type":"string"},"subtotal_cents":{"default":0,"description":"The amount before tax, in cents","format":"int64","type":"integer"},"total_cents":{"default":null,"description":"The receipt's total, checked against the sum; omit when unknown","format":"int64","type":["integer","null"]},"vendor_id":{"default":null,"description":"The vendor from the vendor file, when there is one","format":"int64","type":["integer","null"]}},"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the bill the expense became, as GET /bills/{id} answers it, plus attachment_ids"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs ledger.manage)"},"404":{"description":"no such location"},"422":{"description":"validation_failed: payee, category, subtotal_cents, gst_hst_cents, pst_cents, total_cents, paid_with, attachment_ids; total_mismatch; idempotency_key_reused"}},"security":[{"bearer":[]}],"tags":["Expenses"]}},"/expenses/receipts":{"get":{"operationId":"expense_receipt_index","parameters":[{"description":"the location; absent = the user's own","in":"query","name":"location_id","required":false,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"receipt photos not yet filed on a bill, newest first"},"401":{"description":"unauthenticated"},"403":{"description":"needs ledger.manage"},"404":{"description":"no such location"}},"security":[{"bearer":[]}],"tags":["Attachments"]},"post":{"operationId":"expense_receipt_create","parameters":[{"description":"replays the first stage with this key","in":"header","name":"idempotency-key","required":false,"schema":{"type":["string","null"]}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateExpenseReceiptBody"}}},"required":true},"responses":{"200":{"description":"replayed"},"201":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"a receipt photo staged: {attachment, upload}, as for a work order"},"401":{"description":"unauthenticated"},"403":{"description":"needs ledger.manage"},"404":{"description":"no such location"},"422":{"description":"invalid request"}},"security":[{"bearer":[]}],"tags":["Attachments"]}},"/exports":{"get":{"operationId":"exports_index","responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"this shop's export requests, newest first"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs data.export; an agent never)"}},"security":[{"bearer":[]}],"tags":["Exports"]},"post":{"operationId":"exports_create","responses":{"201":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the export request, queued"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs data.export; an agent never)"},"409":{"description":"an export is already queued or running"},"422":{"description":"validation_failed: idempotency_key_reused"}},"security":[{"bearer":[]}],"tags":["Exports"]}},"/exports/{id}":{"get":{"operationId":"exports_show","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the export request"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs data.export; an agent never)"},"404":{"description":"not found"}},"security":[{"bearer":[]}],"tags":["Exports"]}},"/exports/{id}/download":{"get":{"operationId":"exports_download","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"description":"the zip (local disk)"},"302":{"description":"to a ten-minute presigned URL (bucket)"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs data.export; an agent never)"},"404":{"description":"not found, or the file is gone"},"409":{"description":"not ready (or no longer)"},"503":{"description":"export storage unavailable"}},"security":[{"bearer":[]}],"tags":["Exports"]}},"/extractions":{"post":{"operationId":"extractions_create","requestBody":{"content":{"application/json":{"schema":{"properties":{"attachment_ids":{"default":[],"description":"The photos (attachment ids), 1 to 5, in page order; plan 3108: omit for pasted text","items":{"type":"string"},"type":"array"},"hint":{"default":null,"description":"What the user expects to see, e.g. the supplier's name; optional","type":["string","null"]},"kind":{"enum":["packing_slip","receipt","vin_photo","odometer_photo"],"type":"string"},"text":{"default":null,"description":"Plan 3108: text copied from a supplier's website, e-mail or chat; instead of photos","type":["string","null"]}},"required":["kind"],"type":"object"}}},"required":false},"responses":{"201":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the stored extraction (Idempotency-Key replays it)"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized, a photo the user cannot see, or ai_data_sharing_off"},"404":{"description":"a photo was not found"},"422":{"description":"validation_failed, idempotency_key_reused or a photo is not a ready image"},"503":{"description":"the model is unavailable for this account"}},"security":[{"bearer":[]}],"tags":["Extractions"]}},"/extractions/{id}":{"get":{"operationId":"extractions_show","parameters":[{"description":"the extraction id","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the stored extraction"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized or a photo the user cannot see"},"404":{"description":"not found"}},"security":[{"bearer":[]}],"tags":["Extractions"]}},"/first_run":{"get":{"operationId":"first_run_show","responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"steps [{key, done, skipped}] in order, open (0 = finished)"},"401":{"description":"unauthenticated"},"403":{"description":"needs settings.manage"}},"security":[{"bearer":[]}],"tags":["Workflow Config"]}},"/first_run/skips":{"post":{"operationId":"first_run_skip","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SkipBody"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the checklist after the skip"},"401":{"description":"unauthenticated"},"403":{"description":"needs settings.manage"},"422":{"description":"no step, or an unknown step key"}},"security":[{"bearer":[]}],"tags":["Workflow Config"]}},"/fleets":{"get":{"operationId":"fleets_index","parameters":[{"description":"matches the fleet number, the customer's name, a driver's name or a vehicle's plate","in":"query","name":"q","required":false,"schema":{"type":"string"}},{"description":"at most 100 (default 50)","in":"query","name":"limit","required":false,"schema":{"format":"int64","type":"integer"}},{"description":"rows to skip (default 0)","in":"query","name":"offset","required":false,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"items":{"type":"object"},"type":"array"}}},"description":"fleet customers, fleet-number order; each with its vehicle, driver and open-work-order counts and its owing figure"},"401":{"description":"unauthenticated"}},"security":[{"bearer":[]}],"tags":["Customers"]}},"/history":{"get":{"operationId":"history_index","parameters":[{"description":"the customer's posted invoices","in":"query","name":"customer_id","required":false,"schema":{"format":"int64","type":"integer"}},{"description":"licence plate, whole, case-insensitive: every posted invoice of a vehicle with that plate, whoever the customer","in":"query","name":"license","required":false,"schema":{"type":"string"}},{"description":"vehicle ID#, whole, case-insensitive","in":"query","name":"id_number","required":false,"schema":{"type":"string"}},{"description":"order number of one posted invoice (trimmed); 404 when none","in":"query","name":"order_number","required":false,"schema":{"type":"string"}},{"description":"`invoice_desc` (the default and only order)","in":"query","name":"order","required":false,"schema":{"type":"string"}},{"description":"rows, 1-100 (default 12, the FoxPro page)","in":"query","name":"limit","required":false,"schema":{"format":"int64","type":"integer"}},{"description":"`next_after` of the page before","in":"query","name":"after","required":false,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"`{ rows, total, next_after }`: posted invoices, highest invoice number first (FoxPro SERINQ list); `next_after` is null on the last page"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs customers.read)"},"404":{"description":"customer not found; no posted invoice with that order number"},"422":{"description":"not exactly one subject; invalid order, limit or after"}},"security":[{"bearer":[]}],"tags":["Customers"]}},"/inbox":{"get":{"operationId":"inbox","responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"what waits on this user: counts and items"}},"security":[{"bearer":[]}],"tags":["Messages"]}},"/inbox/{id}/done":{"post":{"operationId":"inbox_done","parameters":[{"description":"the item's id from the inbox: <kind>:<number>","in":"path","name":"id","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":{},"propertyNames":{"type":"string"},"type":"object"}}}},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"`{id, done}`"},"404":{"description":"no such item"},"422":{"description":"not an inbox item id"}},"security":[{"bearer":[]}],"tags":["Messages"]}},"/inspection_items/{id}":{"patch":{"operationId":"inspection_items_record","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RecordBody"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the item (rating good|soon|now|na|null, note)"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized or another location's work order"},"404":{"description":"not found"},"409":{"description":"already_posted or work_order_not_editable"},"422":{"description":"an unknown rating"}},"security":[{"bearer":[]}],"tags":["Work Orders"]}},"/inspection_templates":{"get":{"operationId":"inspection_templates_list","responses":{"200":{"content":{"application/json":{"schema":{"items":{"type":"object"},"type":"array"}}},"description":"active templates: id, name, groups, items"},"401":{"description":"unauthenticated"}},"security":[{"bearer":[]}],"tags":["Work Orders"]}},"/inspection_video_marks/confirm":{"post":{"operationId":"inspection_video_marks_confirm","requestBody":{"content":{"application/json":{"schema":{"additionalProperties":{},"propertyNames":{"type":"string"},"type":"object"}}}},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the confirmed marks and their findings"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized, another location's work order, or a posted order"},"404":{"description":"a mark was not found"},"422":{"description":"invalid request"}},"security":[{"bearer":[]}],"summary":"The technician's one button for all (plan 2961): the drafts become the findings.","tags":["Work Orders"]}},"/inspection_video_marks/{id}":{"delete":{"operationId":"inspection_video_marks_delete","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"204":{"description":"mark removed"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized, another location's work order, or a posted order"},"404":{"description":"not found"}},"security":[{"bearer":[]}],"tags":["Work Orders"]},"get":{"operationId":"inspection_video_marks_show","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"mark"},"401":{"description":"unauthenticated"},"403":{"description":"another location's work order"},"404":{"description":"not found"}},"security":[{"bearer":[]}],"tags":["Work Orders"]},"patch":{"operationId":"inspection_video_marks_update","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CrudBody"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"mark updated (attrs: end_ms, rating, item, finding_id)"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized, another location's work order, or a posted order"},"404":{"description":"not found"},"412":{"description":"stale If-Match"},"422":{"description":"invalid request"}},"security":[{"bearer":[]}],"tags":["Work Orders"]}},"/inspections/{id}":{"delete":{"operationId":"inspections_delete","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"204":{"description":"removed (it held no result)"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized or another location's work order"},"404":{"description":"not found"},"409":{"description":"it has results (conflict), already_posted or work_order_not_editable"}},"security":[{"bearer":[]}],"tags":["Work Orders"]},"get":{"operationId":"inspections_show","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the inspection, its groups and items"},"401":{"description":"unauthenticated"},"403":{"description":"another location's work order"},"404":{"description":"not found"}},"security":[{"bearer":[]}],"tags":["Work Orders"]},"patch":{"operationId":"inspections_assign","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"properties":{"technician_id":{"description":"The technician (technicians.list); null = nobody","format":"int64","type":["integer","null"]}},"required":[],"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the inspection with its technician (null clears)"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized or another location's work order"},"404":{"description":"not found"},"409":{"description":"already_posted or work_order_not_editable"},"422":{"description":"no such technician"}},"security":[{"bearer":[]}],"tags":["Work Orders"]}},"/inspections/{id}/complete":{"post":{"operationId":"inspections_complete","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the inspection, completed_at set"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized or another location's work order"},"404":{"description":"not found"},"409":{"description":"already_posted or work_order_not_editable"}},"security":[{"bearer":[]}],"tags":["Work Orders"]}},"/inspections/{id}/mark_rest_good":{"post":{"operationId":"inspections_mark_rest_good","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"properties":{"group":{"default":null,"description":"The group by its words, e.g. \"brakes\"; omitted = every unchecked item","type":["string","null"]}},"required":[],"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the inspection after the change"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized or another location's work order"},"404":{"description":"not found"},"409":{"description":"already_posted or work_order_not_editable"},"422":{"description":"no group matches"}},"security":[{"bearer":[]}],"tags":["Work Orders"]}},"/jobs/{id}/retry":{"post":{"operationId":"jobs_retry","parameters":[{"description":"job id","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"description":"the job was requeued; it is now pending with no attempts"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden"},"404":{"description":"not found"},"409":{"description":"the job is not dead"},"500":{"description":"internal error"}},"security":[{"bearer":[]}],"tags":["Jobs"]}},"/labor_allowance":{"get":{"operationId":"labor_allowance","responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"limit (null = unlimited), used, unlimited, period (day or year; empty when unlimited), resets_at (the next local midnight as a UTC instant; null for year and unlimited), unlimited_until (a date YYYY-MM-DD, the end of a starter's unlimited window; null for a limit and for unlimited for good), reason, contributed {invoices, months} (the account's billed labour history), imported_jobs (contributed.invoices), vehicles"}},"security":[{"bearer":[]}],"tags":["Vehicles"]}},"/labor_consent":{"delete":{"operationId":"labor_consent_delete","responses":{"204":{"description":"the consent is withdrawn; a contributor's unlimited allowance comes back to the free limit"},"401":{"description":"unauthenticated"},"403":{"description":"only the account's owner can withdraw"}},"security":[{"bearer":[]}],"tags":["Labour Consent"]},"get":{"operationId":"labor_consent_get","responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the account's consent; both null when not given"},"401":{"description":"unauthenticated"}},"security":[{"bearer":[]}],"tags":["Labour Consent"]},"post":{"operationId":"labor_consent_create","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateLaborConsentBody"}}},"required":true},"responses":{"201":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the consent, dated today in UTC (Idempotency-Key replays it)"},"401":{"description":"unauthenticated"},"403":{"description":"only the account's owner can agree"},"422":{"description":"invalid text_version or idempotency_key_reused"}},"security":[{"bearer":[]}],"tags":["Labour Consent"]}},"/labor_contributions":{"get":{"operationId":"labor_contribution_index","responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the account's contributions, newest first"},"401":{"description":"unauthenticated"}},"security":[{"bearer":[]}],"tags":["Labour"]},"post":{"operationId":"labor_contribution_create","parameters":[{"description":"replays the first send with this key","in":"header","name":"idempotency-key","required":false,"schema":{"type":["string","null"]}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateContributionBody"}}},"required":true},"responses":{"200":{"description":"replayed: the same contribution and attachment"},"201":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the contribution and its staged file: {contribution, attachment}"},"401":{"description":"unauthenticated"},"403":{"description":"only the account's owner can send a labour history"},"409":{"description":"idempotency key reused with a different body"},"422":{"description":"the file's name or size is not a contribution"}},"security":[{"bearer":[]}],"tags":["Labour"]}},"/labor_rates":{"get":{"operationId":"labor_rates_index","parameters":[{"description":"the location; default the user's own","in":"query","name":"location_id","required":false,"schema":{"format":"int64","type":"integer"}},{"description":"true: archived rates too (listed last)","in":"query","name":"all","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"items":{"type":"object"},"type":"array"}}},"description":"the location's labour rates in order (active only, without all)"},"401":{"description":"unauthenticated"},"403":{"description":"the user cannot reach the location"}},"security":[{"bearer":[]}],"tags":["Labour rates"]},"post":{"operationId":"labor_rates_create","parameters":[{"description":"replays the first create with this key","in":"header","name":"idempotency-key","required":false,"schema":{"type":["string","null"]}}],"requestBody":{"content":{"application/json":{"schema":{}}},"required":true},"responses":{"201":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"labour rate created"},"401":{"description":"unauthenticated"},"403":{"description":"needs settings.manage"},"422":{"description":"invalid request, or the code is taken or archived"}},"security":[{"bearer":[]}],"tags":["Labour rates"]}},"/labor_rates/{id}":{"get":{"operationId":"labor_rates_show","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the labour rate"},"401":{"description":"unauthenticated"},"403":{"description":"the user cannot reach the rate's location"},"404":{"description":"not found"}},"security":[{"bearer":[]}],"tags":["Labour rates"]},"patch":{"operationId":"labor_rates_update","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"labour rate updated"},"401":{"description":"unauthenticated"},"403":{"description":"needs settings.manage"},"404":{"description":"not found"},"422":{"description":"invalid request; a code never changes"}},"security":[{"bearer":[]}],"tags":["Labour rates"]}},"/labor_rates/{id}/archive":{"post":{"operationId":"labor_rates_archive","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the rate, archived and no longer the default"},"401":{"description":"unauthenticated"},"403":{"description":"needs settings.manage"},"404":{"description":"not found"}},"security":[{"bearer":[]}],"summary":"`POST /labor_rates/{id}/archive`: retires the rate (its code can no longer be chosen).","tags":["Labour rates"]}},"/labor_rates/{id}/restore":{"post":{"operationId":"labor_rates_restore","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the rate, active again"},"401":{"description":"unauthenticated"},"403":{"description":"needs settings.manage"},"404":{"description":"not found"}},"security":[{"bearer":[]}],"summary":"`POST /labor_rates/{id}/restore`: brings an archived rate back, last in the list.","tags":["Labour rates"]}},"/labor_templates":{"get":{"operationId":"labor_templates_index","parameters":[{"description":"match labor code or description, case-insensitive","in":"query","name":"q","required":false,"schema":{"type":"string"}},{"description":"exact labour code; q and the page are ignored with it","in":"query","name":"code","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"items":{"type":"object"},"type":"array"}}},"description":"labor template list"},"401":{"description":"unauthenticated"}},"security":[{"bearer":[]}],"tags":["Labor Templates"]},"post":{"operationId":"labor_templates_create","requestBody":{"content":{"application/json":{"schema":{"type":"object"}}},"required":true},"responses":{"201":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"labor template created"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized"},"409":{"description":"conflict"},"422":{"description":"validation failed"}},"security":[{"bearer":[]}],"tags":["Labor Templates"]}},"/labor_templates/{id}":{"delete":{"operationId":"labor_templates_delete","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"labor template deleted"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized"},"404":{"description":"not found"}},"security":[{"bearer":[]}],"tags":["Labor Templates"]},"get":{"operationId":"labor_templates_show","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"labor template"},"401":{"description":"unauthenticated"},"404":{"description":"not found"}},"security":[{"bearer":[]}],"tags":["Labor Templates"]},"patch":{"operationId":"labor_templates_update","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"labor template updated"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized"},"404":{"description":"not found"},"409":{"description":"conflict"},"422":{"description":"validation failed"}},"security":[{"bearer":[]}],"tags":["Labor Templates"]}},"/labour_codes/link_suggestions":{"get":{"operationId":"labour_codes_link_suggestions","responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"{codes: [{code, description, suggestion: {job_id, name} or null}]}: every labour code with no job and the job its description suggests"},"401":{"description":"unauthenticated"}},"security":[{"bearer":[]}],"tags":["Labour times"]}},"/labour_codes/links":{"post":{"operationId":"labour_codes_link","requestBody":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"{links: [{labor_code, job_id}]}, at most 200; a null job_id unlinks the code","required":true},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"{linked}: how many codes were set"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized (catalog.write)"},"422":{"description":"validation_failed: links (an unknown labour code or Wenmar job, named by its index)"}},"security":[{"bearer":[]}],"tags":["Labour times"]}},"/labour_times/{id}/clear":{"post":{"operationId":"labour_times_clear","parameters":[{"description":"a shop labour time id","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the shop time, superseded (kept for the lines that used it)"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized (catalog.write)"},"404":{"description":"not found"},"422":{"description":"validation_failed: id (only a shop time can be cleared)"}},"security":[{"bearer":[]}],"tags":["Vehicles"]}},"/lead_sources":{"get":{"operationId":"lead_sources_index","parameters":[{"description":"`false` lists only retired sources; absent lists everything","in":"query","name":"active","required":false,"schema":{"type":"boolean"}}],"responses":{"200":{"content":{"application/json":{"schema":{"items":{"type":"object"},"type":"array"}}},"description":"the shop's lead sources, in display order"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs customers.read)"}},"security":[{"bearer":[]}],"tags":["Customers"]},"post":{"operationId":"lead_sources_create","requestBody":{"content":{"application/json":{"schema":{}}},"required":true},"responses":{"201":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"lead source created (name required)"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs customers.write)"},"422":{"description":"invalid request (blank, taken or over-long name)"}},"security":[{"bearer":[]}],"tags":["Customers"]}},"/lead_sources/{id}":{"get":{"operationId":"lead_sources_show","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the lead source"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs customers.read)"},"404":{"description":"not found"}},"security":[{"bearer":[]}],"tags":["Customers"]},"patch":{"operationId":"lead_sources_update","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"lead source updated (retire it with active: false)"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs customers.write)"},"404":{"description":"not found"},"422":{"description":"invalid request"}},"security":[{"bearer":[]}],"tags":["Customers"]}},"/ledger/entries":{"get":{"operationId":"ledger_entries_index","parameters":[{"description":"first entry date, YYYY-MM-DD","in":"query","name":"from","required":false,"schema":{"type":"string"}},{"description":"last entry date, YYYY-MM-DD","in":"query","name":"to","required":false,"schema":{"type":"string"}},{"description":"manual, adjusting, opening, invoice, receipt, bill, bill_payment, stock_adjustment, payroll or payroll_remittance","in":"query","name":"source_kind","required":false,"schema":{"type":"string"}},{"description":"only entries with a line on this account","in":"query","name":"account","required":false,"schema":{"type":"string"}},{"description":"1-100, default 50","in":"query","name":"limit","required":false,"schema":{"format":"int64","type":"integer"}},{"description":"rows to skip","in":"query","name":"offset","required":false,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"`{data, total, next_offset}`: entries newest date first, each with its lines (amount_cents signed, debit +; debit_cents, credit_cents)"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs reports.view)"},"422":{"description":"validation_failed: from, to, source_kind"}},"security":[{"bearer":[]}],"tags":["Ledger"]},"post":{"operationId":"ledger_entries_create","requestBody":{"content":{"application/json":{"schema":{"properties":{"entry_date":{"default":"","description":"The entry's date, YYYY-MM-DD; must be after the lock date","type":"string"},"kind":{"default":null,"description":"manual (default), adjusting (from the accountant) or opening (balances when the books begin)","type":["string","null"]},"lines":{"default":[],"description":"Two or more lines whose debits equal their credits","items":{"properties":{"account_number":{"default":"","description":"The account number (chart of accounts)","type":"string"},"credit_cents":{"default":0,"description":"Cents credited; give a debit or a credit, not both","format":"int64","type":"integer"},"debit_cents":{"default":0,"description":"Cents debited; give a debit or a credit, not both","format":"int64","type":"integer"},"memo":{"default":"","description":"At most 60 characters","type":"string"}},"type":"object"},"type":"array"},"location_id":{"default":null,"description":"The location the entry belongs to; absent = the whole account","format":"int64","type":["integer","null"]},"memo":{"default":"","description":"What the entry is for; at most 120 characters","type":"string"}},"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the new entry with its lines"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs ledger.manage)"},"422":{"description":"validation_failed: entry_date (locked), memo, kind, location_id, lines; idempotency_key_reused"}},"security":[{"bearer":[]}],"tags":["Ledger"]}},"/ledger/entries/{id}":{"get":{"operationId":"ledger_entries_show","parameters":[{"description":"entry id","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the entry with its lines and reversed_by_entry_id"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs reports.view)"},"404":{"description":"no such entry"}},"security":[{"bearer":[]}],"tags":["Ledger"]}},"/ledger/entries/{id}/reverse":{"post":{"operationId":"ledger_entries_reverse","parameters":[{"description":"the entry to reverse","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"properties":{"entry_date":{"default":"","description":"The reversal's date, YYYY-MM-DD; must be after the lock date","type":"string"}},"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the reversing entry"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs ledger.manage)"},"404":{"description":"no such entry"},"409":{"description":"conflict: already reversed, a reversal, or a posted document's entry"},"422":{"description":"validation_failed: entry_date (locked)"}},"security":[{"bearer":[]}],"tags":["Ledger"]}},"/ledger/import":{"post":{"operationId":"ledger_import","requestBody":{"content":{"application/json":{"schema":{"properties":{"csv":{"default":"","description":"The CSV: the header entry,date,account,debit,credit,memo, then one row per entry line","type":"string"},"dry_run":{"default":true,"description":"true (the default) checks the file and writes nothing","type":"boolean"}},"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"`{entries, errors, written, dry_run, replayed}`: the entries read from the csv; with dry_run (the default) nothing is written"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs ledger.manage)"},"422":{"description":"validation_failed: csv (one problem per row, named in field_errors)"}},"security":[{"bearer":[]}],"tags":["Ledger"]}},"/ledger/lock":{"put":{"operationId":"ledger_lock","requestBody":{"content":{"application/json":{"schema":{"properties":{"through":{"default":null,"description":"Nothing may be posted on or before this date (YYYY-MM-DD). Null or absent removes the lock","type":["string","null"]}},"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the settings with the new locked_through"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs ledger.manage)"},"422":{"description":"validation_failed: through"}},"security":[{"bearer":[]}],"tags":["Ledger"]}},"/ledger/package":{"get":{"operationId":"ledger_package","parameters":[{"description":"the first day of the period, YYYY-MM-DD","in":"query","name":"from","required":true,"schema":{"type":"string"}},{"description":"the last day of the period, YYYY-MM-DD","in":"query","name":"to","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/zip":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"the books for the period as one zip (application/zip): the trial balance, GIFI trial balance, ledger detail, income statement, balance sheet, PDFs, an adjusting-entries template, README.txt and manifest.json"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs reports.view)"},"422":{"description":"validation_failed: from, to"}},"security":[{"bearer":[]}],"tags":["Ledger"]}},"/ledger/post":{"post":{"operationId":"ledger_post","responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"`{entries, documents, rejected, posted_at, skipped}`: what the posting sweep entered"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs ledger.manage)"}},"security":[{"bearer":[]}],"tags":["Ledger"]}},"/ledger/send_package":{"post":{"operationId":"ledger_send_package","requestBody":{"content":{"application/json":{"schema":{"properties":{"from":{"default":"","description":"The first day of the period, YYYY-MM-DD","type":"string"},"lock":{"default":false,"description":"Also lock the books through `to`, so nothing in the period changes once the accountant has it","type":"boolean"},"to":{"default":"","description":"The last day of the period, YYYY-MM-DD","type":"string"}},"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"`{job_id, event_id, to, locked_through, manifest}`: the package is requested for the accountant's address (`job_id` is null: the worker queues the job from the event)"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs ledger.manage)"},"422":{"description":"validation_failed: from, to; no_accountant_email"}},"security":[{"bearer":[]}],"tags":["Ledger"]}},"/ledger/settings":{"get":{"operationId":"ledger_settings_show","responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"fiscal_year_end_month, locked_through, accountant_email, package_schedule, posting_start, posted_at"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs reports.view)"}},"security":[{"bearer":[]}],"tags":["Ledger"]},"patch":{"operationId":"ledger_settings_update","requestBody":{"content":{"application/json":{"schema":{"properties":{"accountant_email":{"default":null,"description":"Where the accountant package is e-mailed; blank = nobody","type":["string","null"]},"books_kept_in":{"default":null,"description":"`wenmar` (default) or `quickbooks`: where the shop keeps its books (plan 2540)","type":["string","null"]},"fiscal_year_end_month":{"default":null,"description":"1-12: the month the fiscal year ends in","format":"uint32","minimum":0,"type":["integer","null"]},"package_schedule":{"default":null,"description":"none, monthly, quarterly or yearly: when the accountant package is e-mailed on its own","type":["string","null"]},"posting_start":{"default":null,"description":"YYYY-MM-DD: documents dated before it are never posted to the ledger; must be after the lock date","type":["string","null"]},"retained_earnings_account":{"default":null,"description":"The account the prior years' earnings roll into on the balance sheet (1-10 characters, no blanks)","type":["string","null"]}},"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the settings after the change"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs ledger.manage)"},"422":{"description":"validation_failed: fiscal_year_end_month, accountant_email, package_schedule, posting_start"}},"security":[{"bearer":[]}],"tags":["Ledger"]}},"/line_items":{"get":{"operationId":"work_order_line_items_index","responses":{"200":{"content":{"application/json":{"schema":{"items":{"type":"object"},"type":"array"}}},"description":"line item list"},"401":{"description":"unauthenticated"},"422":{"description":"work_order_id or work_order_service_id required"}},"security":[{"bearer":[]}],"tags":["Work Orders"]}},"/line_items/{id}":{"delete":{"operationId":"work_order_line_item_delete","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"204":{"description":"line item deleted"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized or another location's work order"},"404":{"description":"not found"},"409":{"description":"already_posted or work_order_not_editable"},"422":{"description":"invalid request"}},"security":[{"bearer":[]}],"tags":["Work Orders"]},"get":{"operationId":"work_order_line_item_show","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"line item"},"401":{"description":"unauthenticated"},"403":{"description":"another location's work order"},"404":{"description":"not found"}},"security":[{"bearer":[]}],"tags":["Work Orders"]},"patch":{"operationId":"work_order_line_item_update","parameters":[{"description":"ETag from the last read (plan 105)","in":"header","name":"If-Match","required":false,"schema":{"type":["string","null"]}},{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CrudBody"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"line item updated"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized or another location's work order"},"404":{"description":"not found"},"409":{"description":"already_posted or work_order_not_editable"},"412":{"description":"record changed since If-Match; body.current is the record now"},"422":{"description":"invalid request"}},"security":[{"bearer":[]}],"tags":["Work Orders"]}},"/line_items/{id}/attachments":{"get":{"operationId":"core_line_attachment_index","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the core line's photos, newest first"},"401":{"description":"unauthenticated"},"404":{"description":"line not found, or it has no core"}},"security":[{"bearer":[]}],"tags":["Attachments"]},"post":{"operationId":"core_line_attachment_create","parameters":[{"description":"replays the first stage with this key","in":"header","name":"idempotency-key","required":false,"schema":{"type":["string","null"]}},{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateAttachmentBody"}}},"required":true},"responses":{"200":{"description":"replayed"},"201":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"a photo of the core staged: {attachment, upload}, as for a work order"},"401":{"description":"unauthenticated"},"403":{"description":"the line's work order is not writable"},"404":{"description":"line not found, or it has no core"},"422":{"description":"invalid request"}},"security":[{"bearer":[]}],"tags":["Attachments"]}},"/line_items/{id}/core_return":{"post":{"operationId":"line_items_core_return","parameters":[{"description":"the part line","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"properties":{"paid_back":{"default":false,"description":"true: the money was handed back now; false (default): it stays as shop credit","type":"boolean"},"reference":{"default":null,"description":"Cheque number or other reference of the money handed back","type":["string","null"]},"returned_on":{"default":null,"description":"YYYY-MM-DD; defaults to the shop's local today","type":["string","null"]}},"required":[],"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"`{line_item_id, work_order_id, core_cents, tax_cents, refund_cents, returned_on, credit, paid_back, customer_balance_cents}`: before posting the core stops being charged (refund 0); after, a credit adjustment (and with paid_back a debit one)"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs payments.take)"},"404":{"description":"no such line"},"409":{"description":"conflict: already returned, or the order is closed"},"422":{"description":"validation_failed: line_item_id (no_customer_core, no_customer), returned_on, reference"}},"security":[{"bearer":[]}],"tags":["Work orders"]}},"/line_items/{id}/inquiry":{"get":{"operationId":"work_order_line_item_inquiry","parameters":[{"description":"adds location_id, location_on_hand_hundredths, location_committed_hundredths for the order's location","in":"query","name":"per_location","required":false,"schema":{"type":"boolean"}},{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"part line inquiry (FoxPro [I] in the parts list): on hand, committed (derived from open orders), list price, the price at the customer's level, this order's net unit price; cost and margin (basis points) are null without costs.view; margin is null when the net price is 0"},"401":{"description":"unauthenticated"},"403":{"description":"the order is outside the user's location"},"404":{"description":"not found"},"422":{"description":"not a part line"}},"security":[{"bearer":[]}],"tags":["Work Orders"]}},"/locations":{"get":{"operationId":"locations_index","responses":{"200":{"content":{"application/json":{"schema":{"items":{"type":"object"},"type":"array"}}},"description":"location list"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden"}},"security":[{"bearer":[]}],"tags":["Locations"]},"post":{"operationId":"locations_create","requestBody":{"content":{"application/json":{"schema":{}}},"required":true},"responses":{"201":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"location created"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden"},"422":{"description":"invalid request"}},"security":[{"bearer":[]}],"tags":["Locations"]}},"/locations/{id}":{"get":{"operationId":"locations_show","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"location"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden"},"404":{"description":"not found"}},"security":[{"bearer":[]}],"tags":["Locations"]},"patch":{"operationId":"locations_update","parameters":[{"description":"accepted and ignored (plan 105: not in D8)","in":"header","name":"If-Match","required":false,"schema":{"type":["string","null"]}},{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"location updated"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden"},"404":{"description":"not found"},"412":{"description":"record changed since If-Match; body.current is the record now"},"422":{"description":"invalid request"}},"security":[{"bearer":[]}],"tags":["Locations"]}},"/locations/{id}/auto_reminders":{"get":{"operationId":"locations_auto_reminders_show","parameters":[{"description":"location id","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the setting: on/off, day and hour (the location's time), lead days, kind, channel, sender, stop reason, next run"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs customers.read)"},"404":{"description":"no such location, or not this user's"}},"security":[{"bearer":[]}],"tags":["Automatic reminders"]},"put":{"operationId":"locations_auto_reminders_set","parameters":[{"description":"location id","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"properties":{"channel":{"default":null,"description":"text_first, email_first, text_only or email_only","type":["string","null"]},"enabled":{"default":null,"description":"true turns the weekly run on (it then sends in your name); false turns it off","type":["boolean","null"]},"hour":{"default":null,"description":"Hour of the day in the location's time zone, 9 to 19","format":"int64","type":["integer","null"]},"kind":{"default":null,"description":"service, tires, inspection, other, or \"all\" for every kind","type":["string","null"]},"lead_days":{"default":null,"description":"Remind customers whose vehicle is due within this many days (0 to 60)","format":"int64","type":["integer","null"]},"weekday":{"default":null,"description":"Day of the week, 1 = Monday ... 7 = Sunday","format":"int64","type":["integer","null"]}},"required":[],"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the stored setting"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs campaigns.send and messages.send)"},"404":{"description":"no such location, or not this user's"},"422":{"description":"validation_failed: weekday, hour, lead_days, kind, channel"}},"security":[{"bearer":[]}],"tags":["Automatic reminders"]}},"/locations/{id}/auto_reminders/preview":{"get":{"operationId":"locations_auto_reminders_preview","parameters":[{"description":"location id","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the dry run: who would be sent to, by which channel, who is skipped and why, and three samples"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs customers.read)"},"404":{"description":"no such location, or not this user's"}},"security":[{"bearer":[]}],"tags":["Automatic reminders"]}},"/locations/{id}/company_setup":{"get":{"operationId":"company_setup_show","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the company setup document (FoxPro COOPTION shape)"},"401":{"description":"unauthenticated"},"403":{"description":"needs settings.manage"},"404":{"description":"no such location"}},"security":[{"bearer":[]}],"tags":["Workflow Config"]},"patch":{"operationId":"company_setup_update","parameters":[{"description":"accepted and ignored","in":"header","name":"If-Match","required":false,"schema":{"type":["string","null"]}},{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the document with the new control dates"},"401":{"description":"unauthenticated"},"403":{"description":"needs settings.manage"},"404":{"description":"no such location"},"422":{"description":"validation_failed, or posting_window_order: POST BACK TO is after POST UP TO"}},"security":[{"bearer":[]}],"tags":["Workflow Config"]}},"/locations/{id}/labour_cost_suggestion":{"get":{"operationId":"locations_labour_cost_suggestion","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"payroll's labour cost per hour over the last 13 weeks (plan 2415): suggestion (cents an hour) and hours_hundredths, or null with reason too_few_technicians | no_hours; computed on request, never stored"},"401":{"description":"unauthenticated"},"403":{"description":"needs payroll.view, and a person: agent tokens are refused"},"404":{"description":"no such location"}},"security":[{"bearer":[]}],"tags":["Locations"]}},"/locations/{id}/portal_counter":{"post":{"operationId":"locations_portal_counter","parameters":[{"description":"the location whose counter code it is","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the counter code's URL: { url }"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs settings.manage)"},"404":{"description":"location not found"}},"security":[{"bearer":[]}],"summary":"The counter's QR code (plan 1666; the settings page in plan 1667): `POST\n/locations/{id}/portal_counter` makes a new code and answers `{url}`, the\nsign-up page the QR opens. Only the code's hash is kept, so it is shown\nonce, when it is made.","tags":["Locations"]}},"/locations/{id}/settings":{"get":{"operationId":"location_settings_show","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the location's settings as rows: key, page, card, card_title, label, description, kind, value and editable, with the version they were read at"},"401":{"description":"unauthenticated"},"404":{"description":"no such location"}},"security":[{"bearer":[]}],"tags":["Settings"]},"patch":{"operationId":"location_settings_patch","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"properties":{"changes":{"additionalProperties":true,"default":{},"description":"The settings to change, keyed as `settings.show` returns them, each with its whole new\nvalue: `true` or `false` for a switch, text for a line or text setting","type":"object"},"expected_version":{"default":null,"description":"The version the caller read; when sent and no longer the latest, nothing is changed","format":"int64","type":["integer","null"]},"locale":{"default":null,"description":"The language the rows' words are rendered in, as an `Accept-Language` tag","type":["string","null"]}},"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the location's settings after the change, as the GET answers them; body: changes (each setting's key with its new value: true/false for a switch, text for a line or text) and optionally expected_version"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs settings.manage)"},"404":{"description":"no such location"},"409":{"description":"expected_version is not the latest version"},"422":{"description":"validation_failed: an unknown key, a wrong type or a refused value, keyed by the setting's key"}},"security":[{"bearer":[]}],"tags":["Settings"]}},"/locations/{id}/tire_labour":{"get":{"operationId":"locations_tire_labour","parameters":[{"description":"location id","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"{location_id, bands, rows}: each tire job's hours per tire by band, Wenmar's and the location's own (shop_hundredths, null when not set)"},"401":{"description":"unauthenticated"},"404":{"description":"not found"}},"security":[{"bearer":[]}],"tags":["Locations"]}},"/locations/{id}/workflow_config":{"get":{"operationId":"workflow_config_show","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the location's workflow config"},"401":{"description":"unauthenticated"},"404":{"description":"no such location"}},"security":[{"bearer":[]}],"tags":["Workflow Config"]},"patch":{"operationId":"workflow_config_patch","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"properties":{"changes":{"default":null,"description":"The keys to change, each with its whole new value, as `location_workflow_configs.show`\nreturns them under `config` (for example `tax`, `labor_rates`, `numbering`,\n`min_margin_hundredths`, `documents`, `fees`). A key left out is not changed. `fees`\nholds the shop-supplies rule: `shop_supplies` with description, percent_bp,\npercent_of, cap_cents and taxable; null removes the rule"},"expected_version":{"default":null,"description":"The version the caller read; when sent and no longer the latest, nothing is changed","format":"int64","type":["integer","null"]}},"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the location's workflow config after the change; body: changes (the keys of config to replace, each with its whole value) and optionally expected_version"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs settings.manage)"},"404":{"description":"no such location"},"409":{"description":"expected_version is not the latest version"},"422":{"description":"validation_failed: an unknown key or an invalid value"}},"security":[{"bearer":[]}],"tags":["Workflow Config"]}},"/mailbox":{"get":{"operationId":"mailbox_status","responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the shop's mailbox status; `{}` when the shop has no mailbox"}},"security":[{"bearer":[]}],"summary":"`GET /mailbox` (plan 2606): the shop's own mailbox status, for the Messages area's banner\nwhile the mailbox is failing. Never a registry tool: the mailbox is not a tool (2605's\nrule), so a person reads it here. `{}` when the shop has no mailbox.","tags":["Messages"]}},"/manual_invoices/number/{number}":{"get":{"operationId":"manual_invoices_number","parameters":[{"in":"path","name":"number","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"whether the invoice number is used, and by whom"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs work_orders.post)"},"404":{"description":"not found"},"409":{"description":"conflict"},"422":{"description":"invalid"}},"security":[{"bearer":[]}],"tags":["Customers"]}},"/me/ring":{"post":{"operationId":"me_ring","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RingRequest"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"`{sent, devices}`: the push went to the user's paired phones"},"409":{"description":"no_phone_paired: this user has no paired phone to ring"},"422":{"description":"validation_failed: the number to ring"}},"security":[{"bearer":[]}],"summary":"`POST /me/ring` (plan 2646): ring your own phone with a number to call — the push opens the\ndialer with it. A user's own device surface, never an agent's.","tags":["Messages"]}},"/messages/recipients":{"get":{"operationId":"messages_recipients","parameters":[{"description":"The name, number, phone or e-mail to match (customers and drivers together).","in":"query","name":"q","required":false,"schema":{"type":["string","null"]}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"`{data}`: the customers and drivers that match, each with how it can be reached (text, e-mail, call)"},"403":{"description":"needs customers.read"}},"security":[{"bearer":[]}],"summary":"`GET /messages/recipients?q=` (plan 2642): the New message dialog's search. Customers and\ndrivers together, each with how it can be reached. A read helper, not a registry tool.","tags":["Messages"]}},"/messages/{id}/cancel":{"post":{"operationId":"messages_cancel","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"`{message}` cancelled"},"422":{"description":"not_cancellable"}},"security":[{"bearer":[]}],"tags":["Messages"]}},"/messages/{id}/handed-to-phone":{"post":{"operationId":"messages_handed_to_phone","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"`{message, compose}`"},"422":{"description":"not_handable, recipient_opted_out"}},"security":[{"bearer":[]}],"tags":["Messages"]}},"/messages/{id}/resend":{"post":{"operationId":"messages_resend","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"`{message}` queued again"},"422":{"description":"not_resendable, recipient_opted_out, no_contact"}},"security":[{"bearer":[]}],"tags":["Messages"]}},"/package_lines/{id}":{"delete":{"operationId":"package_lines_delete","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"204":{"description":"package line deleted"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized"},"404":{"description":"not found"}},"security":[{"bearer":[]}],"tags":["Packages"]},"patch":{"operationId":"package_lines_update","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"package line updated"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized"},"404":{"description":"not found"},"422":{"description":"validation failed"}},"security":[{"bearer":[]}],"tags":["Packages"]}},"/packages":{"get":{"operationId":"packages_index","parameters":[{"description":"match package name, case-insensitive","in":"query","name":"q","required":false,"schema":{"type":"string"}},{"description":"`code`: FoxPro order: imported packages by their FoxPro code, then by package number; default: id order","in":"query","name":"sort","required":false,"schema":{"type":"string"}},{"description":"exact package number; `q`, `sort` and the page are ignored with it","in":"query","name":"code","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"items":{"type":"object"},"type":"array"}}},"description":"package list"},"401":{"description":"unauthenticated"}},"security":[{"bearer":[]}],"tags":["Packages"]},"post":{"operationId":"packages_create","requestBody":{"content":{"application/json":{"schema":{"type":"object"}}},"required":true},"responses":{"201":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"package created"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized"},"409":{"description":"conflict"},"422":{"description":"validation failed"}},"security":[{"bearer":[]}],"tags":["Packages"]}},"/packages/{id}":{"delete":{"operationId":"packages_delete","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"204":{"description":"package deleted"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized"},"404":{"description":"not found"}},"security":[{"bearer":[]}],"tags":["Packages"]},"get":{"operationId":"packages_show","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"package with line items"},"401":{"description":"unauthenticated"},"404":{"description":"not found"}},"security":[{"bearer":[]}],"tags":["Packages"]},"patch":{"operationId":"packages_update","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"package updated"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized"},"404":{"description":"not found"},"409":{"description":"conflict"},"422":{"description":"validation failed"}},"security":[{"bearer":[]}],"tags":["Packages"]}},"/packages/{id}/lines":{"post":{"operationId":"package_lines_create","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object"}}},"required":true},"responses":{"201":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"package line created"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized"},"404":{"description":"package not found"},"422":{"description":"validation failed"}},"security":[{"bearer":[]}],"tags":["Packages"]}},"/packages/{id}/lines/preview":{"post":{"operationId":"package_lines_preview","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the line as it would be stored (`line`) and its warnings (`warnings`); nothing is written"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized"},"404":{"description":"package or line not found"},"422":{"description":"validation failed"}},"security":[{"bearer":[]}],"tags":["Packages"]}},"/pages/counts":{"get":{"operationId":"pages_counts","parameters":[{"description":"the location the location-scoped counts are taken at; without one, the caller's home location, else every location","in":"query","name":"location_id","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"`{ counts: { <page>: n } }`: one number per page the caller may open, each the length of that page's default list; a page the caller may not open is left out"},"401":{"description":"unauthenticated"},"404":{"description":"location not found"}},"security":[{"bearer":[]}],"tags":["Pages"]}},"/part_aliases/{id}":{"delete":{"operationId":"part_aliases_delete","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"204":{"description":"the number no longer finds the part"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs catalog.write)"},"404":{"description":"not found"}},"security":[{"bearer":[]}],"tags":["Parts"]},"get":{"operationId":"part_aliases_show","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the part alias"},"401":{"description":"unauthenticated"},"404":{"description":"not found"}},"security":[{"bearer":[]}],"tags":["Parts"]}},"/part_class_rows":{"get":{"operationId":"part_class_rows_index","responses":{"200":{"content":{"application/json":{"schema":{"items":{"type":"object"},"type":"array"}}},"description":"every part class as { code, description }, in code order"},"401":{"description":"unauthenticated"}},"security":[{"bearer":[]}],"tags":["Parts"]}},"/part_classes":{"get":{"operationId":"part_classes_index","parameters":[{"description":"true: the class file rows (code, description, pricing_basis, five margins) in code order","in":"query","name":"full","required":false,"schema":{"type":"boolean"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"distinct part classes in use, sorted; the class file with full=true"},"401":{"description":"unauthenticated"}},"security":[{"bearer":[]}],"tags":["Parts"]}},"/part_classes/{code}":{"delete":{"operationId":"part_class_delete","parameters":[{"in":"path","name":"code","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"deleted"},"401":{"description":"unauthenticated"},"403":{"description":"needs catalog.write"},"404":{"description":"no such class"},"409":{"description":"a live part has the class"}},"security":[{"bearer":[]}],"summary":"`DELETE /part_classes/{code}` — refused while a live part has the class.","tags":["Parts"]},"get":{"operationId":"part_class_show","parameters":[{"in":"path","name":"code","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the class"},"401":{"description":"unauthenticated"},"404":{"description":"no such class"}},"security":[{"bearer":[]}],"summary":"`GET /part_classes/{code}` — one row of the class file, with `in_use`.","tags":["Parts"]},"put":{"operationId":"part_class_put","parameters":[{"in":"path","name":"code","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the class as stored"},"401":{"description":"unauthenticated"},"403":{"description":"needs catalog.write"},"422":{"description":"invalid request"}},"security":[{"bearer":[]}],"summary":"`PUT /part_classes/{code}` — `INVCLASS` `[S]tore`.","tags":["Parts"]}},"/part_fitments/{id}":{"delete":{"operationId":"part_fitment_delete","parameters":[{"description":"the fitment row","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"properties":{},"required":[],"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the trashed row `{id, part_id, status, trashed_at}`"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs catalog.write)"},"404":{"description":"no such fitment row"}},"security":[{"bearer":[]}],"tags":["Parts"]},"patch":{"operationId":"part_fitment_update","parameters":[{"description":"the fitment row","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"properties":{"engine_or_trim":{"default":null,"description":"The engine or trim; absent = unchanged, null = cleared","type":["string","null"]},"make":{"default":null,"description":"The make; absent = unchanged","type":["string","null"]},"model":{"default":null,"description":"The model; absent = unchanged","type":["string","null"]},"note":{"default":null,"description":"The note; absent = unchanged, null = cleared","type":["string","null"]},"position":{"default":null,"description":"The position; absent = unchanged, null = cleared","type":["string","null"]},"year_from":{"default":null,"description":"The first year; absent = unchanged, null = cleared","format":"int64","type":["integer","null"]},"year_to":{"default":null,"description":"The last year; absent = unchanged, null = cleared","format":"int64","type":["integer","null"]}},"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the fitment row"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs catalog.write)"},"404":{"description":"no such fitment row"},"422":{"description":"validation_failed: make, model, year_from, year_to"}},"security":[{"bearer":[]}],"tags":["Parts"]}},"/part_number_rules":{"get":{"operationId":"part_number_rules_index","responses":{"200":{"content":{"application/json":{"schema":{"items":{"type":"object"},"type":"array"}}},"description":"every base-number rule, in the order they are tried"},"401":{"description":"unauthenticated"}},"security":[{"bearer":[]}],"tags":["Part number rules"]},"post":{"operationId":"part_number_rules_create","parameters":[{"description":"replays the first create with this key","in":"header","name":"idempotency-key","required":false,"schema":{"type":["string","null"]}}],"requestBody":{"content":{"application/json":{"schema":{}}},"required":true},"responses":{"201":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"base-number rule created"},"401":{"description":"unauthenticated"},"403":{"description":"needs catalog.write"},"422":{"description":"invalid request"}},"security":[{"bearer":[]}],"tags":["Part number rules"]}},"/part_number_rules/{id}":{"delete":{"operationId":"part_number_rules_delete","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"204":{"description":"rule deleted; the next backfill clears the base numbers it gave"},"401":{"description":"unauthenticated"},"403":{"description":"needs catalog.write"},"404":{"description":"not found"}},"security":[{"bearer":[]}],"tags":["Part number rules"]},"get":{"operationId":"part_number_rules_show","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"one base-number rule"},"401":{"description":"unauthenticated"},"404":{"description":"not found"}},"security":[{"bearer":[]}],"tags":["Part number rules"]},"patch":{"operationId":"part_number_rules_update","parameters":[{"description":"ETag from the last read (plan 105)","in":"header","name":"If-Match","required":false,"schema":{"type":["string","null"]}},{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"base-number rule updated"},"401":{"description":"unauthenticated"},"403":{"description":"needs catalog.write"},"404":{"description":"not found"},"412":{"description":"record changed since If-Match; body.current is the record now"},"422":{"description":"invalid request"}},"security":[{"bearer":[]}],"tags":["Part number rules"]}},"/part_quick_add_defaults":{"get":{"operationId":"part_quick_add_defaults","responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"what the quick add box starts with: `sales_account` and `cos_account` of the last part in number order that has one (FoxPro INVADD); null when none"},"401":{"description":"unauthenticated"}},"security":[{"bearer":[]}],"tags":["Parts"]}},"/part_receipts":{"get":{"operationId":"part_receipts_index","parameters":[{"description":"first received date, YYYY-MM-DD","in":"query","name":"from","required":false,"schema":{"type":"string"}},{"description":"last received date, YYYY-MM-DD","in":"query","name":"to","required":false,"schema":{"type":"string"}},{"description":"only this vendor's receipts","in":"query","name":"vendor_id","required":false,"schema":{"format":"int64","type":"integer"}},{"description":"receipts with a line of this part","in":"query","name":"part_id","required":false,"schema":{"format":"int64","type":"integer"}},{"description":"only this location's receipts","in":"query","name":"location_id","required":false,"schema":{"format":"int64","type":"integer"}},{"description":"true: include voided receipts","in":"query","name":"include_voided","required":false,"schema":{"type":"boolean"}},{"description":"1-100, default 50","in":"query","name":"limit","required":false,"schema":{"format":"int64","type":"integer"}},{"description":"rows to skip","in":"query","name":"offset","required":false,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"`{data, total, next_offset}`: receipts newest date first, each with line_count and total_landed_cents"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs costs.view)"},"422":{"description":"validation_failed: from, to"}},"security":[{"bearer":[]}],"tags":["Parts"]},"post":{"operationId":"part_receipts_create","requestBody":{"content":{"application/json":{"schema":{"properties":{"lines":{"default":[],"description":"One or more lines","items":{"properties":{"duty_bp":{"default":null,"description":"Duty in basis points; absent = the part's own","format":"int64","type":["integer","null"]},"exchange_bp":{"default":null,"description":"Exchange in basis points (2.50 % = 250); absent = the part's own","format":"int64","type":["integer","null"]},"other_bp":{"default":null,"description":"Other landed charges in basis points; absent = the part's own","format":"int64","type":["integer","null"]},"part_id":{"default":null,"description":"The part received (a stocked part)","format":"int64","type":["integer","null"]},"purchase_order_line_id":{"default":null,"description":"The purchase-order line this receives (plan 1577): absent part, job line and cost\ncome from it, and the receipt takes the PO's vendor","format":"int64","type":["integer","null"]},"quantity_hundredths":{"description":"Quantity received in hundredths (2 units = 200), more than zero","format":"int64","type":"integer"},"unit_cost_cents":{"default":null,"description":"The vendor's unit price in cents (first cost). Absent: the vendor's last cost for the\npart, else the part's last receipt first cost, else its catalogue first cost. Typing\none needs costs.view","format":"int64","type":["integer","null"]},"work_order_line_item_id":{"default":null,"description":"The work-order line this part is for; it becomes received","format":"int64","type":["integer","null"]}},"required":["quantity_hundredths"],"type":"object"},"type":"array"},"location_id":{"default":null,"description":"Where the parts arrived; absent = the user's location","format":"int64","type":["integer","null"]},"notes":{"default":null,"type":["string","null"]},"received_on":{"default":null,"description":"The date received, YYYY-MM-DD; absent = the location's today","type":["string","null"]},"vendor_id":{"default":null,"description":"The vendor they came from","format":"int64","type":["integer","null"]},"vendor_invoice_number":{"default":null,"description":"The vendor's invoice or packing-slip number","type":["string","null"]}},"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the receipt with its lines; cost keys null without costs.view"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs inventory.count; a typed unit_cost_cents also needs costs.view)"},"422":{"description":"validation_failed: location_id, vendor_id, vendor_invoice_number, received_on, date_code, notes, lines; idempotency_key_reused"}},"security":[{"bearer":[]}],"tags":["Parts"]}},"/part_receipts/{id}":{"get":{"operationId":"part_receipts_show","parameters":[{"description":"receipt id","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the receipt with its lines"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs costs.view)"},"404":{"description":"no such receipt"}},"security":[{"bearer":[]}],"tags":["Parts"]}},"/part_receipts/{id}/bill":{"post":{"operationId":"part_receipts_link_bill","parameters":[{"description":"receipt id","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"properties":{"bill_id":{"default":null,"description":"The bill it belongs to; `null` unlinks","format":"int64","type":["integer","null"]}},"required":[],"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the receipt, with its bill_id (null when unlinked)"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs ledger.manage and costs.view)"},"404":{"description":"no such receipt or bill"},"409":{"description":"conflict: a voided receipt or bill"},"422":{"description":"validation_failed: bill_id (not_found, other_vendor)"}},"security":[{"bearer":[]}],"tags":["Parts"]}},"/part_receipts/{id}/void":{"post":{"operationId":"part_receipts_void","parameters":[{"description":"receipt id","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the voided receipt"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs inventory.count and costs.view)"},"404":{"description":"no such receipt"},"409":{"description":"conflict: already void"}},"security":[{"bearer":[]}],"tags":["Parts"]}},"/part_requests":{"get":{"operationId":"part_requests_index","parameters":[{"description":"open, ordered, here, cancelled, active (open and ordered; the default) or all","in":"query","name":"state","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"items":{"type":"object"},"type":"array"}}},"description":"part requests on every order the caller may see, oldest first"},"401":{"description":"unauthenticated"},"422":{"description":"unknown state"}},"security":[{"bearer":[]}],"tags":["Work Orders"]}},"/part_requests/{id}":{"get":{"operationId":"part_requests_show","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"part request"},"401":{"description":"unauthenticated"},"403":{"description":"another location's work order"},"404":{"description":"not found"}},"security":[{"bearer":[]}],"tags":["Work Orders"]},"patch":{"operationId":"part_requests_update","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CrudBody"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"part request updated (attrs: body, state, note); a new state tells the technician"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized or another location's work order"},"404":{"description":"not found"},"409":{"description":"already_posted or work_order_not_editable"},"422":{"description":"invalid request"}},"security":[{"bearer":[]}],"tags":["Work Orders"]}},"/part_types":{"get":{"operationId":"part_types_index","responses":{"200":{"content":{"application/json":{"schema":{"items":{"type":"object"},"type":"array"}}},"description":"the part types, by group and name"},"401":{"description":"unauthenticated"}},"security":[{"bearer":[]}],"tags":["Part types"]}},"/part_types/{id}":{"get":{"operationId":"part_types_show","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the part type"},"401":{"description":"unauthenticated"},"404":{"description":"not found"}},"security":[{"bearer":[]}],"tags":["Part types"]}},"/part_vendors/{id}":{"delete":{"operationId":"part_vendors_delete","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"204":{"description":"the vendor is no longer a vendor of the part"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs catalog.write)"},"404":{"description":"not found"}},"security":[{"bearer":[]}],"tags":["Parts"]},"get":{"operationId":"part_vendors_show","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the part vendor"},"401":{"description":"unauthenticated"},"404":{"description":"not found"}},"security":[{"bearer":[]}],"tags":["Parts"]},"patch":{"operationId":"part_vendors_update","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"part vendor updated"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs catalog.write)"},"404":{"description":"not found"},"422":{"description":"invalid request"}},"security":[{"bearer":[]}],"tags":["Parts"]}},"/parts":{"get":{"operationId":"parts_index","parameters":[{"description":"match part number or name, case-insensitive","in":"query","name":"q","required":false,"schema":{"type":"string"}},{"description":"exact part number (trimmed, case-insensitive); 0 or 1 rows","in":"query","name":"number","required":false,"schema":{"type":"string"}},{"description":"`list`: product search (FoxPro INVSCAN) with the list price as `price_cents`. With `price` or `customer_id`, `number` also matches the three vendor part numbers, the rows are in class-code then number order, and each row gains `class_code`, `product_line`, `price_cents`, `price_level`","in":"query","name":"price","required":false,"schema":{"type":"string"}},{"description":"product search with the price at this customer's level as `price_cents` (no discount)","in":"query","name":"customer_id","required":false,"schema":{"type":"string"}},{"description":"each row gains location_on_hand_hundredths: the part's on hand at that location. A comma list names several (every one must exist); the column shows the first","in":"query","name":"location_id","required":false,"schema":{"type":"string"}},{"description":"plan 2512: `low` (at or below its reorder point at the location, else the caller's home location, else every location summed), `on_order` (an open purchase-order line with quantity still to receive) or `archived`; a comma list is any of them (`state=low,archived`); with `q`, the rows are those states' parts that also match","in":"query","name":"state","required":false,"schema":{"type":"string"}},{"description":"plan 2570: the vehicle the search is for; each row gains `fit` and fitting parts rank first","in":"query","name":"vehicle_id","required":false,"schema":{"type":"string"}},{"description":"product search: contained in the name","in":"query","name":"name","required":false,"schema":{"type":"string"}},{"description":"product search: contained in one of the class codes (a comma list is any of them)","in":"query","name":"class","required":false,"schema":{"type":"string"}},{"description":"product search: contained in one of the product line codes (a comma list is any of them)","in":"query","name":"product_line","required":false,"schema":{"type":"string"}},{"description":"product search: contained in the notes","in":"query","name":"notes","required":false,"schema":{"type":"string"}},{"description":"plain list only; a lookup or search keeps its own order. `number`: part number. `description`: name A–Z. `on_hand`: quantity on hand","in":"query","name":"sort","required":false,"schema":{"type":"string"}},{"description":"`asc` (default) or `desc`; the direction of `sort` (plain list only)","in":"query","name":"dir","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"items":{"type":"object"},"type":"array"}}},"description":"part list"},"401":{"description":"unauthenticated"},"422":{"description":"price is not `list`, customer_id is not a number, state is not `low`, `on_order` or `archived`, an unknown sort, or an invalid dir"}},"security":[{"bearer":[]}],"tags":["Parts"]},"post":{"operationId":"parts_create","parameters":[{"description":"replays the first create with this key","in":"header","name":"idempotency-key","required":false,"schema":{"type":["string","null"]}},{"description":"`1`: only the checks of before plan 1309, no `warnings` (the FoxPro view)","in":"query","name":"legacy_validation","required":false,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{}}},"required":true},"responses":{"201":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"part created"},"401":{"description":"unauthenticated"},"403":{"description":"needs catalog.write"},"409":{"description":"part number already exists"},"422":{"description":"invalid request"}},"security":[{"bearer":[]}],"tags":["Parts"]}},"/parts/by_number":{"get":{"operationId":"parts_by_number","parameters":[{"description":"parts whose number is greater, nearest first (FoxPro PgDn)","in":"query","name":"after","required":false,"schema":{"type":"string"}},{"description":"parts whose number is less, nearest first (FoxPro PgUp)","in":"query","name":"before","required":false,"schema":{"type":"string"}},{"description":"1 to 100, default 1","in":"query","name":"limit","required":false,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"items":{"type":"object"},"type":"array"}}},"description":"live parts in part-number order from a number"},"401":{"description":"unauthenticated"},"422":{"description":"after and before both sent, or a bad limit"}},"security":[{"bearer":[]}],"tags":["Parts"]}},"/parts/counts":{"get":{"operationId":"parts_counts","parameters":[{"description":"the `low` count at that location; without one, the caller's home location, else every location summed","in":"query","name":"location_id","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the parts list's state counts: `{ all, low, on_order, archived }`; `all` is today's default list (the non-archived parts)"},"401":{"description":"unauthenticated"},"404":{"description":"location not found"}},"security":[{"bearer":[]}],"tags":["Parts"]}},"/parts/{id}":{"get":{"operationId":"parts_show","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"part; `stock` lists the figures per location"},"401":{"description":"unauthenticated"},"404":{"description":"not found"}},"security":[{"bearer":[]}],"tags":["Parts"]},"patch":{"operationId":"parts_update","parameters":[{"description":"ETag from the last read (plan 105)","in":"header","name":"If-Match","required":false,"schema":{"type":["string","null"]}},{"description":"`1`: only the checks of before plan 1309, no `warnings` (the FoxPro view)","in":"query","name":"legacy_validation","required":false,"schema":{"type":"string"}},{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"part updated"},"401":{"description":"unauthenticated"},"403":{"description":"needs catalog.write"},"404":{"description":"not found"},"409":{"description":"part number already exists"},"412":{"description":"record changed since If-Match; body.current is the record now"},"422":{"description":"invalid request"}},"security":[{"bearer":[]}],"tags":["Parts"]}},"/parts/{id}/adjustments":{"post":{"operationId":"parts_adjustments_create","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the confirmed changes applied in one transaction: average cost, quantity on hand, one adjustment movement recording what was applied, the cost on open lines; movement_id null when nothing was applied"},"401":{"description":"unauthenticated"},"403":{"description":"needs inventory.count; a changed cost also needs costs.view"},"404":{"description":"part not found"},"422":{"description":"date refused (details.date_code: before_window, after_window, empty, invalid) or negative cost"}},"security":[{"bearer":[]}],"tags":["Parts"]}},"/parts/{id}/adjustments/preview":{"post":{"operationId":"parts_adjustments_preview","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"which of the keyed average cost and quantity on hand differ from the part, and the date check (FoxPro INVADJ); nothing is written; average_cost_cents is null and cost_changed false without costs.view; location_id is the location whose stock it sets"},"401":{"description":"unauthenticated"},"403":{"description":"needs inventory.count; a changed cost also needs costs.view"},"404":{"description":"part not found"},"422":{"description":"negative cost"}},"security":[{"bearer":[]}],"tags":["Parts"]}},"/parts/{id}/aliases":{"get":{"operationId":"parts_aliases","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"items":{"type":"object"},"type":"array"}}},"description":"the part's other numbers: vendor, alternate, superseded, barcode, interchange"},"401":{"description":"unauthenticated"},"404":{"description":"part not found"}},"security":[{"bearer":[]}],"tags":["Parts"]},"post":{"operationId":"parts_aliases_create","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{}}},"required":true},"responses":{"201":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"number added; a work-order line or `GET /parts?q=` with it, ignoring case, spaces, dots and dashes, finds the part"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs catalog.write)"},"404":{"description":"part not found"},"409":{"description":"that kind and number is already on a part"},"422":{"description":"invalid request"}},"security":[{"bearer":[]}],"tags":["Parts"]}},"/parts/{id}/archive":{"post":{"operationId":"part_archive","parameters":[{"description":"true: only test whether the part may be archived; nothing is written","in":"query","name":"check","required":false,"schema":{"type":"boolean"}},{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the part, archived when it may be"},"401":{"description":"unauthenticated"},"403":{"description":"needs catalog.write"},"404":{"description":"not found"},"409":{"description":"a quantity is not 0, or the part is on an open order"}},"security":[{"bearer":[]}],"summary":"`POST /parts/{id}/archive` — `INVEDIT` `[Del]`. `?check=true` only reports\nwhether the part may be archived (plan 597's Del press) and writes nothing.","tags":["Parts"]}},"/parts/{id}/attachments":{"get":{"operationId":"part_attachment_index","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the part's photos, newest first"},"401":{"description":"unauthenticated"},"404":{"description":"part not found"}},"security":[{"bearer":[]}],"tags":["Attachments"]},"post":{"operationId":"part_attachment_create","parameters":[{"description":"replays the first stage with this key","in":"header","name":"idempotency-key","required":false,"schema":{"type":["string","null"]}},{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateAttachmentBody"}}},"required":true},"responses":{"200":{"description":"replayed"},"201":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"a photo of the part staged: {attachment, upload}, as for a work order"},"401":{"description":"unauthenticated"},"403":{"description":"needs catalog.write, inventory.count or work_orders.write"},"404":{"description":"part not found"},"422":{"description":"invalid request"}},"security":[{"bearer":[]}],"tags":["Attachments"]}},"/parts/{id}/card":{"get":{"operationId":"parts_card","parameters":[{"description":"adds `location` (that location's on hand, committed, reorder levels and bin) and `stock` (every location)","in":"query","name":"location_id","required":false,"schema":{"format":"int64","type":"integer"}},{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the part as FoxPro's Product Inquiry card shows it: the part body (landed cost computed) plus class, product-line, G/L account and vendor descriptions, committed_hundredths (derived from open orders), on_order_hundredths, adjust_default_cost_cents; cost keys null without costs.view"},"401":{"description":"unauthenticated"},"404":{"description":"part or location not found"}},"security":[{"bearer":[]}],"tags":["Parts"]}},"/parts/{id}/fit":{"get":{"operationId":"part_fit","parameters":[{"description":"the part","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}},{"description":"the vehicle","in":"query","name":"vehicle_id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"`{part_id, vehicle_id, fit, typed_row_id, installed_times, last_posted_on}`; `fit` is typed, installed, both, or unknown (a warning, never a block)"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized"},"404":{"description":"no such part or vehicle"}},"security":[{"bearer":[]}],"tags":["Parts"]}},"/parts/{id}/fitments":{"get":{"operationId":"part_fitments_index","parameters":[{"description":"the part","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"`{part_id, typed: [...], installed: [{year, make, model, engine, times, last_posted_on}]}`"},"401":{"description":"unauthenticated"},"404":{"description":"no such part"}},"security":[{"bearer":[]}],"tags":["Parts"]},"post":{"operationId":"part_fitments_create","parameters":[{"description":"the part","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"properties":{"engine_or_trim":{"default":null,"description":"The engine or trim, when the fit depends on it","type":["string","null"]},"make":{"default":null,"description":"The make (required)","type":["string","null"]},"model":{"default":null,"description":"The model (required)","type":["string","null"]},"note":{"default":null,"description":"A note for the next person","type":["string","null"]},"position":{"default":null,"description":"Where the part goes (e.g. \"left front\")","type":["string","null"]},"year_from":{"default":null,"description":"The first year that fits; absent = no lower bound","format":"int64","type":["integer","null"]},"year_to":{"default":null,"description":"The last year that fits; absent = no upper bound","format":"int64","type":["integer","null"]}},"type":"object"}}},"required":false},"responses":{"201":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the fitment row"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs catalog.write)"},"404":{"description":"no such part"},"422":{"description":"validation_failed: make, model, year_from, year_to"}},"security":[{"bearer":[]}],"tags":["Parts"]}},"/parts/{id}/fox_history":{"get":{"operationId":"parts_fox_history","parameters":[{"description":"page of FoxPro's history view, from 1 (default 1; a page past the end returns the last page)","in":"query","name":"page","required":false,"schema":{"format":"int64","type":"integer"}},{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the part's stock history as FoxPro's history view (INVINQ [H]istory): entries newest date first, each with its screen row and its one or two formatted lines; cost cells blank without costs.view"},"401":{"description":"unauthenticated"},"404":{"description":"part not found"},"422":{"description":"page below 1"}},"security":[{"bearer":[]}],"tags":["Parts"]}},"/parts/{id}/movements":{"get":{"operationId":"parts_movements","parameters":[{"description":"first date, YYYY-MM-DD (inclusive)","in":"query","name":"from","required":false,"schema":{"type":"string"}},{"description":"last date, YYYY-MM-DD (inclusive)","in":"query","name":"to","required":false,"schema":{"type":"string"}},{"description":"rows returned, newest first (default 500, max 2000)","in":"query","name":"limit","required":false,"schema":{"format":"int64","type":"integer"}},{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"part stock history (FoxPro INVINQ [H]istory) with opening/closing on hand"},"401":{"description":"unauthenticated"},"404":{"description":"part not found"},"422":{"description":"bad date or range"}},"security":[{"bearer":[]}],"tags":["Parts"]}},"/parts/{id}/open_lines":{"get":{"operationId":"parts_open_lines","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"items":{"type":"object"},"type":"array"}}},"description":"the part's lines on open (unposted) work orders — FoxPro INVINQ [S]ervice; each row has customer_number and customer_name"},"401":{"description":"unauthenticated"},"404":{"description":"part not found"}},"security":[{"bearer":[]}],"tags":["Parts"]}},"/parts/{id}/recalc_prices":{"post":{"operationId":"part_recalc_prices","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the part with the new prices"},"401":{"description":"unauthenticated"},"403":{"description":"needs catalog.write"},"404":{"description":"not found"},"422":{"description":"no class, or the class is not in the class file"}},"security":[{"bearer":[]}],"summary":"`POST /parts/{id}/recalc_prices` — `INVEDIT` `[R]ecalc`.","tags":["Parts"]}},"/parts/{id}/renumber":{"post":{"operationId":"part_renumber","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the part with the new number"},"401":{"description":"unauthenticated"},"403":{"description":"needs catalog.write"},"404":{"description":"not found"},"409":{"description":"the number is in use"},"422":{"description":"blank number"}},"security":[{"bearer":[]}],"summary":"`POST /parts/{id}/renumber` — `INVEDIT` `[C]hange#`.","tags":["Parts"]}},"/parts/{id}/stock":{"get":{"operationId":"parts_stock","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"items":{"type":"object"},"type":"array"}}},"description":"the part's stock per location, location order: [{ location_id, on_hand_qty_hundredths, reorder_point_hundredths, reorder_qty_hundredths, bin_location }]; a user limited to a home location sees that location only. The part body's on_hand_qty_hundredths is the sum, its reorder and bin keys the first location's"},"401":{"description":"unauthenticated"},"404":{"description":"part not found"}},"security":[{"bearer":[]}],"tags":["Parts"]}},"/parts/{id}/stock/{location_id}":{"patch":{"operationId":"parts_stock_update","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}},{"in":"path","name":"location_id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the location's figures after the change; only reorder_point_hundredths, reorder_qty_hundredths and bin_location may be sent"},"401":{"description":"unauthenticated"},"403":{"description":"needs catalog.write, or the location is outside the user's scope"},"404":{"description":"part or location not found"},"422":{"description":"invalid value, unknown key, or on_hand_qty_hundredths (code use_adjustment)"}},"security":[{"bearer":[]}],"tags":["Parts"]}},"/parts/{id}/vendors":{"get":{"operationId":"parts_vendors","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"items":{"type":"object"},"type":"array"}}},"description":"the part's vendors, preferred first"},"401":{"description":"unauthenticated"},"404":{"description":"part not found"}},"security":[{"bearer":[]}],"tags":["Parts"]},"post":{"operationId":"parts_vendors_create","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{}}},"required":true},"responses":{"201":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"vendor added; `rank` defaults to after the last; ranks 1-3 are the FoxPro vendor slots"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs catalog.write)"},"404":{"description":"part not found"},"409":{"description":"vendor already on the part"},"422":{"description":"invalid request"}},"security":[{"bearer":[]}],"tags":["Parts"]}},"/pay_lines":{"get":{"operationId":"pay_lines_index","parameters":[{"description":"one employee's lines","in":"query","name":"employee_id","required":false,"schema":{"format":"int64","type":"integer"}},{"description":"exactly this cheque or deposit number","in":"query","name":"cheque_number","required":false,"schema":{"type":"string"}},{"description":"the run's pay date on or after, YYYY-MM-DD","in":"query","name":"from","required":false,"schema":{"type":"string"}},{"description":"the run's pay date on or before, YYYY-MM-DD","in":"query","name":"to","required":false,"schema":{"type":"string"}},{"description":"open | issued | posted; absent = every status","in":"query","name":"status","required":false,"schema":{"type":"string"}},{"description":"true: cancelled lines too; absent: uncancelled only","in":"query","name":"include_cancelled","required":false,"schema":{"type":"boolean"}},{"description":"1-100, default 50","in":"query","name":"limit","required":false,"schema":{"format":"int64","type":"integer"}},{"description":"rows to skip","in":"query","name":"offset","required":false,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"`{data, total, next_offset}` of pay lines, oldest pay date first; the amount fields null without payroll.manage"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs payroll.view)"},"422":{"description":"validation_failed: from, to"}},"security":[{"bearer":[]}],"tags":["Payroll"]}},"/pay_lines/{id}":{"delete":{"operationId":"pay_lines_remove","parameters":[{"description":"pay line id","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"`{pay_line_id, deleted, run_deleted}`: a run whose last line is removed is deleted with it"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs payroll.manage)"},"404":{"description":"no such line"},"409":{"description":"conflict: the run is not open"}},"security":[{"bearer":[]}],"tags":["Payroll"]},"get":{"operationId":"pay_lines_show","parameters":[{"description":"pay line id","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the pay line; the amount fields null without payroll.manage"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs payroll.view)"},"404":{"description":"no such line"}},"security":[{"bearer":[]}],"tags":["Payroll"]},"patch":{"operationId":"pay_lines_update","parameters":[{"description":"pay line id","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"bonus_cents":{"format":"int64","type":["integer","null"]},"commission_cents":{"format":"int64","type":["integer","null"]},"items":{"description":"Replaces the line's items when given","items":{"additionalProperties":false,"properties":{"account":{"default":null,"type":["string","null"]},"amount_cents":{"default":null,"description":"A fixed amount in cents; or give percent_bp","format":"int64","type":["integer","null"]},"employee_pay_item_id":{"default":null,"description":"The employee's recurring item this line item comes from (keeps its limit)","format":"int64","type":["integer","null"]},"kind":{"default":"","description":"earning, deduction or benefit","type":"string"},"name":{"default":"","type":"string"},"percent_bp":{"default":null,"description":"A share of base gross in basis points (3% = 300)","format":"int64","type":["integer","null"]},"t4_box":{"default":"","type":"string"},"taxable":{"default":null,"description":"Earnings: part of taxable income (default true)","type":["boolean","null"]}},"type":"object"},"type":["array","null"]},"vacation_paid_cents":{"description":"Accrued vacation paid out on this cheque; at most the accrued balance","format":"int64","type":["integer","null"]}},"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the line, re-calculated with CPP, EI and income tax"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs payroll.manage)"},"404":{"description":"no such line"},"409":{"description":"conflict: the run is not open"},"422":{"description":"validation_failed: commission_cents, bonus_cents, vacation_paid_cents, items"}},"security":[{"bearer":[]}],"tags":["Payroll"]}},"/pay_lines/{id}/cancel":{"post":{"operationId":"pay_lines_cancel","parameters":[{"description":"pay line id","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the line, `cancelled`, and `time_cards_reopened`: it stops counting in year-to-date and the books reverse it on the next posting"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs payroll.manage)"},"404":{"description":"no such line"},"409":{"description":"conflict: only a line of a posted pay run is cancelled; it is already cancelled"}},"security":[{"bearer":[]}],"tags":["Payroll"]}},"/pay_lines/{id}/correct":{"post":{"operationId":"pay_lines_correct","parameters":[{"description":"the pay line to correct","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"figures":{"additionalProperties":false,"description":"Typed figures of an adjustment line (plan 1802). Absent: 0 for `record_adjustment`, the old\nline's value for `correct_line`. Every figure is −100,000.00 to 100,000.00 (hours in\nhundredths: −1,000.00 to 1,000.00): an adjustment may take a figure back.","properties":{"cpp2_cents":{"default":null,"format":"int64","type":["integer","null"]},"cpp_cents":{"default":null,"format":"int64","type":["integer","null"]},"ei_cents":{"default":null,"format":"int64","type":["integer","null"]},"employer_cpp2_cents":{"default":null,"format":"int64","type":["integer","null"]},"employer_cpp_cents":{"default":null,"format":"int64","type":["integer","null"]},"employer_ei_cents":{"default":null,"format":"int64","type":["integer","null"]},"federal_tax_cents":{"default":null,"format":"int64","type":["integer","null"]},"flat_hundredths":{"default":null,"format":"int64","type":["integer","null"]},"gross_cents":{"default":null,"format":"int64","type":["integer","null"]},"insurable_cents":{"default":null,"format":"int64","type":["integer","null"]},"items":{"default":null,"description":"Earning and deduction amounts; absent = none (correct_line: the old line's). A percent\nitem and a benefit are refused: a benefit is adjusted through `taxable_cents` and\n`pensionable_cents`.","items":{"additionalProperties":false,"properties":{"account":{"default":null,"type":["string","null"]},"amount_cents":{"default":null,"description":"A fixed amount in cents; or give percent_bp","format":"int64","type":["integer","null"]},"employee_pay_item_id":{"default":null,"description":"The employee's recurring item this line item comes from (keeps its limit)","format":"int64","type":["integer","null"]},"kind":{"default":"","description":"earning, deduction or benefit","type":"string"},"name":{"default":"","type":"string"},"percent_bp":{"default":null,"description":"A share of base gross in basis points (3% = 300)","format":"int64","type":["integer","null"]},"t4_box":{"default":"","type":"string"},"taxable":{"default":null,"description":"Earnings: part of taxable income (default true)","type":["boolean","null"]}},"type":"object"},"type":["array","null"]},"net_cents":{"default":null,"description":"When sent, must equal gross less the deductions","format":"int64","type":["integer","null"]},"ot1_hundredths":{"default":null,"format":"int64","type":["integer","null"]},"ot2_hundredths":{"default":null,"format":"int64","type":["integer","null"]},"pensionable_cents":{"default":null,"format":"int64","type":["integer","null"]},"provincial_tax_cents":{"default":null,"format":"int64","type":["integer","null"]},"regular_hundredths":{"default":null,"format":"int64","type":["integer","null"]},"taxable_cents":{"default":null,"format":"int64","type":["integer","null"]},"vacation_earned_cents":{"default":null,"format":"int64","type":["integer","null"]},"vacation_paid_cents":{"default":null,"format":"int64","type":["integer","null"]}},"type":"object"},"note":{"default":null,"type":["string","null"]},"post_ledger":{"default":null,"description":"Default: the corrected line's run's","type":["boolean","null"]}},"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the corrected line and the cancelled old line"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs payroll.manage)"},"404":{"description":"no such pay line"},"409":{"description":"the line is not posted, is cancelled, or its run never posted to the books"},"422":{"description":"validation_failed: figures, note, net_cents; idempotency_key_reused"}},"security":[{"bearer":[]}],"tags":["Payroll"]}},"/pay_lines/{id}/stub.pdf":{"get":{"operationId":"pay_lines_stub_pdf","parameters":[{"description":"Pay line id","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"the line's stub alone"},"403":{"description":"needs payroll.manage"},"404":{"description":"no such line"},"409":{"description":"the line is cancelled or its run is not issued or posted"}},"security":[{"bearer":[]}],"tags":["Payroll"]}},"/pay_runs":{"get":{"operationId":"pay_runs_index","parameters":[{"description":"open | issued | posted; absent = every status","in":"query","name":"status","required":false,"schema":{"type":"string"}},{"description":"regular | off_cycle | manual | adjustment | opening; absent = every kind","in":"query","name":"kind","required":false,"schema":{"type":"string"}},{"description":"1-100, default 50","in":"query","name":"limit","required":false,"schema":{"format":"int64","type":"integer"}},{"description":"rows to skip","in":"query","name":"offset","required":false,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"`{data, total, next_offset}` of pay runs, newest first; `gross_cents` and `net_cents` null without payroll.manage"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs payroll.view)"}},"security":[{"bearer":[]}],"tags":["Payroll"]},"post":{"operationId":"pay_runs_create","requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"department_id":{"default":null,"description":"Only this department's employees; absent = all","format":"int64","type":["integer","null"]},"employee_ids":{"default":null,"description":"The employees of an off-cycle run; required for off_cycle, at most 100, no duplicates","items":{"format":"int64","type":"integer"},"type":["array","null"]},"frequencies":{"default":null,"description":"Only employees paid at one of these frequencies (FoxPro PRCREATE `PAY FREQUENCY(S)`);\nabsent or empty = all. Given with `frequency`, both must hold.","items":{"type":"string"},"type":["array","null"]},"frequency":{"default":null,"description":"Only employees paid at this frequency (weekly, biweekly, semi_monthly, monthly); absent = all","type":["string","null"]},"from_number":{"default":null,"description":"Only employees numbered from this one (as typed: `1` is `    1`); absent = the first","type":["string","null"]},"include_time_cards":{"default":null,"description":"An off-cycle run takes the employees' open time cards (default: no)","type":["boolean","null"]},"kind":{"default":null,"description":"regular (default) or off_cycle; manual cheques and adjustments have their own tools","type":["string","null"]},"pay_date":{"default":"","description":"The cheque date, YYYY-MM-DD; it picks the tax year","type":"string"},"pay_types":{"default":null,"description":"Only employees of these pay types (hourly, salary, commission, flat_rate,\nsubcontractor; FoxPro `PAY TYPES`); absent or empty = all","items":{"type":"string"},"type":["array","null"]},"period_end":{"default":"","description":"The last day of the pay period: open time cards up to it are paid","type":"string"},"to_number":{"default":null,"description":"Only employees numbered up to this one; absent = the last","type":["string","null"]}},"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"`{run, left_out}`: the run and its lines; an off-cycle run (`kind: off_cycle`) names its employees and starts empty; left_out lists the employees left out and why"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs payroll.manage)"},"409":{"description":"conflict: a regular pay run is already unposted; an employee of the off-cycle run is already on an unposted pay run; the run is not open"},"422":{"description":"validation_failed: pay_date, period_end, frequency, pay_types, from_number, to_number, kind, employee_ids, include_time_cards; idempotency_key_reused"}},"security":[{"bearer":[]}],"tags":["Payroll"]}},"/pay_runs/adjustment":{"post":{"operationId":"pay_runs_adjustment","requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"cheque_number":{"default":null,"description":"The number of the cheque this history belongs to (1 to 8 letters or digits); absent = none","type":["string","null"]},"employee_id":{"default":0,"format":"int64","type":"integer"},"figures":{"additionalProperties":false,"description":"Typed figures of an adjustment line (plan 1802). Absent: 0 for `record_adjustment`, the old\nline's value for `correct_line`. Every figure is −100,000.00 to 100,000.00 (hours in\nhundredths: −1,000.00 to 1,000.00): an adjustment may take a figure back.","properties":{"cpp2_cents":{"default":null,"format":"int64","type":["integer","null"]},"cpp_cents":{"default":null,"format":"int64","type":["integer","null"]},"ei_cents":{"default":null,"format":"int64","type":["integer","null"]},"employer_cpp2_cents":{"default":null,"format":"int64","type":["integer","null"]},"employer_cpp_cents":{"default":null,"format":"int64","type":["integer","null"]},"employer_ei_cents":{"default":null,"format":"int64","type":["integer","null"]},"federal_tax_cents":{"default":null,"format":"int64","type":["integer","null"]},"flat_hundredths":{"default":null,"format":"int64","type":["integer","null"]},"gross_cents":{"default":null,"format":"int64","type":["integer","null"]},"insurable_cents":{"default":null,"format":"int64","type":["integer","null"]},"items":{"default":null,"description":"Earning and deduction amounts; absent = none (correct_line: the old line's). A percent\nitem and a benefit are refused: a benefit is adjusted through `taxable_cents` and\n`pensionable_cents`.","items":{"additionalProperties":false,"properties":{"account":{"default":null,"type":["string","null"]},"amount_cents":{"default":null,"description":"A fixed amount in cents; or give percent_bp","format":"int64","type":["integer","null"]},"employee_pay_item_id":{"default":null,"description":"The employee's recurring item this line item comes from (keeps its limit)","format":"int64","type":["integer","null"]},"kind":{"default":"","description":"earning, deduction or benefit","type":"string"},"name":{"default":"","type":"string"},"percent_bp":{"default":null,"description":"A share of base gross in basis points (3% = 300)","format":"int64","type":["integer","null"]},"t4_box":{"default":"","type":"string"},"taxable":{"default":null,"description":"Earnings: part of taxable income (default true)","type":["boolean","null"]}},"type":"object"},"type":["array","null"]},"net_cents":{"default":null,"description":"When sent, must equal gross less the deductions","format":"int64","type":["integer","null"]},"ot1_hundredths":{"default":null,"format":"int64","type":["integer","null"]},"ot2_hundredths":{"default":null,"format":"int64","type":["integer","null"]},"pensionable_cents":{"default":null,"format":"int64","type":["integer","null"]},"provincial_tax_cents":{"default":null,"format":"int64","type":["integer","null"]},"regular_hundredths":{"default":null,"format":"int64","type":["integer","null"]},"taxable_cents":{"default":null,"format":"int64","type":["integer","null"]},"vacation_earned_cents":{"default":null,"format":"int64","type":["integer","null"]},"vacation_paid_cents":{"default":null,"format":"int64","type":["integer","null"]}},"type":"object"},"note":{"default":null,"description":"Why: the accountant's reason (required)","type":["string","null"]},"pay_date":{"default":"","description":"YYYY-MM-DD: the pay date the figures count on (year to date, T4, remittance)","type":"string"},"period_end":{"default":null,"description":"YYYY-MM-DD; absent = pay_date (it places the line in an ROE pay period)","type":["string","null"]},"post_ledger":{"default":null,"description":"false: the books already hold it (the journal entry was made by hand). Default true","type":["boolean","null"]}},"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the posted run (`kind` adjustment) and its line"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs payroll.manage)"},"409":{"description":"the cheque number is on another uncancelled line"},"422":{"description":"validation_failed: employee_id, pay_date, period_end, cheque_number, figures, note, net_cents; idempotency_key_reused"}},"security":[{"bearer":[]}],"tags":["Payroll"]}},"/pay_runs/manual_cheque":{"post":{"operationId":"pay_runs_manual_cheque","requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"cheque_number":{"default":"","description":"The number written on the cheque","type":"string"},"earnings":{"additionalProperties":false,"properties":{"bonus_cents":{"default":null,"format":"int64","type":["integer","null"]},"commission_cents":{"default":null,"format":"int64","type":["integer","null"]},"flat_hundredths":{"default":0,"description":"Flat-rate (flagged) hours in hundredths, at the employee's flat rate","format":"int64","type":"integer"},"items":{"default":null,"description":"The items; absent = the employee's recurring items, [] = none","items":{"additionalProperties":false,"properties":{"account":{"default":null,"type":["string","null"]},"amount_cents":{"default":null,"description":"A fixed amount in cents; or give percent_bp","format":"int64","type":["integer","null"]},"employee_pay_item_id":{"default":null,"description":"The employee's recurring item this line item comes from (keeps its limit)","format":"int64","type":["integer","null"]},"kind":{"default":"","description":"earning, deduction or benefit","type":"string"},"name":{"default":"","type":"string"},"percent_bp":{"default":null,"description":"A share of base gross in basis points (3% = 300)","format":"int64","type":["integer","null"]},"t4_box":{"default":"","type":"string"},"taxable":{"default":null,"description":"Earnings: part of taxable income (default true)","type":["boolean","null"]}},"type":"object"},"type":["array","null"]},"ot1_hundredths":{"default":0,"format":"int64","type":"integer"},"ot2_hundredths":{"default":0,"format":"int64","type":"integer"},"regular_hundredths":{"default":0,"description":"Regular hours in hundredths, at the employee's hourly rate","format":"int64","type":"integer"},"salary_cents":{"default":null,"description":"Salary paid on this cheque (absent = none)","format":"int64","type":["integer","null"]},"vacation_paid_cents":{"default":null,"description":"Accrued vacation pay paid out on this cheque","format":"int64","type":["integer","null"]}},"type":"object"},"employee_id":{"default":0,"format":"int64","type":"integer"},"note":{"default":null,"type":["string","null"]},"pay_date":{"default":"","description":"The date on the cheque, YYYY-MM-DD","type":"string"},"period_end":{"default":"","description":"The last day of the period it pays, YYYY-MM-DD","type":"string"}},"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the posted run (`kind` manual) and its line"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs payroll.manage)"},"409":{"description":"the cheque number is on another uncancelled line"},"422":{"description":"validation_failed: employee_id, pay_date, period_end, cheque_number, earnings, note; idempotency_key_reused"}},"security":[{"bearer":[]}],"tags":["Payroll"]}},"/pay_runs/{id}":{"get":{"operationId":"pay_runs_show","parameters":[{"description":"pay run id","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the run and every line, in employee-number order; the amount fields null without payroll.manage"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs payroll.view)"},"404":{"description":"no such run"}},"security":[{"bearer":[]}],"tags":["Payroll"]}},"/pay_runs/{id}/cheques.pdf":{"get":{"operationId":"pay_runs_cheques_pdf","parameters":[{"description":"Pay run id","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"one page per cheque employee: cheque and two stubs"},"403":{"description":"needs payroll.manage"},"404":{"description":"no such run"},"409":{"description":"the run is not issued or posted"}},"security":[{"bearer":[]}],"tags":["Payroll"]}},"/pay_runs/{id}/cpa005":{"get":{"operationId":"pay_runs_cpa005","parameters":[{"description":"Pay run id","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"text/plain":{"schema":{"type":"string"}}},"description":"the CPA-005 credit file (1464-byte records, CR LF); numbered with the run's file number, else the next one (not reserved); header x-file-number"},"403":{"description":"needs payroll.manage"},"404":{"description":"no such run"},"409":{"description":"not issued, or no direct deposits"},"422":{"description":"originator or bank details missing or invalid"}},"security":[{"bearer":[]}],"tags":["Payroll"]},"post":{"operationId":"pay_runs_cpa005_create","parameters":[{"description":"Pay run id","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"text/plain":{"schema":{"type":"string"}}},"description":"assigns the next file creation number (payroll.create_deposit_file) and answers the file; each call is a new transmission with a new number"},"403":{"description":"needs payroll.manage"},"404":{"description":"no such run"},"409":{"description":"not issued, or no direct deposits"},"422":{"description":"originator or bank details missing or invalid"}},"security":[{"bearer":[]}],"tags":["Payroll"]}},"/pay_runs/{id}/email_stubs":{"post":{"operationId":"pay_runs_email_stubs","parameters":[{"description":"pay run id","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"resend":{"default":false,"description":"Send again to employees already sent this run's stub","type":"boolean"}},"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"`{pay_run_id, queued, skipped}`: the lines e-mailed (queued) and the lines left out (skipped) and why; an e-mail cannot be taken back"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs payroll.manage)"},"404":{"description":"no such run"},"409":{"description":"conflict: the run is not issued or posted"}},"security":[{"bearer":[]}],"tags":["Payroll"]}},"/pay_runs/{id}/holiday_pay":{"post":{"operationId":"pay_runs_holiday_pay","parameters":[{"description":"pay run id","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"holiday":{"default":"","description":"The public holiday, YYYY-MM-DD (GET /payroll/holidays lists them)","type":"string"}},"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the lines paid and the lines skipped with why; running it again for the holiday replaces the amount"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs payroll.manage)"},"404":{"description":"no such run"},"409":{"description":"conflict: the run is issued or posted"},"422":{"description":"not an Ontario public holiday"}},"security":[{"bearer":[]}],"tags":["Payroll"]}},"/pay_runs/{id}/issue":{"post":{"operationId":"pay_runs_issue","parameters":[{"description":"pay run id","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the run, `issued`: every line has its cheque or deposit number"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs payroll.manage)"},"404":{"description":"no such run"},"409":{"description":"conflict: the run is already issued or posted; it has no line"}},"security":[{"bearer":[]}],"tags":["Payroll"]}},"/pay_runs/{id}/lines":{"get":{"operationId":"pay_runs_lines","parameters":[{"description":"pay run id","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"`{data}`: the run's lines, in employee-number order; the amount fields null without payroll.manage"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs payroll.view)"},"404":{"description":"no such run"}},"security":[{"bearer":[]}],"tags":["Payroll"]},"post":{"operationId":"pay_runs_add_line","parameters":[{"description":"pay run id","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"employee_id":{"default":0,"format":"int64","type":"integer"}},"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the new line; an off-cycle run's line starts empty, a regular run's is built from the employee's salary, open cards, items and vacation pay"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs payroll.manage)"},"404":{"description":"no such run or employee"},"409":{"description":"conflict: the run is not open; the employee is already on it; the employee is on another unposted pay run"},"422":{"description":"validation_failed: employee_id; idempotency_key_reused"}},"security":[{"bearer":[]}],"tags":["Payroll"]}},"/pay_runs/{id}/post":{"post":{"operationId":"pay_runs_post","parameters":[{"description":"pay run id","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the run, `posted`, and `time_cards_paid`: its cards are marked paid and its accounts are fixed for the books"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs payroll.manage)"},"404":{"description":"no such run"},"409":{"description":"conflict: issue the run first; it is already posted"}},"security":[{"bearer":[]}],"tags":["Payroll"]}},"/pay_runs/{id}/stubs.pdf":{"get":{"operationId":"pay_runs_stubs_pdf","parameters":[{"description":"Pay run id","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"one direct-deposit advice per deposit employee"},"403":{"description":"needs payroll.manage"},"404":{"description":"no such run"},"409":{"description":"the run is not issued or posted"}},"security":[{"bearer":[]}],"tags":["Payroll"]}},"/pay_runs/{id}/unissue":{"post":{"operationId":"pay_runs_unissue","parameters":[{"description":"pay run id","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the run, `open` again: the numbers come off its lines, the counters stay"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs payroll.manage)"},"404":{"description":"no such run"},"409":{"description":"conflict: only an issued pay run goes back to open"}},"security":[{"bearer":[]}],"tags":["Payroll"]}},"/payment_methods":{"get":{"operationId":"payment_methods_index","responses":{"200":{"content":{"application/json":{"schema":{"items":{"type":"object"},"type":"array"}}},"description":"every payment method in counter order: key, label, kind, gl_account_number, active, position"},"401":{"description":"unauthenticated"}},"security":[{"bearer":[]}],"tags":["Payments"]}},"/payment_methods/{key}":{"patch":{"operationId":"payment_methods_update","parameters":[{"description":"the method's key (cash, etransfer…)","in":"path","name":"key","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"properties":{"active":{"default":null,"description":"false hides it from new payments","type":["boolean","null"]},"gl_account_number":{"default":null,"description":"The chart account its money goes to; null clears it (the location's routing)","type":["string","null"]},"label":{"default":null,"description":"The name shown at the counter, 1 to 30 characters","type":["string","null"]}},"required":[],"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the stored method"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs settings.manage)"},"404":{"description":"no such payment method"},"422":{"description":"validation_failed: label, gl_account_number, active"}},"security":[{"bearer":[]}],"tags":["Payments"]}},"/payment_types":{"delete":{"operationId":"payment_types_delete","parameters":[{"description":"the letter to delete","in":"query","name":"letter","required":true,"schema":{"type":"string"}},{"description":"the location; default: the user's own","in":"query","name":"location_id","required":false,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"`{ letter, deleted: true }`"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs settings.manage)"},"404":{"description":"no such letter"},"422":{"description":"payment_type_cash (C) or payment_type_in_use"}},"security":[{"bearer":[]}],"tags":["Workflow Config"]},"get":{"operationId":"payment_types_index","parameters":[{"description":"the location; default: the user's own","in":"query","name":"location_id","required":false,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"items":{"type":"object"},"type":"array"}}},"description":"the payment-type rows in letter order: letter, name, method, bank, direct, commission_bp, commission_account"},"401":{"description":"unauthenticated"}},"security":[{"bearer":[]}],"tags":["Workflow Config"]},"put":{"operationId":"payment_types_upsert","parameters":[{"description":"the location; default: the user's own","in":"query","name":"location_id","required":false,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"properties":{"bank":{"default":0,"description":"Bank account 1, 2 or 3; 0 = none (not allowed with direct deposit)","format":"int64","type":"integer"},"commission_account":{"default":null,"description":"Up to five digits; left out: kept","type":["string","null"]},"commission_bp":{"default":0,"description":"Commission in basis points, 0-9999","format":"int64","type":"integer"},"direct":{"default":false,"description":"Deposited straight to the bank","type":"boolean"},"letter":{"default":"","description":"One character; stored upper-cased. X, 1, 2, 3 and C are refused","type":"string"},"location_id":{"default":null,"description":"The location whose table is edited; default: the user's own","format":"int64","type":["integer","null"]},"method":{"default":null,"description":"cash, cheque, debit, visa, mastercard, amex, etransfer or other; left out: kept (\"other\" for a new letter)","type":["string","null"]},"name":{"default":"","description":"At most 10 characters; case kept","type":"string"}},"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the stored row plus `created`"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs settings.manage)"},"422":{"description":"payment_type_reserved (X, 1, 2, 3), payment_type_cash (C), or validation_failed: letter, name, bank, commission_bp, method, commission_account"}},"security":[{"bearer":[]}],"tags":["Workflow Config"]}},"/payments/{id}":{"get":{"operationId":"payments_show","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"payment"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized"},"404":{"description":"not found"}},"security":[{"bearer":[]}],"tags":["Payments"]}},"/payments/{id}/void":{"post":{"operationId":"payments_void","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"properties":{"reason":{"default":null,"description":"Why the payment is voided (e.g. NSF cheque, keyed in error)","type":["string","null"]}},"required":[],"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"payment voided; includes the work order's paid/remaining"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized"},"404":{"description":"not found"},"409":{"description":"already voided"},"422":{"description":"posting_window (the payment's date is outside the posting window) or invalid request"}},"security":[{"bearer":[]}],"tags":["Payments"]}},"/payroll/cheque_layout":{"get":{"operationId":"payroll_cheque_layout_show","responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"where each payroll cheque item prints: items (item, label, line, column; line 0 = not printed), position (top|middle|bottom), offset_x_tenths_mm, offset_y_tenths_mm, placed"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs payroll.view)"}},"security":[{"bearer":[]}],"tags":["Payroll"]},"patch":{"operationId":"payroll_cheque_layout_update","requestBody":{"content":{"application/json":{"schema":{"type":"object"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the layout after the change (payroll.update_cheque_layout): items [{item, line, column}], position, offset_x_tenths_mm, offset_y_tenths_mm, reset"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs payroll.manage)"},"422":{"description":"validation_failed: the field named in details"}},"security":[{"bearer":[]}],"tags":["Payroll"]}},"/payroll/cheque_layout/test.pdf":{"get":{"operationId":"payroll_cheque_layout_test_pdf","responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"one cheque of ZZ sample data at the cheque layout, for lining up the stock"},"403":{"description":"needs payroll.manage"}},"security":[{"bearer":[]}],"tags":["Payroll"]}},"/payroll/departments":{"get":{"operationId":"payroll_departments_index","parameters":[{"description":"true: active departments only","in":"query","name":"active","required":false,"schema":{"type":"boolean"}}],"responses":{"200":{"content":{"application/json":{"schema":{"items":{"type":"object"},"type":"array"}}},"description":"payroll departments"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs payroll.view)"}},"security":[{"bearer":[]}],"tags":["Payroll"]},"post":{"operationId":"payroll_departments_create","requestBody":{"content":{"application/json":{"schema":{"type":"object"}}},"required":true},"responses":{"201":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the department"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs payroll.manage)"},"422":{"description":"validation_failed: the field named in details"}},"security":[{"bearer":[]}],"tags":["Payroll"]}},"/payroll/departments/{id}":{"get":{"operationId":"payroll_departments_show","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the department"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs payroll.view)"},"404":{"description":"not found"}},"security":[{"bearer":[]}],"tags":["Payroll"]},"patch":{"operationId":"payroll_departments_update","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the department after the change"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs payroll.manage)"},"404":{"description":"not found"},"422":{"description":"validation_failed: the field named in details"}},"security":[{"bearer":[]}],"tags":["Payroll"]}},"/payroll/holidays":{"get":{"operationId":"payroll_holidays","parameters":[{"description":"the calendar year; absent: this year in the shop's time zone","in":"query","name":"year","required":false,"schema":{"format":"int32","type":"integer"}},{"description":"two upper-case letters, e.g. ON; absent: the shop's default province, else Ontario","in":"query","name":"province","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"items":{"type":"object"},"type":"array"}}},"description":"the year's public holidays `[{date, name}]`, in date order; none outside Ontario yet"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs payroll.view)"},"422":{"description":"province QC or unknown, or year out of range"}},"security":[{"bearer":[]}],"tags":["Payroll"]}},"/payroll/import/employees":{"post":{"operationId":"payroll_import_employees","requestBody":{"content":{"application/json":{"schema":{"type":"object"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"`{rows, errors, written, dry_run, replayed}`: the employees read from the csv; with dry_run (the default) nothing is written"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs payroll.manage)"},"422":{"description":"validation_failed: one problem per row, named in field_errors; idempotency_key_reused"}},"security":[{"bearer":[]}],"tags":["Payroll"]}},"/payroll/import/history":{"post":{"operationId":"payroll_import_history","requestBody":{"content":{"application/json":{"schema":{"type":"object"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"`{runs, rows, errors, written, dry_run, replayed}`: one posted opening run per pay date and period end; with dry_run (the default) nothing is written"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs payroll.manage)"},"422":{"description":"validation_failed: one problem per row, named in field_errors; idempotency_key_reused"}},"security":[{"bearer":[]}],"tags":["Payroll"]}},"/payroll/import/templates/employees.csv":{"get":{"operationId":"payroll_import_employees_template","responses":{"200":{"content":{"text/csv":{"schema":{"type":"string"}}},"description":"the employees template header row"},"403":{"description":"needs payroll.manage"}},"security":[{"bearer":[]}],"tags":["Payroll"]}},"/payroll/import/templates/history.csv":{"get":{"operationId":"payroll_import_history_template","responses":{"200":{"content":{"text/csv":{"schema":{"type":"string"}}},"description":"the history template header row"},"403":{"description":"needs payroll.manage"}},"security":[{"bearer":[]}],"tags":["Payroll"]}},"/payroll/remittances":{"get":{"operationId":"payroll_remittances_index","parameters":[{"description":"first period start, YYYY-MM-DD","in":"query","name":"from","required":false,"schema":{"type":"string"}},{"description":"last period start, YYYY-MM-DD","in":"query","name":"to","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"items":{"type":"object"},"type":"array"}}},"description":"payments newest period first, voided ones too"},"401":{"description":"unauthenticated"},"403":{"description":"needs payroll.manage"},"422":{"description":"validation_failed: from, to"}},"security":[{"bearer":[]}],"tags":["Payroll"]},"post":{"operationId":"payroll_remittances_create","requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"allow_difference":{"default":false,"description":"true: record an amount different from what the period still owes (the difference goes to income tax payable)","type":"boolean"},"amount_cents":{"default":0,"description":"The amount paid to the Receiver General, in cents","format":"int64","type":"integer"},"note":{"default":"","description":"A note; at most 200 characters","type":"string"},"paid_on":{"default":"","description":"The day the payment was made, YYYY-MM-DD","type":"string"},"period_end":{"default":"","description":"The last day of the remitting period, YYYY-MM-DD","type":"string"},"period_start":{"default":"","description":"The first day of the remitting period, YYYY-MM-DD","type":"string"},"reference":{"default":"","description":"The bank's confirmation or the cheque number; at most 60 characters","type":"string"}},"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the remittance"},"401":{"description":"unauthenticated"},"403":{"description":"needs payroll.manage"},"422":{"description":"validation_failed: period_start (not a period of the remitter type), period_end, paid_on, amount_cents (differs_from_owing), reference, note; idempotency_key_reused"}},"security":[{"bearer":[]}],"tags":["Payroll"]}},"/payroll/remittances/owing":{"get":{"operationId":"payroll_remittances_owing","parameters":[{"description":"a day in the period, YYYY-MM-DD","in":"query","name":"date","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the period, its due date, owing, paid and balance"},"401":{"description":"unauthenticated"},"403":{"description":"needs payroll.manage"},"422":{"description":"validation_failed: date"}},"security":[{"bearer":[]}],"tags":["Payroll"]}},"/payroll/remittances/{id}/void":{"post":{"operationId":"payroll_remittances_void","parameters":[{"description":"remittance id","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the remittance, voided"},"401":{"description":"unauthenticated"},"403":{"description":"needs payroll.manage"},"404":{"description":"no such remittance"},"409":{"description":"already void"}},"security":[{"bearer":[]}],"tags":["Payroll"]}},"/payroll/roes":{"get":{"operationId":"payroll_roes_index","parameters":[{"description":"one employee's ROEs","in":"query","name":"employee_id","required":false,"schema":{"format":"int64","type":"integer"}},{"description":"draft | issued; absent = both","in":"query","name":"status","required":false,"schema":{"type":"string"}},{"description":"1-100, default 50","in":"query","name":"limit","required":false,"schema":{"format":"int64","type":"integer"}},{"description":"rows to skip","in":"query","name":"offset","required":false,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"`{data, total, next_offset}` of ROEs, newest first"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs payroll.manage)"},"422":{"description":"validation_failed: status"}},"security":[{"bearer":[]}],"tags":["Payroll"]},"post":{"operationId":"payroll_roes_create","requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"comments":{"default":null,"description":"Block 18, at most 160 characters","type":["string","null"]},"contact_name":{"default":null,"description":"The person Service Canada may call (block 16)","type":["string","null"]},"contact_phone":{"default":null,"type":["string","null"]},"employee_id":{"default":0,"description":"The employee","format":"int64","type":"integer"},"final_period_end":{"default":null,"description":"Block 12, YYYY-MM-DD; absent = the end of the pay period holding the last day paid","type":["string","null"]},"first_day_worked":{"default":null,"description":"Block 10, YYYY-MM-DD; absent = the day after the last issued ROE, else the start date","type":["string","null"]},"last_day_paid":{"default":"","description":"Block 11, YYYY-MM-DD: the last day the employee received insurable earnings for","type":"string"},"reason_code":{"default":"","description":"Block 16: ROE Web's separation code (A00, E02, K12 ...) or its letter (A = A00)","type":"string"},"recall":{"default":null,"description":"Block 14: unknown (default), not_returning or date","type":["string","null"]},"recall_date":{"default":null,"description":"Block 14, YYYY-MM-DD, when recall is date","type":["string","null"]}},"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the draft ROE: the insurable hours and earnings by pay period frozen from pay history, the typed blocks as given"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs payroll.manage)"},"404":{"description":"no such employee"},"422":{"description":"validation_failed: reason_code, last_day_paid, first_day_worked, final_period_end, recall, recall_date, comments, contact_name, contact_phone; idempotency_key_reused"}},"security":[{"bearer":[]}],"tags":["Payroll"]}},"/payroll/roes/xml":{"get":{"operationId":"payroll_roes_xml","parameters":[{"description":"comma-separated ROE ids (draft or issued), at most 1200","in":"query","name":"ids","required":true,"schema":{"type":"string"}},{"description":"D: ROE Web keeps them as drafts (default); S: ROE Web submits them on upload","in":"query","name":"issue","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/xml":{"schema":{"type":"string"}}},"description":"the ROE Web payroll-extract file, XML version W-2.0 (.BLK)"},"403":{"description":"needs payroll.manage, and a person (agents never get SINs)"},"422":{"description":"every reason the file cannot be made: business number, an unknown id, a block of an ROE"}},"security":[{"bearer":[]}],"tags":["Payroll"]}},"/payroll/roes/{id}":{"get":{"operationId":"payroll_roes_show","parameters":[{"description":"ROE id","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the ROE"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs payroll.manage)"},"404":{"description":"no such ROE"}},"security":[{"bearer":[]}],"tags":["Payroll"]},"patch":{"operationId":"payroll_roes_update","parameters":[{"description":"ROE id","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"comments":{"default":null,"type":["string","null"]},"contact_name":{"default":null,"type":["string","null"]},"contact_phone":{"default":null,"type":["string","null"]},"final_period_end":{"default":null,"type":["string","null"]},"first_day_worked":{"default":null,"type":["string","null"]},"holiday_pay":{"default":null,"description":"Block 17B, at most 10 rows; replaces the list","items":{"additionalProperties":false,"description":"One block-17B row: a statutory holiday after the last day paid and its pay.","properties":{"cents":{"default":0,"format":"int64","type":"integer"},"date":{"default":"","type":"string"}},"type":"object"},"type":["array","null"]},"last_day_paid":{"default":null,"type":["string","null"]},"other_monies":{"default":null,"description":"Block 17C, at most 3 rows; replaces the list","items":{"additionalProperties":false,"description":"One block-17C row: ROE Web's code, the amount, the dates its code asks for.","properties":{"cents":{"default":0,"format":"int64","type":"integer"},"code":{"default":"","type":"string"},"end_date":{"type":["string","null"]},"start_date":{"type":["string","null"]}},"type":"object"},"type":["array","null"]},"reason_code":{"default":null,"type":["string","null"]},"recall":{"default":null,"type":["string","null"]},"recall_date":{"default":null,"description":"Sent with recall date; null clears it","type":["string","null"]},"vacation_pay_cents":{"default":null,"description":"Block 17A, cents: vacation pay paid because the employee is no longer working","format":"int64","type":["integer","null"]}},"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the draft after the change; a changed date computes the figures again"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs payroll.manage)"},"404":{"description":"no such ROE"},"409":{"description":"conflict: an issued ROE is never changed; amend it"},"422":{"description":"validation_failed: reason_code, first_day_worked, last_day_paid, final_period_end, recall, recall_date, vacation_pay_cents, holiday_pay, other_monies, comments, contact_name, contact_phone"}},"security":[{"bearer":[]}],"tags":["Payroll"]}},"/payroll/roes/{id}/amend":{"post":{"operationId":"payroll_roes_amend","parameters":[{"description":"ROE id","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the new draft, `amends_id` naming the issued ROE"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs payroll.manage)"},"404":{"description":"no such ROE"},"409":{"description":"conflict: only an issued ROE is amended; it is already amended; idempotency_key_reused"}},"security":[{"bearer":[]}],"tags":["Payroll"]}},"/payroll/roes/{id}/issue":{"post":{"operationId":"payroll_roes_issue","parameters":[{"description":"ROE id","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"serial":{"default":null,"description":"Block 1: the serial ROE Web gave (a letter and eight digits); may be sent later","type":["string","null"]}},"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the ROE, `issued` (or the serial added to an issued one whose serial is blank)"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs payroll.manage)"},"404":{"description":"no such ROE"},"409":{"description":"conflict: the ROE is already issued and its serial is typed"},"422":{"description":"validation_failed: serial"}},"security":[{"bearer":[]}],"tags":["Payroll"]}},"/payroll/roes/{id}/pdf":{"get":{"operationId":"payroll_roes_pdf","parameters":[{"description":"ROE id","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"the ROE as a page the shop keeps"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs payroll.manage)"},"404":{"description":"no such ROE"}},"security":[{"bearer":[]}],"tags":["Payroll"]}},"/payroll/roes/{id}/refresh":{"post":{"operationId":"payroll_roes_refresh","parameters":[{"description":"ROE id","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the draft, the figures computed again from pay history"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs payroll.manage)"},"404":{"description":"no such ROE"},"409":{"description":"conflict: only a draft ROE is computed again; amend an issued one"}},"security":[{"bearer":[]}],"tags":["Payroll"]}},"/payroll/settings":{"get":{"operationId":"payroll_settings_show","responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the payroll settings: every column of payroll_settings; originator_account is null unless the caller is a person holding payroll.manage"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs payroll.view)"}},"security":[{"bearer":[]}],"tags":["Payroll"]},"patch":{"operationId":"payroll_settings_update","requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"bank_account":{"default":null,"description":"G/L account number for the bank account cheques and deposits are paid from","type":["string","null"]},"benefits_account":{"default":null,"description":"G/L account number for employer CPP and EI expense","type":["string","null"]},"business_number":{"default":null,"description":"CRA business number with the payroll account, 15 characters (123456789RP0001); blank clears it","type":["string","null"]},"cpp_account":{"default":null,"description":"G/L account number for CPP payable","type":["string","null"]},"deductions_account":{"default":null,"description":"G/L account number for other deductions payable","type":["string","null"]},"default_frequency":{"default":null,"description":"weekly, biweekly, semi_monthly or monthly: a new employee's pay frequency","type":["string","null"]},"default_province":{"default":null,"description":"Two-letter province or territory of a new employee (not QC)","type":["string","null"]},"dental_benefit_code":{"default":null,"description":"T4 box 45, employer-offered dental benefits: 1 not eligible, 2 payee only, 3 payee,\nspouse and dependent children, 4 payee and spouse, 5 payee and dependent children","format":"int64","type":["integer","null"]},"destination_data_centre":{"default":null,"description":"Direct deposit: the bank's data centre number, 5 digits","type":["string","null"]},"eht_eligible":{"default":null,"description":"Ontario Employer Health Tax: true when the employer takes the exemption","type":["boolean","null"]},"eht_exemption_cents":{"default":null,"description":"Ontario Employer Health Tax exemption in cents, 0-1000000000 (default 100000000 = 1,000,000.00)","format":"int64","type":["integer","null"]},"ei_account":{"default":null,"description":"G/L account number for EI payable","type":["string","null"]},"filing_contact_email":{"default":null,"description":"Filing contact e-mail, at most 60 characters","type":["string","null"]},"filing_contact_name":{"default":null,"description":"T4/T4A and ROE filing contact: first name then surname, at most 22 characters","type":["string","null"]},"filing_contact_phone":{"default":null,"description":"Filing contact telephone: ten digits with the area code (spaces, dashes, dots and\nparentheses are dropped; a leading 1 is dropped)","type":["string","null"]},"income_tax_account":{"default":null,"description":"G/L account number for income tax withheld payable","type":["string","null"]},"next_cheque_number":{"default":null,"description":"The next cheque number, 1-999999","format":"int64","type":["integer","null"]},"next_deposit_number":{"default":null,"description":"The next direct-deposit number, 1-999999","format":"int64","type":["integer","null"]},"next_employee_number":{"default":null,"description":"The number the next new employee gets, 1-99999","format":"int64","type":["integer","null"]},"next_file_number":{"default":null,"description":"Direct deposit: the next file creation number, 1-9999","format":"int64","type":["integer","null"]},"originator_account":{"default":null,"description":"Direct deposit: the shop's bank account number, up to 12 digits","type":["string","null"]},"originator_id":{"default":null,"description":"Direct deposit: the originator ID the bank assigned (up to 10 letters or digits)","type":["string","null"]},"originator_institution":{"default":null,"description":"Direct deposit: the shop's bank institution number, 3 digits","type":["string","null"]},"originator_name":{"default":null,"description":"Direct deposit: the originator's name, at most 30 characters","type":["string","null"]},"originator_transit":{"default":null,"description":"Direct deposit: the shop's branch transit number, 5 digits","type":["string","null"]},"overtime_threshold_hundredths":{"default":null,"description":"Weekly regular hours above which the overtime report lists an employee, in hundredths (4400 = 44 hours)","format":"int64","type":["integer","null"]},"remitter_type":{"default":null,"description":"quarterly, regular, threshold1 or threshold2: how often source deductions are remitted","type":["string","null"]},"subcontractor_wording":{"default":null,"description":"The line printed on a sub-contractor invoice, at most 60 characters","type":["string","null"]},"vacation_expense_account":{"default":null,"description":"G/L account number for vacation expense","type":["string","null"]},"vacation_payable_account":{"default":null,"description":"G/L account number for vacation pay payable","type":["string","null"]},"wages_account":{"default":null,"description":"G/L account number for wages","type":["string","null"]},"wsib_max_insurable_cents":{"default":null,"description":"WSIB maximum insurable earnings per employee per year in cents, 0-100000000 (0 = no cap)","format":"int64","type":["integer","null"]},"wsib_rate_bp":{"default":null,"description":"WSIB premium rate in basis points of insurable earnings, 0-10000 (1.50 per 100 dollars = 150; 0 = not set)","format":"int64","type":["integer","null"]}},"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the settings after the change"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs payroll.manage)"},"422":{"description":"validation_failed: the field named in details"}},"security":[{"bearer":[]}],"tags":["Payroll"]}},"/payroll/work_classes":{"get":{"operationId":"payroll_work_classes_index","parameters":[{"description":"true: active work classes only","in":"query","name":"active","required":false,"schema":{"type":"boolean"}}],"responses":{"200":{"content":{"application/json":{"schema":{"items":{"type":"object"},"type":"array"}}},"description":"payroll work classes"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs payroll.view)"}},"security":[{"bearer":[]}],"tags":["Payroll"]},"post":{"operationId":"payroll_work_classes_create","requestBody":{"content":{"application/json":{"schema":{"type":"object"}}},"required":true},"responses":{"201":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the work class"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs payroll.manage)"},"422":{"description":"validation_failed: the field named in details"}},"security":[{"bearer":[]}],"tags":["Payroll"]}},"/payroll/work_classes/{id}":{"get":{"operationId":"payroll_work_classes_show","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the work class"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs payroll.view)"},"404":{"description":"not found"}},"security":[{"bearer":[]}],"tags":["Payroll"]},"patch":{"operationId":"payroll_work_classes_update","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the work class after the change"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs payroll.manage)"},"404":{"description":"not found"},"422":{"description":"validation_failed: the field named in details"}},"security":[{"bearer":[]}],"tags":["Payroll"]}},"/payroll/year_end/{year}/t4.xml":{"get":{"operationId":"payroll_year_end_t4_xml","parameters":[{"description":"tax year, four digits (one CRA has a saved schema for)","in":"path","name":"year","required":true,"schema":{"type":"string"}},{"description":"O original (default) or A amended","in":"query","name":"report_type","required":false,"schema":{"type":"string"}},{"description":"comma-separated employee ids; absent = every T4 slip","in":"query","name":"employee_ids","required":false,"schema":{"type":"string"}},{"description":"the reason for an amended file (required with A)","in":"query","name":"amendment_note","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/xml":{"schema":{"type":"string"}}},"description":"the CRA T4 submission: T619 transmittal, slips, summary"},"403":{"description":"needs payroll.manage, and a person (agents never get SINs)"},"422":{"description":"every reason the file cannot be made: business number, filing contact, a SIN, a box, the year"}},"security":[{"bearer":[]}],"tags":["Payroll"]}},"/payroll/year_end/{year}/t4a.xml":{"get":{"operationId":"payroll_year_end_t4a_xml","parameters":[{"description":"tax year, four digits (one CRA has a saved schema for)","in":"path","name":"year","required":true,"schema":{"type":"string"}},{"description":"O original (default) or A amended","in":"query","name":"report_type","required":false,"schema":{"type":"string"}},{"description":"comma-separated employee ids; absent = every T4A slip","in":"query","name":"employee_ids","required":false,"schema":{"type":"string"}},{"description":"the reason for an amended file (required with A)","in":"query","name":"amendment_note","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/xml":{"schema":{"type":"string"}}},"description":"the CRA T4A submission for sub-contractors (box 048)"},"403":{"description":"needs payroll.manage, and a person (agents never get SINs)"},"422":{"description":"every reason the file cannot be made"}},"security":[{"bearer":[]}],"tags":["Payroll"]}},"/price_matrices":{"get":{"operationId":"price_matrices_index","parameters":[{"description":"true: archived matrices too","in":"query","name":"all","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"items":{"type":"object"},"type":"array"}}},"description":"the location's price matrices (active only, without all), with their brackets"},"401":{"description":"unauthenticated"}},"security":[{"bearer":[]}],"tags":["Price matrices"]},"post":{"operationId":"price_matrices_create","parameters":[{"description":"replays the first create with this key","in":"header","name":"idempotency-key","required":false,"schema":{"type":["string","null"]}}],"requestBody":{"content":{"application/json":{"schema":{}}},"required":true},"responses":{"201":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"price matrix created"},"401":{"description":"unauthenticated"},"403":{"description":"needs catalog.write"},"422":{"description":"invalid request"}},"security":[{"bearer":[]}],"tags":["Price matrices"]}},"/price_matrices/{id}":{"get":{"operationId":"price_matrices_show","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the price matrix with its brackets"},"401":{"description":"unauthenticated"},"404":{"description":"not found"}},"security":[{"bearer":[]}],"tags":["Price matrices"]},"patch":{"operationId":"price_matrices_update","parameters":[{"description":"ETag from the last read (plan 105)","in":"header","name":"If-Match","required":false,"schema":{"type":["string","null"]}},{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"price matrix updated"},"401":{"description":"unauthenticated"},"403":{"description":"needs catalog.write"},"404":{"description":"not found"},"412":{"description":"record changed since If-Match; body.current is the record now"},"422":{"description":"invalid request"}},"security":[{"bearer":[]}],"tags":["Price matrices"]}},"/price_matrices/{id}/archive":{"post":{"operationId":"price_matrices_archive","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the matrix, archived when nothing uses it"},"401":{"description":"unauthenticated"},"403":{"description":"needs catalog.write"},"404":{"description":"not found"},"409":{"description":"a location's pricing names the matrix as its default"}},"security":[{"bearer":[]}],"summary":"`POST /price_matrices/{id}/archive`: retires a matrix nothing uses (409 otherwise).","tags":["Price matrices"]}},"/pricing_presets":{"get":{"operationId":"pricing_presets_index","parameters":[{"description":"the presets of one location; absent: the shop's","in":"query","name":"location_id","required":false,"schema":{"format":"int64","type":"integer"}},{"description":"fee or discount","in":"query","name":"kind","required":false,"schema":{"type":"string"}},{"description":"true: trashed presets too","in":"query","name":"all","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"items":{"type":"object"},"type":"array"}}},"description":"the shop's pricing presets, the location's shop-supplies rule first (rule: true, read only)"},"401":{"description":"unauthenticated"}},"security":[{"bearer":[]}],"tags":["Pricing presets"]},"post":{"operationId":"pricing_presets_create","parameters":[{"description":"replays the first create with this key","in":"header","name":"idempotency-key","required":false,"schema":{"type":["string","null"]}}],"requestBody":{"content":{"application/json":{"schema":{}}},"required":true},"responses":{"201":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"pricing preset created"},"401":{"description":"unauthenticated"},"403":{"description":"needs catalog.write"},"422":{"description":"invalid request"}},"security":[{"bearer":[]}],"tags":["Pricing presets"]}},"/pricing_presets/{id}":{"get":{"operationId":"pricing_presets_show","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the pricing preset"},"401":{"description":"unauthenticated"},"404":{"description":"not found"}},"security":[{"bearer":[]}],"tags":["Pricing presets"]},"patch":{"operationId":"pricing_presets_update","parameters":[{"description":"ETag from the last read (plan 105)","in":"header","name":"If-Match","required":false,"schema":{"type":["string","null"]}},{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"pricing preset updated"},"401":{"description":"unauthenticated"},"403":{"description":"needs catalog.write"},"404":{"description":"not found"},"412":{"description":"record changed since If-Match; body.current is the record now"},"422":{"description":"invalid request"}},"security":[{"bearer":[]}],"tags":["Pricing presets"]}},"/pricing_presets/{id}/archive":{"post":{"operationId":"pricing_presets_archive","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the preset, trashed"},"401":{"description":"unauthenticated"},"403":{"description":"needs catalog.write"},"404":{"description":"not found"}},"security":[{"bearer":[]}],"summary":"`POST /pricing_presets/{id}/archive`: retires the preset; the lines made\nfrom it keep their own copy.","tags":["Pricing presets"]}},"/product_lines":{"get":{"operationId":"product_lines_index","responses":{"200":{"content":{"application/json":{"schema":{"items":{"type":"object"},"type":"array"}}},"description":"every product line (FoxPro INVPROD) as `{ code, description }`, in code order"},"401":{"description":"unauthenticated"}},"security":[{"bearer":[]}],"tags":["Parts"]}},"/purchase_orders":{"get":{"operationId":"purchase_orders_index","parameters":[{"description":"only this status (draft, sent, partial, received, closed, cancelled)","in":"query","name":"status","required":false,"schema":{"type":"string"}},{"description":"only this vendor's orders","in":"query","name":"vendor_id","required":false,"schema":{"format":"int64","type":"integer"}},{"description":"only this location's orders","in":"query","name":"location_id","required":false,"schema":{"format":"int64","type":"integer"}},{"description":"orders with a line of this part","in":"query","name":"part_id","required":false,"schema":{"format":"int64","type":"integer"}},{"description":"true: only the open statuses (draft, sent, partial)","in":"query","name":"open_only","required":false,"schema":{"type":"boolean"}},{"description":"1-100, default 50","in":"query","name":"limit","required":false,"schema":{"format":"int64","type":"integer"}},{"description":"rows to skip","in":"query","name":"offset","required":false,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"`{data, total, next_offset}`: orders newest first, each with line_count and total_cost_cents"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs costs.view)"},"422":{"description":"validation_failed: status"}},"security":[{"bearer":[]}],"tags":["Parts"]},"post":{"operationId":"purchase_orders_create","requestBody":{"content":{"application/json":{"schema":{"properties":{"expected_on":{"default":null,"description":"When the vendor said they arrive, YYYY-MM-DD","type":["string","null"]},"lines":{"default":[],"description":"One or more lines","items":{"properties":{"description":{"default":null,"description":"A part not in the catalogue: its description","type":["string","null"]},"part_id":{"default":null,"description":"The part ordered (a part in the catalogue)","format":"int64","type":["integer","null"]},"part_number":{"default":null,"description":"A part not in the catalogue: its number (with a description)","type":["string","null"]},"quantity_hundredths":{"description":"Quantity ordered in hundredths (4 units = 400), more than zero","format":"int64","type":"integer"},"unit_cost_cents":{"default":null,"description":"The vendor's unit price in cents; absent = the vendor's last cost, else the part's own","format":"int64","type":["integer","null"]},"work_order_line_item_id":{"default":null,"description":"The work-order part line this is ordered for; it becomes ordered","format":"int64","type":["integer","null"]}},"required":["quantity_hundredths"],"type":"object"},"type":"array"},"location_id":{"default":null,"description":"The location the parts are for; absent = the user's location","format":"int64","type":["integer","null"]},"notes":{"default":null,"description":"Plain-text notes","type":["string","null"]},"vendor_id":{"description":"The vendor the parts are ordered from","format":"int64","type":"integer"},"work_order_id":{"default":null,"description":"The work order the PO is for, if one","format":"int64","type":["integer","null"]}},"required":["vendor_id"],"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the purchase order with its lines and its total_cost_cents"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs inventory.count and costs.view)"},"404":{"description":"no such vendor, location, work order or line"},"409":{"description":"idempotency_key_reused"},"422":{"description":"validation_failed: vendor_id, location_id, expected_on, work_order_id, notes, lines"}},"security":[{"bearer":[]}],"tags":["Parts"]}},"/purchase_orders/{id}":{"get":{"operationId":"purchase_orders_show","parameters":[{"description":"purchase order id","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the purchase order with its lines"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs costs.view)"},"404":{"description":"no such purchase order"}},"security":[{"bearer":[]}],"tags":["Parts"]},"patch":{"operationId":"purchase_orders_update","parameters":[{"description":"purchase order id","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"properties":{"expected_on":{"default":null,"description":"When the vendor said they arrive, YYYY-MM-DD; absent = unchanged, empty = cleared","type":["string","null"]},"lines":{"default":null,"description":"Replaces every line; refused once anything is received","items":{"properties":{"description":{"default":null,"description":"A part not in the catalogue: its description","type":["string","null"]},"part_id":{"default":null,"description":"The part ordered (a part in the catalogue)","format":"int64","type":["integer","null"]},"part_number":{"default":null,"description":"A part not in the catalogue: its number (with a description)","type":["string","null"]},"quantity_hundredths":{"description":"Quantity ordered in hundredths (4 units = 400), more than zero","format":"int64","type":"integer"},"unit_cost_cents":{"default":null,"description":"The vendor's unit price in cents; absent = the vendor's last cost, else the part's own","format":"int64","type":["integer","null"]},"work_order_line_item_id":{"default":null,"description":"The work-order part line this is ordered for; it becomes ordered","format":"int64","type":["integer","null"]}},"required":["quantity_hundredths"],"type":"object"},"type":["array","null"]},"notes":{"default":null,"description":"Plain-text notes; absent = unchanged, empty = cleared","type":["string","null"]}},"required":[],"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the edited purchase order"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs inventory.count and costs.view)"},"404":{"description":"no such purchase order"},"409":{"description":"conflict: a received, closed or cancelled order"},"422":{"description":"validation_failed: expected_on, notes, lines"}},"security":[{"bearer":[]}],"tags":["Parts"]}},"/purchase_orders/{id}/cancel":{"post":{"operationId":"purchase_orders_cancel","parameters":[{"description":"purchase order id","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the cancelled purchase order"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs inventory.count and costs.view)"},"404":{"description":"no such purchase order"},"409":{"description":"conflict: something was received"}},"security":[{"bearer":[]}],"tags":["Parts"]}},"/purchase_orders/{id}/close":{"post":{"operationId":"purchase_orders_close","parameters":[{"description":"purchase order id","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the closed purchase order"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs inventory.count and costs.view)"},"404":{"description":"no such purchase order"},"409":{"description":"conflict: not partially received"}},"security":[{"bearer":[]}],"tags":["Parts"]}},"/purchase_orders/{id}/receive":{"post":{"operationId":"purchase_orders_receive","parameters":[{"description":"purchase order id","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"properties":{"lines":{"default":null,"description":"One line per PO line to receive, in any order; absent lines take the whole open\nquantity","items":{"properties":{"purchase_order_line_id":{"description":"The PO line to receive","format":"int64","type":"integer"},"quantity_hundredths":{"default":null,"description":"The quantity to receive, hundredths; absent = the line's whole open quantity","format":"int64","type":["integer","null"]}},"required":["purchase_order_line_id"],"type":"object"},"type":["array","null"]},"received_on":{"default":null,"description":"The date received, YYYY-MM-DD; absent = the location's today","type":["string","null"]},"vendor_invoice_number":{"default":null,"description":"The vendor's invoice or packing-slip number","type":["string","null"]}},"required":[],"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the part receipt the PO's open quantities became"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs inventory.count and costs.view)"},"404":{"description":"no such purchase order or line"},"409":{"description":"conflict: idempotency_key_reused, or a closed or cancelled order"},"422":{"description":"validation_failed: received_on, vendor_invoice_number, lines, nothing_open"}},"security":[{"bearer":[]}],"tags":["Parts"]}},"/purchase_orders/{id}/send":{"post":{"operationId":"purchase_orders_send","parameters":[{"description":"purchase order id","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the sent purchase order"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs inventory.count and costs.view)"},"404":{"description":"no such purchase order"},"409":{"description":"conflict: not a draft"}},"security":[{"bearer":[]}],"tags":["Parts"]}},"/quickbooks":{"get":{"operationId":"quickbooks_status","responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the connection: connected, state (connected, needs_reconnect, disconnected or none), realm_id, company_name, environment, sync_start, connected_at, last_sync_at, last_error; configured says whether this server has QuickBooks set up"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs reports.view)"}},"security":[{"bearer":[]}],"tags":["QuickBooks"]}},"/quickbooks/accounts":{"get":{"operationId":"quickbooks_accounts","responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the active QuickBooks accounts, by name: id, name, number, kind"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs ledger.manage)"},"409":{"description":"QuickBooks is not connected, or QuickBooks refused the query"},"503":{"description":"quickbooks_not_configured"}},"security":[{"bearer":[]}],"tags":["QuickBooks"]}},"/quickbooks/connect":{"post":{"operationId":"quickbooks_connect","responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"`{authorize_url}`: the page to open in the browser where the user is signed in to Wenmar; it goes on to Intuit"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs ledger.manage; never an agent token)"},"503":{"description":"quickbooks_not_configured"}},"security":[{"bearer":[]}],"tags":["QuickBooks"]}},"/quickbooks/disconnect":{"post":{"operationId":"quickbooks_disconnect","responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the connection after disconnecting (state disconnected)"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs ledger.manage)"},"404":{"description":"QuickBooks was never connected"}},"security":[{"bearer":[]}],"tags":["QuickBooks"]}},"/quickbooks/items":{"get":{"operationId":"quickbooks_items","responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the active QuickBooks items, by name: id, name, number (empty), kind (the item type)"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs ledger.manage)"},"409":{"description":"QuickBooks is not connected, or QuickBooks refused the query"},"503":{"description":"quickbooks_not_configured"}},"security":[{"bearer":[]}],"tags":["QuickBooks"]}},"/quickbooks/links":{"get":{"operationId":"quickbooks_links_index","parameters":[{"description":"synced, warning, voided, error or skipped","in":"query","name":"state","required":false,"schema":{"type":"string"}},{"description":"customer, vendor, invoice, credit_memo, payment, bill or bill_payment","in":"query","name":"entity","required":false,"schema":{"type":"string"}},{"description":"at most this many rows (default 100, max 500)","in":"query","name":"limit","required":false,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the links, newest first: entity, wenmar_id, qbo_id, sync_token, state, message, totals, attempts, synced_at, updated_at"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs reports.view)"},"422":{"description":"validation_failed: state or entity"}},"security":[{"bearer":[]}],"tags":["QuickBooks"]}},"/quickbooks/links/{entity}/{id}/retry":{"post":{"operationId":"quickbooks_links_retry","parameters":[{"description":"customer, vendor, invoice, credit_memo, payment, bill or bill_payment","in":"path","name":"entity","required":true,"schema":{"type":"string"}},{"description":"the Wenmar id of the document or name","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the link, to be sent again by the next sweep"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs ledger.manage)"},"404":{"description":"no such link"},"422":{"description":"validation_failed: entity"}},"security":[{"bearer":[]}],"tags":["QuickBooks"]}},"/quickbooks/maps":{"get":{"operationId":"quickbooks_maps_index","responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the maps: kind, key, qbo_id, qbo_name, auto"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs reports.view)"}},"security":[{"bearer":[]}],"tags":["QuickBooks"]}},"/quickbooks/maps/{kind}/{key}":{"delete":{"operationId":"quickbooks_maps_clear","parameters":[{"description":"item, tax_code, account, deposit or bank","in":"path","name":"kind","required":true,"schema":{"type":"string"}},{"description":"the Wenmar key","in":"path","name":"key","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"the map row is removed"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs ledger.manage)"},"404":{"description":"no such map"}},"security":[{"bearer":[]}],"tags":["QuickBooks"]},"put":{"operationId":"quickbooks_maps_set","parameters":[{"description":"item, tax_code, account, deposit or bank","in":"path","name":"kind","required":true,"schema":{"type":"string"}},{"description":"the Wenmar key: labor, part, sublet, fee, discount, freight or other for items; gst_pst, gst, pst or none for tax codes; a chart account number otherwise","in":"path","name":"key","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the map row"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs ledger.manage)"},"422":{"description":"validation_failed: kind, key, qbo_id"}},"security":[{"bearer":[]}],"tags":["QuickBooks"]}},"/quickbooks/settings":{"patch":{"operationId":"quickbooks_settings_update","requestBody":{"content":{"application/json":{"schema":{"type":"object"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the connection after the change"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs ledger.manage)"},"404":{"description":"QuickBooks was never connected"},"422":{"description":"validation_failed: sync_start must be a date YYYY-MM-DD"}},"security":[{"bearer":[]}],"tags":["QuickBooks"]}},"/quickbooks/sync":{"post":{"operationId":"quickbooks_sync_now","responses":{"202":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"`{job_id}`: the sweep of this account is queued; the worker runs it"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs ledger.manage)"},"409":{"description":"QuickBooks is not connected"},"503":{"description":"quickbooks_not_configured"}},"security":[{"bearer":[]}],"tags":["QuickBooks"]}},"/quickbooks/tax_codes":{"get":{"operationId":"quickbooks_tax_codes","responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the active QuickBooks tax codes, by name: id, name"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs ledger.manage)"},"409":{"description":"QuickBooks is not connected, or QuickBooks refused the query"},"503":{"description":"quickbooks_not_configured"}},"security":[{"bearer":[]}],"tags":["QuickBooks"]}},"/recent_searches":{"get":{"operationId":"recent_searches_index","parameters":[{"description":"rows, 1 to 50 (default 20)","in":"query","name":"limit","required":false,"schema":{"minimum":0,"type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"items":{"type":"object"},"type":"array"}}},"description":"the caller's recent searches, newest first"},"401":{"description":"unauthenticated"}},"security":[{"bearer":[]}],"tags":["Search"]},"post":{"operationId":"recent_searches_create","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RecordRecentSearchBody"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the stored row"},"401":{"description":"unauthenticated"},"403":{"description":"an agent keeps no recent list"},"422":{"description":"invalid row"}},"security":[{"bearer":[]}],"tags":["Search"]}},"/recent_searches/hits":{"get":{"operationId":"recent_searches_hits","parameters":[{"description":"rows, 1 to 50 (default 20)","in":"query","name":"limit","required":false,"schema":{"minimum":0,"type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"items":{"type":"object"},"type":"array"}}},"description":"the recent records as live search hits, newest first"},"401":{"description":"unauthenticated"}},"security":[{"bearer":[]}],"tags":["Search"]}},"/reminder_rules":{"get":{"operationId":"reminder_rules_index","responses":{"200":{"content":{"application/json":{"schema":{"items":{"type":"object"},"type":"array"}}},"description":"every reminder rule in code order: code, description, kind, service_key, active, interval_days, interval_km"},"401":{"description":"unauthenticated"}},"security":[{"bearer":[]}],"tags":["Appointments"]}},"/reminder_rules/{code}":{"delete":{"operationId":"reminder_rules_delete","parameters":[{"description":"the appointment code","in":"path","name":"code","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"`{ code, deleted: true }`"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs catalog.write)"},"404":{"description":"no such reminder rule"}},"security":[{"bearer":[]}],"tags":["Appointments"]},"put":{"operationId":"reminder_rules_set","parameters":[{"description":"the appointment code","in":"path","name":"code","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"properties":{"active":{"default":null,"description":"false pauses the rule (default true)","type":["boolean","null"]},"kind":{"default":null,"description":"service, tires, inspection or other (default service)","type":["string","null"]},"service_key":{"default":null,"description":"The work that resets it when an order posts: a job key such as maintenance.oil_change, or\na category key such as tires. Empty = posting never resets it.","type":["string","null"]}},"required":[],"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the stored rule"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs catalog.write)"},"404":{"description":"no such appointment code"},"422":{"description":"validation_failed: kind, service_key"}},"security":[{"bearer":[]}],"tags":["Appointments"]}},"/removed_services/{id}/restore":{"post":{"operationId":"removed_service_restore","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"properties":{},"required":[],"type":"object"}}},"required":false},"responses":{"201":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the service back, as GET /services/{id} answers it (Idempotency-Key replays it)"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized or another location's work order"},"404":{"description":"the copy is gone: never there, used, or older than a day"},"409":{"description":"already_posted or work_order_not_editable"},"422":{"description":"idempotency_key_reused"}},"security":[{"bearer":[]}],"tags":["Work Orders"]}},"/reports/ap_aging":{"get":{"operationId":"reports_ap_aging","parameters":[{"description":"YYYY-MM-DD: bills dated on or before it, what they still owe on it","in":"query","name":"as_of","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"A/P aging table: each vendor or payee in the buckets current, 1-30, 31-60, 61-90 and over 90 days past due"},"403":{"description":"needs reports.view"},"422":{"description":"invalid as_of"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/ap_aging/pdf":{"get":{"operationId":"reports_ap_aging_pdf","parameters":[{"description":"YYYY-MM-DD","in":"query","name":"as_of","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"A/P aging PDF"},"403":{"description":"needs reports.view"},"422":{"description":"invalid as_of"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/appointment_codes/text":{"get":{"operationId":"reports_appointment_codes_text","responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the Appointment Code List (SECODER) as a text report"},"401":{"description":"unauthenticated"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/appointment_codes/text/pdf":{"get":{"operationId":"reports_appointment_codes_text_pdf","parameters":[{"description":"portrait|landscape for pages wider than 80 columns","in":"query","name":"orientation","required":false,"schema":{"type":"string"}},{"description":"actual|page for pages wider than 80 columns","in":"query","name":"fit","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"the Appointment Code List as a fixed-pitch PDF"},"401":{"description":"unauthenticated"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/ar_aging":{"get":{"operationId":"reports_ar_aging","parameters":[{"description":"base date YYYY-MM-DD (required)","in":"query","name":"as_of","required":true,"schema":{"type":"string"}},{"description":"detail (default) | summary | salesperson","in":"query","name":"mode","required":false,"schema":{"type":"string"}},{"description":"salesperson code (required for salesperson)","in":"query","name":"sales_code","required":false,"schema":{"type":"string"}},{"description":"Y prints a miscellaneous (…999) item's own name; default N","in":"query","name":"names","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the aging report"},"401":{"description":"unauthenticated"},"403":{"description":"needs reports.view and customers.read"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/ar_aging/pdf":{"get":{"operationId":"reports_ar_aging_pdf","parameters":[{"description":"base date YYYY-MM-DD (required)","in":"query","name":"as_of","required":true,"schema":{"type":"string"}},{"description":"detail (default) | summary | salesperson","in":"query","name":"mode","required":false,"schema":{"type":"string"}},{"description":"salesperson code","in":"query","name":"sales_code","required":false,"schema":{"type":"string"}},{"description":"Y prints a miscellaneous (…999) item's own name; default N","in":"query","name":"names","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"the aging report as a PDF"},"401":{"description":"unauthenticated"},"403":{"description":"needs reports.view and customers.read"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/ar_aging/text":{"get":{"operationId":"reports_ar_aging_text","parameters":[{"description":"base date YYYY-MM-DD (required)","in":"query","name":"as_of","required":true,"schema":{"type":"string"}},{"description":"detail (default) | summary | salesperson","in":"query","name":"mode","required":false,"schema":{"type":"string"}},{"description":"salesperson code (required for salesperson)","in":"query","name":"sales_code","required":false,"schema":{"type":"string"}},{"description":"Y prints a miscellaneous (…999) item's own name; default N","in":"query","name":"names","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the aging report as a text report (FoxPro ARAGE: 132-column printer pages and 80-column screen pages)"},"401":{"description":"unauthenticated"},"403":{"description":"needs reports.view and customers.read"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/ar_aging/text/pdf":{"get":{"operationId":"reports_ar_aging_text_pdf","parameters":[{"description":"base date YYYY-MM-DD (required)","in":"query","name":"as_of","required":true,"schema":{"type":"string"}},{"description":"detail (default) | summary | salesperson","in":"query","name":"mode","required":false,"schema":{"type":"string"}},{"description":"salesperson code (required for salesperson)","in":"query","name":"sales_code","required":false,"schema":{"type":"string"}},{"description":"Y prints a miscellaneous (…999) item's own name; default N","in":"query","name":"names","required":false,"schema":{"type":"string"}},{"description":"portrait|landscape for pages wider than 80 columns (default: the location's reports.print setting, else landscape)","in":"query","name":"orientation","required":false,"schema":{"type":"string"}},{"description":"actual|page for pages wider than 80 columns (default: the setting, else page)","in":"query","name":"fit","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"the aging report as a fixed-pitch PDF"},"401":{"description":"unauthenticated"},"403":{"description":"needs reports.view and customers.read"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/ar_charge_codes/text":{"get":{"operationId":"reports_ar_charge_codes_text","responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the charge code list as a text report (FoxPro ARCHGLIS); no pages when the table is empty"},"401":{"description":"unauthenticated"},"403":{"description":"needs reports.view"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/ar_charge_codes/text/pdf":{"get":{"operationId":"reports_ar_charge_codes_text_pdf","parameters":[{"description":"portrait|landscape for pages wider than 80 columns (no effect here)","in":"query","name":"orientation","required":false,"schema":{"type":"string"}},{"description":"actual|page for pages wider than 80 columns (no effect here)","in":"query","name":"fit","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"the same list as a fixed-pitch PDF"},"401":{"description":"unauthenticated"},"403":{"description":"needs reports.view"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/ar_customer_list/sales_codes":{"get":{"operationId":"reports_ar_customer_list_sales_codes","responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"`{ codes }`: the distinct salesperson codes of the listed customers, in byte order"},"401":{"description":"unauthenticated"},"403":{"description":"needs reports.view and customers.read"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/ar_customer_list/text":{"get":{"operationId":"reports_ar_customer_list_text","parameters":[{"description":"1-6: name detailed, name summary, number detailed, number summary, salesperson detailed, salesperson summary (required)","in":"query","name":"list","required":true,"schema":{"type":"string"}},{"description":"lists 5 and 6: one salesperson code; blank or *** = every salesperson","in":"query","name":"sales_code","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"a customer list as a text report (FoxPro ARCUSLIS 1-6); no pages when no customer matches"},"401":{"description":"unauthenticated"},"403":{"description":"needs reports.view and customers.read"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/ar_customer_list/text/pdf":{"get":{"operationId":"reports_ar_customer_list_text_pdf","parameters":[{"description":"1-6 (required)","in":"query","name":"list","required":true,"schema":{"type":"string"}},{"description":"lists 5 and 6: one salesperson code; blank or *** = every salesperson","in":"query","name":"sales_code","required":false,"schema":{"type":"string"}},{"description":"portrait|landscape for pages wider than 80 columns (no effect here)","in":"query","name":"orientation","required":false,"schema":{"type":"string"}},{"description":"actual|page for pages wider than 80 columns (no effect here)","in":"query","name":"fit","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"the same list as a fixed-pitch PDF"},"401":{"description":"unauthenticated"},"403":{"description":"needs reports.view and customers.read"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/ar_inquiry/text":{"get":{"operationId":"reports_ar_inquiry_text","parameters":[{"description":"the customer (required)","in":"query","name":"customer_id","required":true,"schema":{"format":"int64","type":"integer"}},{"description":"open (default) | history | cheque","in":"query","name":"kind","required":false,"schema":{"type":"string"}},{"description":"open, history: first row date YYYY-MM-DD (required)","in":"query","name":"from","required":false,"schema":{"type":"string"}},{"description":"open, history: last row date YYYY-MM-DD (required)","in":"query","name":"to","required":false,"schema":{"type":"string"}},{"description":"cheque: the cheque or transaction number (required, 8 characters at most)","in":"query","name":"cheque","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the inquiry print or cheque list as a text report (FoxPro ARINQ [P]rint, [C]heque List); no pages when no row matches"},"401":{"description":"unauthenticated"},"403":{"description":"needs reports.view and customers.read"},"404":{"description":"unknown customer"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/ar_inquiry/text/pdf":{"get":{"operationId":"reports_ar_inquiry_text_pdf","parameters":[{"description":"the customer (required)","in":"query","name":"customer_id","required":true,"schema":{"format":"int64","type":"integer"}},{"description":"open (default) | history | cheque","in":"query","name":"kind","required":false,"schema":{"type":"string"}},{"description":"open, history: first row date YYYY-MM-DD (required)","in":"query","name":"from","required":false,"schema":{"type":"string"}},{"description":"open, history: last row date YYYY-MM-DD (required)","in":"query","name":"to","required":false,"schema":{"type":"string"}},{"description":"cheque: the cheque or transaction number","in":"query","name":"cheque","required":false,"schema":{"type":"string"}},{"description":"portrait|landscape for pages wider than 80 columns (no effect here)","in":"query","name":"orientation","required":false,"schema":{"type":"string"}},{"description":"actual|page for pages wider than 80 columns (no effect here)","in":"query","name":"fit","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"the same listing as a fixed-pitch PDF"},"401":{"description":"unauthenticated"},"403":{"description":"needs reports.view and customers.read"},"404":{"description":"unknown customer"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/ar_labels/text":{"get":{"operationId":"reports_ar_labels_text","parameters":[{"description":"starting customer number (required; must be on file)","in":"query","name":"from","required":true,"schema":{"type":"string"}},{"description":"ending customer number (blank = the starting number)","in":"query","name":"to","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"address labels, two across, ten rows a page, as a text report (FoxPro ARCUSLIS 7); no screen pages"},"401":{"description":"unauthenticated"},"403":{"description":"needs reports.view and customers.read"},"422":{"description":"from missing, greater than to, or not on file (details.from holds FoxPro's text)"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/ar_labels/text/pdf":{"get":{"operationId":"reports_ar_labels_text_pdf","parameters":[{"description":"starting customer number (required; must be on file)","in":"query","name":"from","required":true,"schema":{"type":"string"}},{"description":"ending customer number (blank = the starting number)","in":"query","name":"to","required":false,"schema":{"type":"string"}},{"description":"portrait|landscape for pages wider than 80 columns (no effect here)","in":"query","name":"orientation","required":false,"schema":{"type":"string"}},{"description":"actual|page for pages wider than 80 columns (no effect here)","in":"query","name":"fit","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"the same labels as a fixed-pitch PDF"},"401":{"description":"unauthenticated"},"403":{"description":"needs reports.view and customers.read"},"422":{"description":"invalid range"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/ar_terms_list/text":{"get":{"operationId":"reports_ar_terms_list_text","responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the payment terms list as a text report (FoxPro ARPAYLIS); no pages when the table is empty"},"401":{"description":"unauthenticated"},"403":{"description":"needs reports.view"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/ar_terms_list/text/pdf":{"get":{"operationId":"reports_ar_terms_list_text_pdf","parameters":[{"description":"portrait|landscape for pages wider than 80 columns (no effect here)","in":"query","name":"orientation","required":false,"schema":{"type":"string"}},{"description":"actual|page for pages wider than 80 columns (no effect here)","in":"query","name":"fit","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"the same list as a fixed-pitch PDF"},"401":{"description":"unauthenticated"},"403":{"description":"needs reports.view"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/balance_sheet":{"get":{"operationId":"reports_balance_sheet","parameters":[{"description":"YYYY-MM-DD","in":"query","name":"as_of","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"balance sheet table"},"403":{"description":"needs reports.view"},"422":{"description":"invalid as_of"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/balance_sheet/pdf":{"get":{"operationId":"reports_balance_sheet_pdf","parameters":[{"description":"YYYY-MM-DD","in":"query","name":"as_of","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"balance sheet PDF"},"403":{"description":"needs reports.view"},"422":{"description":"invalid as_of"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/cancelled_orders":{"get":{"operationId":"reports_cancelled_orders","parameters":[{"description":"first cancel date YYYY-MM-DD","in":"query","name":"from","required":true,"schema":{"type":"string"}},{"description":"last cancel date YYYY-MM-DD","in":"query","name":"to","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"cancelled orders as a report table"},"401":{"description":"unauthenticated"},"403":{"description":"needs reports.view and customers.read"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/cancelled_orders/pdf":{"get":{"operationId":"reports_cancelled_orders_pdf","parameters":[{"description":"first cancel date YYYY-MM-DD","in":"query","name":"from","required":true,"schema":{"type":"string"}},{"description":"last cancel date YYYY-MM-DD","in":"query","name":"to","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"cancelled orders as a PDF"},"401":{"description":"unauthenticated"},"403":{"description":"needs reports.view and customers.read"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/cash_receipts/text":{"get":{"operationId":"reports_cash_receipts_text","parameters":[{"description":"date (default) | customer | code","in":"query","name":"by","required":false,"schema":{"type":"string"}},{"description":"summary (default) | detail; not with by=code","in":"query","name":"form","required":false,"schema":{"type":"string"}},{"description":"first receipt date YYYY-MM-DD (required)","in":"query","name":"from","required":true,"schema":{"type":"string"}},{"description":"last receipt date YYYY-MM-DD (required)","in":"query","name":"to","required":true,"schema":{"type":"string"}},{"description":"by=customer: the customer number (required)","in":"query","name":"customer_number","required":false,"schema":{"type":"string"}},{"description":"by=date: 1 (default), 2, 3, or 0 for every bank","in":"query","name":"bank","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the Cash Receipts Journal as a text report (FoxPro ARCASHR options 2-4); no pages when no receipt matches"},"401":{"description":"unauthenticated"},"403":{"description":"needs reports.view"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/cash_receipts/text/pdf":{"get":{"operationId":"reports_cash_receipts_text_pdf","parameters":[{"description":"date (default) | customer | code","in":"query","name":"by","required":false,"schema":{"type":"string"}},{"description":"summary (default) | detail; not with by=code","in":"query","name":"form","required":false,"schema":{"type":"string"}},{"description":"first receipt date YYYY-MM-DD (required)","in":"query","name":"from","required":true,"schema":{"type":"string"}},{"description":"last receipt date YYYY-MM-DD (required)","in":"query","name":"to","required":true,"schema":{"type":"string"}},{"description":"by=customer: the customer number (required)","in":"query","name":"customer_number","required":false,"schema":{"type":"string"}},{"description":"by=date: 1 (default), 2, 3, or 0 for every bank","in":"query","name":"bank","required":false,"schema":{"type":"string"}},{"description":"portrait|landscape for the detail form (default: the location's reports.print setting, else landscape)","in":"query","name":"orientation","required":false,"schema":{"type":"string"}},{"description":"actual|page for the detail form (default: the setting, else page)","in":"query","name":"fit","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"the same listing as a fixed-pitch PDF"},"401":{"description":"unauthenticated"},"403":{"description":"needs reports.view"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/catalogue":{"get":{"operationId":"reports_catalogue","responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"{entries: [{key, group, title, question, params: [{name, kind, required, default, choices}], kind, path}]}: the reports this user may open"},"401":{"description":"unauthenticated"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/chart_of_accounts/text":{"get":{"operationId":"reports_chart_of_accounts_text","responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the Chart of Accounts (FoxPro GLACNTR) as a text report; no pages when the chart is empty"},"401":{"description":"unauthenticated"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/chart_of_accounts/text/pdf":{"get":{"operationId":"reports_chart_of_accounts_text_pdf","parameters":[{"description":"portrait|landscape for pages wider than 80 columns (no effect here)","in":"query","name":"orientation","required":false,"schema":{"type":"string"}},{"description":"actual|page for pages wider than 80 columns (no effect here)","in":"query","name":"fit","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"the Chart of Accounts as a fixed-pitch PDF"},"401":{"description":"unauthenticated"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/compare":{"get":{"operationId":"reports_compare","parameters":[{"description":"revenue | labour | parts | invoice_count | hours_sold | average_ticket","in":"query","name":"metric","required":false,"schema":{"type":["string","null"]}},{"description":"a period name: today, yesterday, this_week, last_week, this_month, last_month,\nthis_quarter, last_quarter, this_year, last_year, year_to_date, last_30_days","in":"query","name":"period_a","required":false,"schema":{"type":["string","null"]}},{"description":"a period name, same_period_last_year (the default), previous_period","in":"query","name":"period_b","required":false,"schema":{"type":["string","null"]}},{"description":"period A's first day YYYY-MM-DD (with `a_to`, instead of `period_a`)","in":"query","name":"a_from","required":false,"schema":{"type":["string","null"]}},{"description":"period A's last day YYYY-MM-DD","in":"query","name":"a_to","required":false,"schema":{"type":["string","null"]}},{"description":"period B's first day YYYY-MM-DD (with `b_to`, instead of `period_b`)","in":"query","name":"b_from","required":false,"schema":{"type":["string","null"]}},{"description":"period B's last day YYYY-MM-DD","in":"query","name":"b_to","required":false,"schema":{"type":["string","null"]}},{"description":"service_category (the default) | technician | none","in":"query","name":"by","required":false,"schema":{"type":["string","null"]}},{"description":"a category key or name, e.g. brakes","in":"query","name":"service_category","required":false,"schema":{"type":["string","null"]}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the two periods, a row per group and the total"},"401":{"description":"unauthenticated"},"403":{"description":"needs reports.view"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"summary":"`GET /reports/compare` (plan 1493): one measure over two periods, grouped, with the\ndifference computed by the server.","tags":["Reports"]}},"/reports/credit_applied/text":{"get":{"operationId":"reports_credit_applied_text","parameters":[{"description":"date (default) | customer","in":"query","name":"by","required":false,"schema":{"type":"string"}},{"description":"first applied date YYYY-MM-DD (required)","in":"query","name":"from","required":true,"schema":{"type":"string"}},{"description":"last applied date YYYY-MM-DD (required)","in":"query","name":"to","required":true,"schema":{"type":"string"}},{"description":"by=customer: the customer number, compared as typed (required)","in":"query","name":"customer_number","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the Credit Applied Journal as a text report (FoxPro ARCREDR); no pages when nothing was applied in the range"},"401":{"description":"unauthenticated"},"403":{"description":"needs reports.view"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/credit_applied/text/pdf":{"get":{"operationId":"reports_credit_applied_text_pdf","parameters":[{"description":"date (default) | customer","in":"query","name":"by","required":false,"schema":{"type":"string"}},{"description":"first applied date YYYY-MM-DD (required)","in":"query","name":"from","required":true,"schema":{"type":"string"}},{"description":"last applied date YYYY-MM-DD (required)","in":"query","name":"to","required":true,"schema":{"type":"string"}},{"description":"by=customer: the customer number (required)","in":"query","name":"customer_number","required":false,"schema":{"type":"string"}},{"description":"portrait|landscape for pages wider than 80 columns (no effect here)","in":"query","name":"orientation","required":false,"schema":{"type":"string"}},{"description":"actual|page for pages wider than 80 columns (no effect here)","in":"query","name":"fit","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"the same listing as a fixed-pitch PDF"},"401":{"description":"unauthenticated"},"403":{"description":"needs reports.view"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/customer_vehicles/text":{"get":{"operationId":"reports_customer_vehicles_text","parameters":[{"description":"the customer (required)","in":"query","name":"customer_id","required":true,"schema":{"format":"int64","type":"integer"}},{"description":"license (default) | id_number","in":"query","name":"order","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the customer's vehicles as a text report (FoxPro ARCUSTED [V] [P]); no pages when there is none"},"401":{"description":"unauthenticated"},"403":{"description":"needs reports.view and customers.read"},"404":{"description":"unknown customer"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/customer_vehicles/text/pdf":{"get":{"operationId":"reports_customer_vehicles_text_pdf","parameters":[{"description":"the customer (required)","in":"query","name":"customer_id","required":true,"schema":{"format":"int64","type":"integer"}},{"description":"license (default) | id_number","in":"query","name":"order","required":false,"schema":{"type":"string"}},{"description":"portrait|landscape for pages wider than 80 columns (no effect here)","in":"query","name":"orientation","required":false,"schema":{"type":"string"}},{"description":"actual|page for pages wider than 80 columns (no effect here)","in":"query","name":"fit","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"the same list as a fixed-pitch PDF"},"401":{"description":"unauthenticated"},"403":{"description":"needs reports.view and customers.read"},"404":{"description":"unknown customer"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/declined_work":{"get":{"operationId":"reports_declined_work","parameters":[{"description":"first decline date YYYY-MM-DD","in":"query","name":"from","required":true,"schema":{"type":"string"}},{"description":"last decline date YYYY-MM-DD","in":"query","name":"to","required":true,"schema":{"type":"string"}},{"description":"only = just the services done later","in":"query","name":"recovered","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"declined work as a report table"},"401":{"description":"unauthenticated"},"403":{"description":"needs reports.view and customers.read"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/declined_work/pdf":{"get":{"operationId":"reports_declined_work_pdf","parameters":[{"description":"first decline date YYYY-MM-DD","in":"query","name":"from","required":true,"schema":{"type":"string"}},{"description":"last decline date YYYY-MM-DD","in":"query","name":"to","required":true,"schema":{"type":"string"}},{"description":"only = just the services done later","in":"query","name":"recovered","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"declined work as a PDF"},"401":{"description":"unauthenticated"},"403":{"description":"needs reports.view and customers.read"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/estimate_outcomes":{"get":{"operationId":"reports_estimate_outcomes","parameters":[{"description":"first estimate date YYYY-MM-DD","in":"query","name":"from","required":true,"schema":{"type":"string"}},{"description":"last estimate date YYYY-MM-DD","in":"query","name":"to","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"estimate outcomes as a report table"},"401":{"description":"unauthenticated"},"403":{"description":"needs reports.view and customers.read"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/estimate_outcomes/pdf":{"get":{"operationId":"reports_estimate_outcomes_pdf","parameters":[{"description":"first estimate date YYYY-MM-DD","in":"query","name":"from","required":true,"schema":{"type":"string"}},{"description":"last estimate date YYYY-MM-DD","in":"query","name":"to","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"estimate outcomes as a PDF"},"401":{"description":"unauthenticated"},"403":{"description":"needs reports.view and customers.read"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/glance":{"get":{"operationId":"reports_glance","parameters":[{"description":"a named period: today, this_week, this_month (default), this_year, …","in":"query","name":"period","required":false,"schema":{"type":["string","null"]}},{"description":"the period's first day YYYY-MM-DD (with `to`, instead of `period`)","in":"query","name":"from","required":false,"schema":{"type":["string","null"]}},{"description":"the period's last day YYYY-MM-DD","in":"query","name":"to","required":false,"schema":{"type":["string","null"]}},{"description":"one location; blank = every location the caller may see","in":"query","name":"location_id","required":false,"schema":{"format":"int64","type":["integer","null"]}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the board's figures for the period and the one before"},"401":{"description":"unauthenticated"},"403":{"description":"needs reports.view"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"summary":"`GET /reports/glance` (plan 2604): the shop's key figures for a period and\na location — sales against the period before, posted work orders, gross\nprofit, effective labour rate, technician hours, sales by day, money owed\nby age, most sold services, and estimate outcomes.","tags":["Reports"]}},"/reports/gst_hst_return":{"get":{"operationId":"reports_gst_hst_return","parameters":[{"description":"YYYY-MM-DD","in":"query","name":"from","required":true,"schema":{"type":"string"}},{"description":"YYYY-MM-DD","in":"query","name":"to","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"GST/HST return table: lines 101, 105, 108 and 109"},"403":{"description":"needs reports.view"},"422":{"description":"invalid period"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/gst_hst_return/pdf":{"get":{"operationId":"reports_gst_hst_return_pdf","parameters":[{"description":"YYYY-MM-DD","in":"query","name":"from","required":true,"schema":{"type":"string"}},{"description":"YYYY-MM-DD","in":"query","name":"to","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"GST/HST return PDF"},"403":{"description":"needs reports.view"},"422":{"description":"invalid period"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/income_statement":{"get":{"operationId":"reports_income_statement","parameters":[{"description":"YYYY-MM-DD","in":"query","name":"from","required":true,"schema":{"type":"string"}},{"description":"YYYY-MM-DD","in":"query","name":"to","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"income statement table"},"403":{"description":"needs reports.view"},"422":{"description":"invalid period"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/income_statement/pdf":{"get":{"operationId":"reports_income_statement_pdf","parameters":[{"description":"YYYY-MM-DD","in":"query","name":"from","required":true,"schema":{"type":"string"}},{"description":"YYYY-MM-DD","in":"query","name":"to","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"income statement PDF"},"403":{"description":"needs reports.view"},"422":{"description":"invalid period"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/inv_adjustments":{"get":{"operationId":"reports_inv_adjustments","parameters":[{"description":"first date of the range, YYYY-MM-DD (required)","in":"query","name":"from","required":true,"schema":{"type":"string"}},{"description":"last date of the range, YYYY-MM-DD (required)","in":"query","name":"to","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the inventory adjustments of the date range as a table; the cost columns need costs.view"},"403":{"description":"needs reports.view"},"422":{"description":"invalid dates"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/inv_adjustments/pdf":{"get":{"operationId":"reports_inv_adjustments_pdf","parameters":[{"description":"first date of the range, YYYY-MM-DD (required)","in":"query","name":"from","required":true,"schema":{"type":"string"}},{"description":"last date of the range, YYYY-MM-DD (required)","in":"query","name":"to","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"the adjustments journal table as a PDF"},"403":{"description":"needs reports.view"},"422":{"description":"invalid dates"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/inv_adjustments/text":{"get":{"operationId":"reports_inv_adjustments_text","parameters":[{"description":"first date of the range, YYYY-MM-DD (default: the location's current month)","in":"query","name":"from","required":false,"schema":{"type":"string"}},{"description":"last date of the range, YYYY-MM-DD (default: the location's current month)","in":"query","name":"to","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the inventory adjustments of the date range (FoxPro INVADJR) as a text report: printer pages and screen pages; cost figures blank without costs.view"},"403":{"description":"needs reports.view"},"422":{"description":"invalid dates"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/inv_adjustments/text/pdf":{"get":{"operationId":"reports_inv_adjustments_text_pdf","parameters":[{"description":"first date of the range, YYYY-MM-DD (default: the location's current month)","in":"query","name":"from","required":false,"schema":{"type":"string"}},{"description":"last date of the range, YYYY-MM-DD (default: the location's current month)","in":"query","name":"to","required":false,"schema":{"type":"string"}},{"description":"portrait|landscape for pages wider than 80 columns (default: the location's reports.print setting, else landscape)","in":"query","name":"orientation","required":false,"schema":{"type":"string"}},{"description":"actual|page for pages wider than 80 columns (default: the setting, else page)","in":"query","name":"fit","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"the adjustments journal as a fixed-pitch PDF"},"403":{"description":"needs reports.view"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/inv_classes":{"get":{"operationId":"reports_inv_classes","responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"inventory class list table"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/inv_classes/pdf":{"get":{"operationId":"reports_inv_classes_pdf","responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"inventory class list PDF"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/inv_classes/text":{"get":{"operationId":"reports_inv_classes_text","responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"class list (FoxPro INVCLASR) as a text report: printer and screen pages"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/inv_classes/text/pdf":{"get":{"operationId":"reports_inv_classes_text_pdf","parameters":[{"description":"portrait|landscape for pages wider than 80 columns (default: the location's reports.print setting, else landscape)","in":"query","name":"orientation","required":false,"schema":{"type":"string"}},{"description":"actual|page for pages wider than 80 columns (default: the setting, else page)","in":"query","name":"fit","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"class list as a fixed-pitch PDF"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/inv_list":{"get":{"operationId":"reports_inv_list","parameters":[{"description":"starting class code (default: first)","in":"query","name":"class_from","required":false,"schema":{"type":"string"}},{"description":"ending class code (default: last)","in":"query","name":"class_to","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"inventory list table"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/inv_list/pdf":{"get":{"operationId":"reports_inv_list_pdf","parameters":[{"description":"starting class code","in":"query","name":"class_from","required":false,"schema":{"type":"string"}},{"description":"ending class code","in":"query","name":"class_to","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"inventory list PDF"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/inv_list/text":{"get":{"operationId":"reports_inv_list_text","parameters":[{"description":"starting class code (default: the first class)","in":"query","name":"class_from","required":false,"schema":{"type":"string"}},{"description":"ending class code (default: the last class)","in":"query","name":"class_to","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"inventory list (FoxPro INVLIST) as a text report: printer and screen pages"},"422":{"description":"class_from is not a class"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/inv_list/text/pdf":{"get":{"operationId":"reports_inv_list_text_pdf","parameters":[{"description":"starting class code (default: the first class)","in":"query","name":"class_from","required":false,"schema":{"type":"string"}},{"description":"ending class code (default: the last class)","in":"query","name":"class_to","required":false,"schema":{"type":"string"}},{"description":"portrait|landscape for pages wider than 80 columns (default: the location's reports.print setting, else landscape)","in":"query","name":"orientation","required":false,"schema":{"type":"string"}},{"description":"actual|page for pages wider than 80 columns (default: the setting, else page)","in":"query","name":"fit","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"inventory list as a fixed-pitch PDF"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/inv_part_history":{"get":{"operationId":"reports_inv_part_history","parameters":[{"description":"the part's id (or send number)","in":"query","name":"part_id","required":false,"schema":{"format":"int64","type":"integer"}},{"description":"the part's number, when part_id is not sent","in":"query","name":"number","required":false,"schema":{"type":"string"}},{"description":"first day of the report YYYY-MM-DD (required)","in":"query","name":"from","required":true,"schema":{"type":"string"}},{"description":"last day of the report YYYY-MM-DD (required)","in":"query","name":"to","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"one part's movements as a table: on hand at the start, purchases, sales, adjustments, on hand at the end; cost cells need costs.view"},"403":{"description":"needs reports.view"},"404":{"description":"unknown part"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/inv_part_history/pdf":{"get":{"operationId":"reports_inv_part_history_pdf","parameters":[{"description":"the part's id (or send number)","in":"query","name":"part_id","required":false,"schema":{"format":"int64","type":"integer"}},{"description":"the part's number, when part_id is not sent","in":"query","name":"number","required":false,"schema":{"type":"string"}},{"description":"first day of the report YYYY-MM-DD (required)","in":"query","name":"from","required":true,"schema":{"type":"string"}},{"description":"last day of the report YYYY-MM-DD (required)","in":"query","name":"to","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"the part history table as a PDF"},"403":{"description":"needs reports.view"},"404":{"description":"unknown part"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/inv_part_history/text":{"get":{"operationId":"reports_inv_part_history_text","parameters":[{"description":"the part's id (required)","in":"query","name":"part_id","required":true,"schema":{"format":"int64","type":"integer"}},{"description":"first day of the report YYYY-MM-DD (required)","in":"query","name":"from","required":true,"schema":{"type":"string"}},{"description":"last day of the report YYYY-MM-DD (required)","in":"query","name":"to","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the part history as a text report (FoxPro INVINQ 11.1)"},"401":{"description":"unauthenticated"},"403":{"description":"needs reports.view"},"404":{"description":"unknown part"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/inv_part_history/text/pdf":{"get":{"operationId":"reports_inv_part_history_text_pdf","parameters":[{"description":"the part's id (required)","in":"query","name":"part_id","required":true,"schema":{"format":"int64","type":"integer"}},{"description":"first day of the report YYYY-MM-DD (required)","in":"query","name":"from","required":true,"schema":{"type":"string"}},{"description":"last day of the report YYYY-MM-DD (required)","in":"query","name":"to","required":true,"schema":{"type":"string"}},{"description":"portrait|landscape (default: the location's reports.print setting)","in":"query","name":"orientation","required":false,"schema":{"type":"string"}},{"description":"actual|page (default: the setting, else page)","in":"query","name":"fit","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"the same listing as a fixed-pitch PDF"},"401":{"description":"unauthenticated"},"403":{"description":"needs reports.view"},"404":{"description":"unknown part"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/inv_price_list":{"get":{"operationId":"reports_inv_price_list","parameters":[{"description":"starting class code (default: first)","in":"query","name":"class_from","required":false,"schema":{"type":"string"}},{"description":"ending class code (default: last)","in":"query","name":"class_to","required":false,"schema":{"type":"string"}},{"description":"Y|N (default N)","in":"query","name":"page_per_class","required":false,"schema":{"type":"string"}},{"description":"0-4, A (all), C (all + cost; costs.view); default 1","in":"query","name":"level","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"price list table"},"403":{"description":"level C needs costs.view"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/inv_price_list/pdf":{"get":{"operationId":"reports_inv_price_list_pdf","parameters":[{"description":"starting class code","in":"query","name":"class_from","required":false,"schema":{"type":"string"}},{"description":"ending class code","in":"query","name":"class_to","required":false,"schema":{"type":"string"}},{"description":"Y|N","in":"query","name":"page_per_class","required":false,"schema":{"type":"string"}},{"description":"0-4, A, C","in":"query","name":"level","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"price list PDF"},"403":{"description":"level C needs costs.view"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/inv_price_list/text":{"get":{"operationId":"reports_inv_price_list_text","parameters":[{"description":"starting class code (default: the first class)","in":"query","name":"class_from","required":false,"schema":{"type":"string"}},{"description":"ending class code (default: the last class)","in":"query","name":"class_to","required":false,"schema":{"type":"string"}},{"description":"Y = each class starts a page; anything else = N","in":"query","name":"page_per_class","required":false,"schema":{"type":"string"}},{"description":"0-4, A (all four sell prices), C (A plus cost; cost cells blank without costs.view); default 1","in":"query","name":"level","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"price list (FoxPro INVPRICE) as a text report: printer pages (80 columns at level 0, else 132 condensed) and screen pages"},"422":{"description":"invalid level or class_from"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/inv_price_list/text/pdf":{"get":{"operationId":"reports_inv_price_list_text_pdf","parameters":[{"description":"starting class code (default: the first class)","in":"query","name":"class_from","required":false,"schema":{"type":"string"}},{"description":"ending class code (default: the last class)","in":"query","name":"class_to","required":false,"schema":{"type":"string"}},{"description":"Y = each class starts a page; anything else = N","in":"query","name":"page_per_class","required":false,"schema":{"type":"string"}},{"description":"0-4, A, C; default 1","in":"query","name":"level","required":false,"schema":{"type":"string"}},{"description":"portrait|landscape for pages wider than 80 columns (default: the location's reports.print setting, else landscape)","in":"query","name":"orientation","required":false,"schema":{"type":"string"}},{"description":"actual|page for pages wider than 80 columns (default: the setting, else page)","in":"query","name":"fit","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"price list as a fixed-pitch PDF (one copy)"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/inv_product_lines":{"get":{"operationId":"reports_inv_product_lines","responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"inventory product lines list table"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/inv_product_lines/pdf":{"get":{"operationId":"reports_inv_product_lines_pdf","responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"inventory product lines list PDF"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/inv_product_lines/text":{"get":{"operationId":"reports_inv_product_lines_text","responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"product lines (FoxPro INVPRODR) as a text report: printer and screen pages"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/inv_product_lines/text/pdf":{"get":{"operationId":"reports_inv_product_lines_text_pdf","parameters":[{"description":"portrait|landscape for pages wider than 80 columns (default: the location's reports.print setting, else landscape)","in":"query","name":"orientation","required":false,"schema":{"type":"string"}},{"description":"actual|page for pages wider than 80 columns (default: the setting, else page)","in":"query","name":"fit","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"product lines as a fixed-pitch PDF"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/inv_reorder":{"get":{"operationId":"reports_inv_reorder","parameters":[{"description":"starting class code (default: first)","in":"query","name":"class_from","required":false,"schema":{"type":"string"}},{"description":"ending class code (default: last)","in":"query","name":"class_to","required":false,"schema":{"type":"string"}},{"description":"Y|N (default N)","in":"query","name":"page_per_class","required":false,"schema":{"type":"string"}},{"description":"the location whose stock the report reads (default: the account)","in":"query","name":"location_id","required":false,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"reorder point table (cost columns need costs.view)"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/inv_reorder/pdf":{"get":{"operationId":"reports_inv_reorder_pdf","parameters":[{"description":"starting class code","in":"query","name":"class_from","required":false,"schema":{"type":"string"}},{"description":"ending class code","in":"query","name":"class_to","required":false,"schema":{"type":"string"}},{"description":"Y|N","in":"query","name":"page_per_class","required":false,"schema":{"type":"string"}},{"description":"the location whose stock the report reads (default: the account)","in":"query","name":"location_id","required":false,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"reorder point PDF"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/inv_reorder/text":{"get":{"operationId":"reports_inv_reorder_text","parameters":[{"description":"starting class code (default: the first class)","in":"query","name":"class_from","required":false,"schema":{"type":"string"}},{"description":"ending class code (default: the last class)","in":"query","name":"class_to","required":false,"schema":{"type":"string"}},{"description":"Y|N (default N)","in":"query","name":"page_per_class","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"reorder point (FoxPro INVREORD) as a text report: 133-column printer pages and 80-column screen pages; cost cells blank without costs.view"},"403":{"description":"needs reports.view"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/inv_reorder/text/pdf":{"get":{"operationId":"reports_inv_reorder_text_pdf","parameters":[{"description":"starting class code (default: the first class)","in":"query","name":"class_from","required":false,"schema":{"type":"string"}},{"description":"ending class code (default: the last class)","in":"query","name":"class_to","required":false,"schema":{"type":"string"}},{"description":"Y|N (default N)","in":"query","name":"page_per_class","required":false,"schema":{"type":"string"}},{"description":"portrait|landscape for pages wider than 80 columns (default: the location's reports.print setting, else landscape)","in":"query","name":"orientation","required":false,"schema":{"type":"string"}},{"description":"actual|page for pages wider than 80 columns (default: the setting, else page)","in":"query","name":"fit","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"reorder point as a fixed-pitch PDF"},"403":{"description":"needs reports.view"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/inv_requirements":{"get":{"operationId":"reports_inv_requirements","parameters":[{"description":"starting class code (default: first)","in":"query","name":"class_from","required":false,"schema":{"type":"string"}},{"description":"ending class code (default: last)","in":"query","name":"class_to","required":false,"schema":{"type":"string"}},{"description":"Y|N (default N)","in":"query","name":"page_per_class","required":false,"schema":{"type":"string"}},{"description":"Y (default) short items only, N every part","in":"query","name":"short_only","required":false,"schema":{"type":"string"}},{"description":"the location whose stock the report reads (default: the account)","in":"query","name":"location_id","required":false,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"purchase requirements table"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/inv_requirements/pdf":{"get":{"operationId":"reports_inv_requirements_pdf","parameters":[{"description":"starting class code","in":"query","name":"class_from","required":false,"schema":{"type":"string"}},{"description":"ending class code","in":"query","name":"class_to","required":false,"schema":{"type":"string"}},{"description":"Y|N","in":"query","name":"page_per_class","required":false,"schema":{"type":"string"}},{"description":"Y short items only, N every part","in":"query","name":"short_only","required":false,"schema":{"type":"string"}},{"description":"the location whose stock the report reads (default: the account)","in":"query","name":"location_id","required":false,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"purchase requirements PDF"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/inv_requirements/text":{"get":{"operationId":"reports_inv_requirements_text","parameters":[{"description":"starting class code (default: the first class)","in":"query","name":"class_from","required":false,"schema":{"type":"string"}},{"description":"ending class code (default: the last class)","in":"query","name":"class_to","required":false,"schema":{"type":"string"}},{"description":"Y|N (default N)","in":"query","name":"page_per_class","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"purchase requirements (FoxPro INVREQUI) as a text report: 133-column printer pages and 80-column screen pages; every part of the range"},"403":{"description":"needs reports.view"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/inv_requirements/text/pdf":{"get":{"operationId":"reports_inv_requirements_text_pdf","parameters":[{"description":"starting class code (default: the first class)","in":"query","name":"class_from","required":false,"schema":{"type":"string"}},{"description":"ending class code (default: the last class)","in":"query","name":"class_to","required":false,"schema":{"type":"string"}},{"description":"Y|N (default N)","in":"query","name":"page_per_class","required":false,"schema":{"type":"string"}},{"description":"portrait|landscape for pages wider than 80 columns (default: the location's reports.print setting, else landscape)","in":"query","name":"orientation","required":false,"schema":{"type":"string"}},{"description":"actual|page for pages wider than 80 columns (default: the setting, else page)","in":"query","name":"fit","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"purchase requirements as a fixed-pitch PDF"},"403":{"description":"needs reports.view"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/inv_status/text":{"get":{"operationId":"reports_inv_status_text","parameters":[{"description":"detail (default) or summary","in":"query","name":"mode","required":false,"schema":{"type":"string"}},{"description":"starting class code (default: the first class)","in":"query","name":"class_from","required":false,"schema":{"type":"string"}},{"description":"ending class code (default: the last class)","in":"query","name":"class_to","required":false,"schema":{"type":"string"}},{"description":"Y|N (default N); detail only","in":"query","name":"page_per_class","required":false,"schema":{"type":"string"}},{"description":"YYYY-MM-DD: stock and average cost as at the end of this date (default: the location's today)","in":"query","name":"base_date","required":false,"schema":{"type":"string"}},{"description":"the location whose stock the report reads (default: the account)","in":"query","name":"location_id","required":false,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"inventory status as a text report: stock valued at cost, list and sell price 1 as of the base date; cost figures blank without costs.view"},"403":{"description":"needs reports.view"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/inv_status/text/pdf":{"get":{"operationId":"reports_inv_status_text_pdf","parameters":[{"description":"detail (default) or summary","in":"query","name":"mode","required":false,"schema":{"type":"string"}},{"description":"starting class code (default: the first class)","in":"query","name":"class_from","required":false,"schema":{"type":"string"}},{"description":"ending class code (default: the last class)","in":"query","name":"class_to","required":false,"schema":{"type":"string"}},{"description":"Y|N (default N); detail only","in":"query","name":"page_per_class","required":false,"schema":{"type":"string"}},{"description":"YYYY-MM-DD (default: the location's today)","in":"query","name":"base_date","required":false,"schema":{"type":"string"}},{"description":"the location whose stock the report reads (default: the account)","in":"query","name":"location_id","required":false,"schema":{"format":"int64","type":"integer"}},{"description":"portrait|landscape for pages wider than 80 columns (default: the location's reports.print setting, else landscape)","in":"query","name":"orientation","required":false,"schema":{"type":"string"}},{"description":"actual|page for pages wider than 80 columns (default: the setting, else page)","in":"query","name":"fit","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"inventory status as a fixed-pitch PDF"},"403":{"description":"needs reports.view"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/labour":{"get":{"operationId":"reports_labour","parameters":[{"description":"first invoice date YYYY-MM-DD","in":"query","name":"from","required":true,"schema":{"type":"string"}},{"description":"last invoice date YYYY-MM-DD","in":"query","name":"to","required":true,"schema":{"type":"string"}},{"description":"technician code; blank = all","in":"query","name":"technician","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"SERLABR as a report table"},"401":{"description":"unauthenticated"},"403":{"description":"needs reports.view and customers.read"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/labour/pdf":{"get":{"operationId":"reports_labour_pdf","parameters":[{"description":"first invoice date YYYY-MM-DD","in":"query","name":"from","required":true,"schema":{"type":"string"}},{"description":"last invoice date YYYY-MM-DD","in":"query","name":"to","required":true,"schema":{"type":"string"}},{"description":"technician code; blank = all","in":"query","name":"technician","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"SERLABR as a PDF"},"401":{"description":"unauthenticated"},"403":{"description":"needs reports.view and customers.read"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/labour/text":{"get":{"operationId":"reports_labour_text","parameters":[{"description":"first invoice date YYYY-MM-DD","in":"query","name":"from","required":true,"schema":{"type":"string"}},{"description":"last invoice date YYYY-MM-DD","in":"query","name":"to","required":true,"schema":{"type":"string"}},{"description":"technician code; blank = all","in":"query","name":"technician","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"SERLABR as a text report; no pages when nothing matches"},"401":{"description":"unauthenticated"},"403":{"description":"needs reports.view and customers.read"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/labour/text/pdf":{"get":{"operationId":"reports_labour_text_pdf","parameters":[{"description":"first invoice date YYYY-MM-DD","in":"query","name":"from","required":true,"schema":{"type":"string"}},{"description":"last invoice date YYYY-MM-DD","in":"query","name":"to","required":true,"schema":{"type":"string"}},{"description":"technician code; blank = all","in":"query","name":"technician","required":false,"schema":{"type":"string"}},{"description":"portrait|landscape for pages wider than 80 columns","in":"query","name":"orientation","required":false,"schema":{"type":"string"}},{"description":"actual|page for pages wider than 80 columns","in":"query","name":"fit","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"SERLABR as a fixed-pitch PDF"},"401":{"description":"unauthenticated"},"403":{"description":"needs reports.view and customers.read"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/labour_codes":{"get":{"operationId":"reports_labour_codes","responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"SERLCODR as a report table"},"401":{"description":"unauthenticated"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/labour_codes/pdf":{"get":{"operationId":"reports_labour_codes_pdf","responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"SERLCODR as a PDF"},"401":{"description":"unauthenticated"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/labour_codes/text":{"get":{"operationId":"reports_labour_codes_text","responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"SERLCODR as a text report"},"401":{"description":"unauthenticated"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/labour_codes/text/pdf":{"get":{"operationId":"reports_labour_codes_text_pdf","parameters":[{"description":"portrait|landscape for pages wider than 80 columns","in":"query","name":"orientation","required":false,"schema":{"type":"string"}},{"description":"actual|page for pages wider than 80 columns","in":"query","name":"fit","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"SERLCODR as a fixed-pitch PDF"},"401":{"description":"unauthenticated"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/labour_vs_wenmar":{"get":{"operationId":"reports_labour_vs_wenmar","parameters":[{"description":"first business day YYYY-MM-DD; default a year before `to`","in":"query","name":"from","required":false,"schema":{"type":["string","null"]}},{"description":"last business day YYYY-MM-DD; default today","in":"query","name":"to","required":false,"schema":{"type":["string","null"]}},{"description":"one location; blank = every location the caller may see","in":"query","name":"location_id","required":false,"schema":{"format":"int64","type":["integer","null"]}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the shop factor, per category, the jobs that drift most, answers, unlinked codes and the location's setting"},"401":{"description":"unauthenticated"},"403":{"description":"needs reports.view"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"summary":"`GET /reports/labour_vs_wenmar` (plan 3139; spec 2026-11-19 D4, D6, D7): how this shop's\nbilled and clocked labour compares with Wenmar's figures. Each client draws the answer on\nits own screen; there is no PDF.","tags":["Reports"]}},"/reports/ledger_check":{"get":{"operationId":"reports_ledger_check","responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"ledger check table"},"403":{"description":"needs reports.view"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/ledger_check/pdf":{"get":{"operationId":"reports_ledger_check_pdf","responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"ledger check PDF"},"403":{"description":"needs reports.view"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/ledger_detail":{"get":{"operationId":"reports_ledger_detail","parameters":[{"description":"YYYY-MM-DD","in":"query","name":"from","required":true,"schema":{"type":"string"}},{"description":"YYYY-MM-DD","in":"query","name":"to","required":true,"schema":{"type":"string"}},{"description":"one account number (default: every account)","in":"query","name":"account","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"ledger detail table"},"403":{"description":"needs reports.view"},"422":{"description":"invalid period"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/ledger_detail/pdf":{"get":{"operationId":"reports_ledger_detail_pdf","parameters":[{"description":"YYYY-MM-DD","in":"query","name":"from","required":true,"schema":{"type":"string"}},{"description":"YYYY-MM-DD","in":"query","name":"to","required":true,"schema":{"type":"string"}},{"description":"one account number","in":"query","name":"account","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"ledger detail PDF"},"403":{"description":"needs reports.view"},"422":{"description":"invalid period"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/maintenance_required/text":{"get":{"operationId":"reports_maintenance_required_text","parameters":[{"description":"first due date YYYY-MM-DD","in":"query","name":"from","required":true,"schema":{"type":"string"}},{"description":"last due date YYYY-MM-DD","in":"query","name":"to","required":true,"schema":{"type":"string"}},{"description":"one maintenance item code; blank = all items","in":"query","name":"item","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the Maintenance Required report (SERMAINT) as a text report; the header prints even when nothing is due"},"401":{"description":"unauthenticated"},"403":{"description":"needs customers.read"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/maintenance_required/text/pdf":{"get":{"operationId":"reports_maintenance_required_text_pdf","parameters":[{"description":"first due date YYYY-MM-DD","in":"query","name":"from","required":true,"schema":{"type":"string"}},{"description":"last due date YYYY-MM-DD","in":"query","name":"to","required":true,"schema":{"type":"string"}},{"description":"one maintenance item code; blank = all items","in":"query","name":"item","required":false,"schema":{"type":"string"}},{"description":"portrait|landscape for pages wider than 80 columns","in":"query","name":"orientation","required":false,"schema":{"type":"string"}},{"description":"actual|page for pages wider than 80 columns","in":"query","name":"fit","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"the Maintenance Required report as a fixed-pitch PDF"},"401":{"description":"unauthenticated"},"403":{"description":"needs customers.read"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/open_estimates":{"get":{"operationId":"reports_open_estimates","parameters":[{"description":"detail (default) | summary","in":"query","name":"mode","required":false,"schema":{"type":"string"}},{"description":"customer (default) | number","in":"query","name":"sort","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"SEROSEST as a report table"},"401":{"description":"unauthenticated"},"403":{"description":"needs customers.read"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/open_estimates/pdf":{"get":{"operationId":"reports_open_estimates_pdf","parameters":[{"description":"detail (default) | summary","in":"query","name":"mode","required":false,"schema":{"type":"string"}},{"description":"customer (default) | number","in":"query","name":"sort","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"SEROSEST as a PDF"},"401":{"description":"unauthenticated"},"403":{"description":"needs customers.read"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/open_estimates/text":{"get":{"operationId":"reports_open_estimates_text","parameters":[{"description":"detail (default) | summary","in":"query","name":"mode","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"SEROSEST as a text report (printer and screen pages, FoxPro's columns); always in customer order"},"401":{"description":"unauthenticated"},"403":{"description":"needs customers.read"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/open_estimates/text/pdf":{"get":{"operationId":"reports_open_estimates_text_pdf","parameters":[{"description":"detail (default) | summary","in":"query","name":"mode","required":false,"schema":{"type":"string"}},{"description":"portrait|landscape for pages wider than 80 columns (default: the location's reports.print setting, else landscape)","in":"query","name":"orientation","required":false,"schema":{"type":"string"}},{"description":"actual|page for pages wider than 80 columns (default: the setting, else page)","in":"query","name":"fit","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"SEROSEST as a fixed-pitch PDF"},"401":{"description":"unauthenticated"},"403":{"description":"needs customers.read"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/open_service_orders":{"get":{"operationId":"reports_open_service_orders","parameters":[{"description":"detail (default) | summary","in":"query","name":"mode","required":false,"schema":{"type":"string"}},{"description":"customer (default) | number","in":"query","name":"sort","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"SEROSORD as a report table"},"401":{"description":"unauthenticated"},"403":{"description":"needs customers.read"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/open_service_orders/pdf":{"get":{"operationId":"reports_open_service_orders_pdf","parameters":[{"description":"detail (default) | summary","in":"query","name":"mode","required":false,"schema":{"type":"string"}},{"description":"customer (default) | number","in":"query","name":"sort","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"SEROSORD as a PDF"},"401":{"description":"unauthenticated"},"403":{"description":"needs customers.read"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/open_service_orders/text":{"get":{"operationId":"reports_open_service_orders_text","parameters":[{"description":"detail (default) | summary","in":"query","name":"mode","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"SEROSORD as a text report (printer and screen pages, FoxPro's columns); always in customer order"},"401":{"description":"unauthenticated"},"403":{"description":"needs customers.read"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/open_service_orders/text/pdf":{"get":{"operationId":"reports_open_service_orders_text_pdf","parameters":[{"description":"detail (default) | summary","in":"query","name":"mode","required":false,"schema":{"type":"string"}},{"description":"portrait|landscape for pages wider than 80 columns (default: the location's reports.print setting, else landscape)","in":"query","name":"orientation","required":false,"schema":{"type":"string"}},{"description":"actual|page for pages wider than 80 columns (default: the setting, else page)","in":"query","name":"fit","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"SEROSORD as a fixed-pitch PDF"},"401":{"description":"unauthenticated"},"403":{"description":"needs customers.read"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/open_work_orders":{"get":{"operationId":"reports_open_work_orders","parameters":[{"description":"stage (default) | customer | number","in":"query","name":"group","required":false,"schema":{"type":"string"}},{"description":"detail (default) | summary","in":"query","name":"mode","required":false,"schema":{"type":"string"}},{"description":"one location; omit for every location the caller may see","in":"query","name":"location_id","required":false,"schema":{"format":"int64","type":"integer"}},{"description":"a technician on the order","in":"query","name":"technician_id","required":false,"schema":{"format":"int64","type":"integer"}},{"description":"the order's advisor","in":"query","name":"advisor_id","required":false,"schema":{"format":"int64","type":"integer"}},{"description":"only orders opened at least that many days ago","in":"query","name":"older_than_days","required":false,"schema":{"format":"int64","type":"integer"}},{"description":"true = only the orders waiting on a part","in":"query","name":"waiting_on_parts","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the open orders table, with its figures"},"401":{"description":"unauthenticated"},"403":{"description":"needs customers.read"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/open_work_orders/pdf":{"get":{"operationId":"reports_open_work_orders_pdf","parameters":[{"description":"stage (default) | customer | number","in":"query","name":"group","required":false,"schema":{"type":"string"}},{"description":"detail (default) | summary","in":"query","name":"mode","required":false,"schema":{"type":"string"}},{"description":"one location","in":"query","name":"location_id","required":false,"schema":{"format":"int64","type":"integer"}},{"description":"a technician on the order","in":"query","name":"technician_id","required":false,"schema":{"format":"int64","type":"integer"}},{"description":"the order's advisor","in":"query","name":"advisor_id","required":false,"schema":{"format":"int64","type":"integer"}},{"description":"only orders opened at least that many days ago","in":"query","name":"older_than_days","required":false,"schema":{"format":"int64","type":"integer"}},{"description":"true = only the orders waiting on a part","in":"query","name":"waiting_on_parts","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"the open orders table as a PDF"},"401":{"description":"unauthenticated"},"403":{"description":"needs customers.read"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/parts":{"get":{"operationId":"reports_parts","parameters":[{"description":"bought (default) or used","in":"query","name":"view","required":false,"schema":{"type":"string"}},{"description":"vendor (default) | brand | part | po (bought) | wo | technician (used)","in":"query","name":"group","required":false,"schema":{"type":"string"}},{"description":"first day YYYY-MM-DD","in":"query","name":"from","required":true,"schema":{"type":"string"}},{"description":"last day YYYY-MM-DD","in":"query","name":"to","required":true,"schema":{"type":"string"}},{"description":"one location; omit for every location the caller may see","in":"query","name":"location_id","required":false,"schema":{"format":"int64","type":"integer"}},{"description":"one vendor","in":"query","name":"vendor_id","required":false,"schema":{"format":"int64","type":"integer"}},{"description":"one group's key: its lines instead of the groups","in":"query","name":"drill","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the parts report table"},"401":{"description":"unauthenticated"},"403":{"description":"needs costs.view"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/parts/pdf":{"get":{"operationId":"reports_parts_pdf","parameters":[{"description":"bought (default) or used","in":"query","name":"view","required":false,"schema":{"type":"string"}},{"description":"vendor (default) | brand | part | po (bought) | wo | technician (used)","in":"query","name":"group","required":false,"schema":{"type":"string"}},{"description":"first day YYYY-MM-DD","in":"query","name":"from","required":true,"schema":{"type":"string"}},{"description":"last day YYYY-MM-DD","in":"query","name":"to","required":true,"schema":{"type":"string"}},{"description":"one location","in":"query","name":"location_id","required":false,"schema":{"format":"int64","type":"integer"}},{"description":"one vendor","in":"query","name":"vendor_id","required":false,"schema":{"format":"int64","type":"integer"}},{"description":"one group's key","in":"query","name":"drill","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"the parts report as a PDF"},"401":{"description":"unauthenticated"},"403":{"description":"needs costs.view"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/payroll_batch/text":{"get":{"operationId":"reports_payroll_batch_text","parameters":[{"description":"A (default) | E | S","in":"query","name":"include","required":false,"schema":{"type":"string"}},{"description":"I individual (default) | S summary","in":"query","name":"format","required":false,"schema":{"type":"string"}},{"description":"Y | N (default): summary sub-totals","in":"query","name":"by_department","required":false,"schema":{"type":"string"}},{"description":"default: the open or issued run","in":"query","name":"run_id","required":false,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"PRBATCHP as a text report; no pages when no run is open"},"403":{"description":"needs payroll.manage"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/payroll_batch/text/pdf":{"get":{"operationId":"reports_payroll_batch_text_pdf","parameters":[{"description":"A (default) | E | S","in":"query","name":"include","required":false,"schema":{"type":"string"}},{"description":"I individual (default) | S summary","in":"query","name":"format","required":false,"schema":{"type":"string"}},{"description":"Y | N (default): summary sub-totals","in":"query","name":"by_department","required":false,"schema":{"type":"string"}},{"description":"default: the open or issued run","in":"query","name":"run_id","required":false,"schema":{"format":"int64","type":"integer"}},{"description":"portrait|landscape for pages wider than 80 columns","in":"query","name":"orientation","required":false,"schema":{"type":"string"}},{"description":"actual|page for pages wider than 80 columns","in":"query","name":"fit","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"PRBATCHP as a fixed-pitch PDF"},"403":{"description":"needs payroll.manage"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/payroll_cheque_register/text":{"get":{"operationId":"reports_payroll_cheque_register_text","parameters":[{"description":"first pay date YYYY-MM-DD","in":"query","name":"from","required":true,"schema":{"type":"string"}},{"description":"last pay date YYYY-MM-DD (missing: nothing is selected)","in":"query","name":"to","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"PRCHEQR as a text report"},"403":{"description":"needs payroll.manage"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/payroll_cheque_register/text/pdf":{"get":{"operationId":"reports_payroll_cheque_register_text_pdf","parameters":[{"description":"first pay date YYYY-MM-DD","in":"query","name":"from","required":true,"schema":{"type":"string"}},{"description":"last pay date YYYY-MM-DD (missing: nothing is selected)","in":"query","name":"to","required":false,"schema":{"type":"string"}},{"description":"portrait|landscape for pages wider than 80 columns","in":"query","name":"orientation","required":false,"schema":{"type":"string"}},{"description":"actual|page for pages wider than 80 columns","in":"query","name":"fit","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"PRCHEQR as a fixed-pitch PDF"},"403":{"description":"needs payroll.manage"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/payroll_cheques":{"get":{"operationId":"reports_payroll_cheques","parameters":[{"description":"first pay date YYYY-MM-DD","in":"query","name":"from","required":true,"schema":{"type":"string"}},{"description":"last pay date YYYY-MM-DD","in":"query","name":"to","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"payroll cheque register table"},"403":{"description":"needs payroll.manage"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/payroll_cheques/pdf":{"get":{"operationId":"reports_payroll_cheques_pdf","parameters":[{"description":"first pay date YYYY-MM-DD","in":"query","name":"from","required":true,"schema":{"type":"string"}},{"description":"last pay date YYYY-MM-DD","in":"query","name":"to","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"payroll cheque register PDF"},"403":{"description":"needs payroll.manage"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/payroll_department_list/text":{"get":{"operationId":"reports_payroll_department_list_text","responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"PRDEPTR as a text report"},"403":{"description":"needs payroll.view"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/payroll_department_list/text/pdf":{"get":{"operationId":"reports_payroll_department_list_text_pdf","parameters":[{"description":"portrait|landscape for pages wider than 80 columns","in":"query","name":"orientation","required":false,"schema":{"type":"string"}},{"description":"actual|page for pages wider than 80 columns","in":"query","name":"fit","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"PRDEPTR as a fixed-pitch PDF"},"403":{"description":"needs payroll.view"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/payroll_eht":{"get":{"operationId":"reports_payroll_eht","parameters":[{"description":"the calendar year","in":"query","name":"year","required":true,"schema":{"format":"int32","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"Ontario Employer Health Tax table"},"403":{"description":"needs payroll.manage"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/payroll_eht/pdf":{"get":{"operationId":"reports_payroll_eht_pdf","parameters":[{"description":"the calendar year","in":"query","name":"year","required":true,"schema":{"format":"int32","type":"integer"}}],"responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"Ontario Employer Health Tax PDF"},"403":{"description":"needs payroll.manage"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/payroll_employee_list/text":{"get":{"operationId":"reports_payroll_employee_list_text","parameters":[{"description":"employee (default) | subcontractor","in":"query","name":"kind","required":false,"schema":{"type":"string"}},{"description":"1 numerical, 2 alphabetical, 3 department, 4 birthday, 5 anniversary, 6 new, 7 terminated, 8 bank account","in":"query","name":"list","required":true,"schema":{"type":"string"}},{"description":"summary (default) | detail (lists 1 and 2)","in":"query","name":"form","required":false,"schema":{"type":"string"}},{"description":"list 1 detailed: first employee number","in":"query","name":"from_number","required":false,"schema":{"type":"string"}},{"description":"list 1 detailed: last employee number","in":"query","name":"to_number","required":false,"schema":{"type":"string"}},{"description":"detailed: Y = a page per person","in":"query","name":"new_page","required":false,"schema":{"type":"string"}},{"description":"lists 6 and 7: first date YYYY-MM-DD","in":"query","name":"from","required":false,"schema":{"type":"string"}},{"description":"lists 6 and 7: last date YYYY-MM-DD","in":"query","name":"to","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"PREMPLIS as a text report"},"403":{"description":"needs payroll.view; detailed and bank lists need payroll.manage"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/payroll_employee_list/text/pdf":{"get":{"operationId":"reports_payroll_employee_list_text_pdf","parameters":[{"description":"employee (default) | subcontractor","in":"query","name":"kind","required":false,"schema":{"type":"string"}},{"description":"1 to 8","in":"query","name":"list","required":true,"schema":{"type":"string"}},{"description":"summary (default) | detail","in":"query","name":"form","required":false,"schema":{"type":"string"}},{"description":"list 1 detailed","in":"query","name":"from_number","required":false,"schema":{"type":"string"}},{"description":"list 1 detailed","in":"query","name":"to_number","required":false,"schema":{"type":"string"}},{"description":"detailed: Y = a page per person","in":"query","name":"new_page","required":false,"schema":{"type":"string"}},{"description":"lists 6 and 7","in":"query","name":"from","required":false,"schema":{"type":"string"}},{"description":"lists 6 and 7","in":"query","name":"to","required":false,"schema":{"type":"string"}},{"description":"portrait|landscape for pages wider than 80 columns","in":"query","name":"orientation","required":false,"schema":{"type":"string"}},{"description":"actual|page for pages wider than 80 columns","in":"query","name":"fit","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"PREMPLIS as a fixed-pitch PDF"},"403":{"description":"needs payroll.view; detailed and bank lists need payroll.manage"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/payroll_employees":{"get":{"operationId":"reports_payroll_employees","parameters":[{"description":"1 (default) or all","in":"query","name":"active","required":false,"schema":{"type":"string"}},{"description":"number (default) or name","in":"query","name":"sort","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"payroll employee list table"},"403":{"description":"needs payroll.view"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/payroll_employees/pdf":{"get":{"operationId":"reports_payroll_employees_pdf","parameters":[{"description":"1 (default) or all","in":"query","name":"active","required":false,"schema":{"type":"string"}},{"description":"number (default) or name","in":"query","name":"sort","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"payroll employee list PDF"},"403":{"description":"needs payroll.view"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/payroll_employer_cost":{"get":{"operationId":"reports_payroll_employer_cost","parameters":[{"description":"first pay date YYYY-MM-DD, one calendar year","in":"query","name":"from","required":true,"schema":{"type":"string"}},{"description":"last pay date YYYY-MM-DD, one calendar year","in":"query","name":"to","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"payroll employer cost table"},"403":{"description":"needs payroll.manage"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/payroll_employer_cost/pdf":{"get":{"operationId":"reports_payroll_employer_cost_pdf","parameters":[{"description":"first pay date YYYY-MM-DD, one calendar year","in":"query","name":"from","required":true,"schema":{"type":"string"}},{"description":"last pay date YYYY-MM-DD, one calendar year","in":"query","name":"to","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"payroll employer cost PDF"},"403":{"description":"needs payroll.manage"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/payroll_insurable":{"get":{"operationId":"reports_payroll_insurable","parameters":[{"description":"first pay date YYYY-MM-DD","in":"query","name":"from","required":true,"schema":{"type":"string"}},{"description":"last pay date YYYY-MM-DD","in":"query","name":"to","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"payroll insurable earnings table"},"403":{"description":"needs payroll.manage"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/payroll_insurable/pdf":{"get":{"operationId":"reports_payroll_insurable_pdf","parameters":[{"description":"first pay date YYYY-MM-DD","in":"query","name":"from","required":true,"schema":{"type":"string"}},{"description":"last pay date YYYY-MM-DD","in":"query","name":"to","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"payroll insurable earnings PDF"},"403":{"description":"needs payroll.manage"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/payroll_insurable/text":{"get":{"operationId":"reports_payroll_insurable_text","parameters":[{"description":"employee number","in":"query","name":"employee","required":true,"schema":{"type":"string"}},{"description":"first pay date YYYY-MM-DD","in":"query","name":"from","required":false,"schema":{"type":"string"}},{"description":"last pay date YYYY-MM-DD (default: today)","in":"query","name":"to","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"PREIC as a text report"},"403":{"description":"needs payroll.manage"},"404":{"description":"no such employee"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/payroll_insurable/text/pdf":{"get":{"operationId":"reports_payroll_insurable_text_pdf","parameters":[{"description":"employee number","in":"query","name":"employee","required":true,"schema":{"type":"string"}},{"description":"first pay date YYYY-MM-DD","in":"query","name":"from","required":false,"schema":{"type":"string"}},{"description":"last pay date YYYY-MM-DD (default: today)","in":"query","name":"to","required":false,"schema":{"type":"string"}},{"description":"portrait|landscape for pages wider than 80 columns","in":"query","name":"orientation","required":false,"schema":{"type":"string"}},{"description":"actual|page for pages wider than 80 columns","in":"query","name":"fit","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"PREIC as a fixed-pitch PDF"},"403":{"description":"needs payroll.manage"},"404":{"description":"no such employee"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/payroll_job_cost":{"get":{"operationId":"reports_payroll_job_cost","parameters":[{"description":"first work date YYYY-MM-DD","in":"query","name":"from","required":true,"schema":{"type":"string"}},{"description":"last work date YYYY-MM-DD","in":"query","name":"to","required":true,"schema":{"type":"string"}},{"description":"one work order's cards, by number","in":"query","name":"work_order","required":false,"schema":{"format":"int64","type":"integer"}},{"description":"Y: work-class headings and sub-totals","in":"query","name":"by_class","required":false,"schema":{"type":"string"}},{"description":"Y: sorted by department inside each work order","in":"query","name":"by_department","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"payroll job cost table"},"403":{"description":"needs payroll.manage"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"summary":"`GET /reports/payroll_job_cost` (plan 1823): the cost of time-carded work orders.","tags":["Reports"]}},"/reports/payroll_job_cost/pdf":{"get":{"operationId":"reports_payroll_job_cost_pdf","responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"payroll job cost PDF"},"403":{"description":"needs payroll.manage"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"summary":"`GET /reports/payroll_job_cost/pdf` (plan 1823).","tags":["Reports"]}},"/reports/payroll_job_cost/text":{"get":{"operationId":"reports_payroll_job_cost_text","parameters":[{"description":"first work date YYYY-MM-DD","in":"query","name":"from","required":true,"schema":{"type":"string"}},{"description":"last work date YYYY-MM-DD","in":"query","name":"to","required":true,"schema":{"type":"string"}},{"description":"one work order's cards, by number","in":"query","name":"work_order","required":false,"schema":{"format":"int64","type":"integer"}},{"description":"Y: work-class headings and sub-totals","in":"query","name":"by_class","required":false,"schema":{"type":"string"}},{"description":"Y: sorted by department inside each work order","in":"query","name":"by_department","required":false,"schema":{"type":"string"}},{"description":"Y (default) one line per employee, N one per card","in":"query","name":"summarize","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"payroll job cost text report"},"403":{"description":"needs payroll.manage"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"summary":"`GET /reports/payroll_job_cost/text` (plan 1823): FoxPro's Job Cost Report (PRJOBCST) over\nwork orders.","tags":["Reports"]}},"/reports/payroll_job_cost/text/pdf":{"get":{"operationId":"reports_payroll_job_cost_text_pdf","parameters":[{"description":"portrait|landscape for pages wider than 80 columns","in":"query","name":"orientation","required":false,"schema":{"type":"string"}},{"description":"actual|page for pages wider than 80 columns","in":"query","name":"fit","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"payroll job cost text PDF"},"403":{"description":"needs payroll.manage"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"summary":"`GET /reports/payroll_job_cost/text/pdf` (plan 1823).","tags":["Reports"]}},"/reports/payroll_job_hours":{"get":{"operationId":"reports_payroll_job_hours","parameters":[{"description":"first work date YYYY-MM-DD","in":"query","name":"from","required":true,"schema":{"type":"string"}},{"description":"last work date YYYY-MM-DD","in":"query","name":"to","required":true,"schema":{"type":"string"}},{"description":"one work order's cards, by number","in":"query","name":"work_order","required":false,"schema":{"format":"int64","type":"integer"}},{"description":"Y: work-class headings and sub-totals","in":"query","name":"by_class","required":false,"schema":{"type":"string"}},{"description":"Y: sorted by department inside each work order","in":"query","name":"by_department","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"payroll job hours table"},"403":{"description":"needs payroll.view"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"summary":"`GET /reports/payroll_job_hours` (plan 1823): the labour of time-carded work orders.","tags":["Reports"]}},"/reports/payroll_job_hours/pdf":{"get":{"operationId":"reports_payroll_job_hours_pdf","responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"payroll job hours PDF"},"403":{"description":"needs payroll.view"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"summary":"`GET /reports/payroll_job_hours/pdf` (plan 1823).","tags":["Reports"]}},"/reports/payroll_job_hours/text":{"get":{"operationId":"reports_payroll_job_hours_text","parameters":[{"description":"first work date YYYY-MM-DD","in":"query","name":"from","required":true,"schema":{"type":"string"}},{"description":"last work date YYYY-MM-DD","in":"query","name":"to","required":true,"schema":{"type":"string"}},{"description":"one work order's cards, by number","in":"query","name":"work_order","required":false,"schema":{"format":"int64","type":"integer"}},{"description":"Y: work-class headings and sub-totals","in":"query","name":"by_class","required":false,"schema":{"type":"string"}},{"description":"Y: sorted by department inside each work order","in":"query","name":"by_department","required":false,"schema":{"type":"string"}},{"description":"Y (default) one line per employee, N one per card","in":"query","name":"summarize","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"payroll job hours text report"},"403":{"description":"needs payroll.manage"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"summary":"`GET /reports/payroll_job_hours/text` (plan 1823): FoxPro's Job Report (PRJOBRPT) over work\norders.","tags":["Reports"]}},"/reports/payroll_job_hours/text/pdf":{"get":{"operationId":"reports_payroll_job_hours_text_pdf","parameters":[{"description":"portrait|landscape for pages wider than 80 columns","in":"query","name":"orientation","required":false,"schema":{"type":"string"}},{"description":"actual|page for pages wider than 80 columns","in":"query","name":"fit","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"payroll job hours text PDF"},"403":{"description":"needs payroll.manage"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"summary":"`GET /reports/payroll_job_hours/text/pdf` (plan 1823).","tags":["Reports"]}},"/reports/payroll_journal/text":{"get":{"operationId":"reports_payroll_journal_text","parameters":[{"description":"date (default) | employee","in":"query","name":"by","required":false,"schema":{"type":"string"}},{"description":"first pay date YYYY-MM-DD","in":"query","name":"from","required":true,"schema":{"type":"string"}},{"description":"last pay date YYYY-MM-DD","in":"query","name":"to","required":true,"schema":{"type":"string"}},{"description":"employee number, required with by=employee","in":"query","name":"employee","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"PRJOUR options 2 and 3 as a text report"},"403":{"description":"needs payroll.manage"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/payroll_journal/text/pdf":{"get":{"operationId":"reports_payroll_journal_text_pdf","parameters":[{"description":"date (default) | employee","in":"query","name":"by","required":false,"schema":{"type":"string"}},{"description":"first pay date YYYY-MM-DD","in":"query","name":"from","required":true,"schema":{"type":"string"}},{"description":"last pay date YYYY-MM-DD","in":"query","name":"to","required":true,"schema":{"type":"string"}},{"description":"employee number, required with by=employee","in":"query","name":"employee","required":false,"schema":{"type":"string"}},{"description":"portrait|landscape for pages wider than 80 columns","in":"query","name":"orientation","required":false,"schema":{"type":"string"}},{"description":"actual|page for pages wider than 80 columns","in":"query","name":"fit","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"PRJOUR options 2 and 3 as a fixed-pitch PDF"},"403":{"description":"needs payroll.manage"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/payroll_overtime":{"get":{"operationId":"reports_payroll_overtime","parameters":[{"description":"a Saturday, YYYY-MM-DD","in":"query","name":"week_ending","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"payroll overtime table"},"403":{"description":"needs payroll.view"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/payroll_overtime/pdf":{"get":{"operationId":"reports_payroll_overtime_pdf","parameters":[{"description":"a Saturday, YYYY-MM-DD","in":"query","name":"week_ending","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"payroll overtime PDF"},"403":{"description":"needs payroll.view"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/payroll_receiver_general/text":{"get":{"operationId":"reports_payroll_receiver_general_text","parameters":[{"description":"first pay date YYYY-MM-DD","in":"query","name":"from","required":true,"schema":{"type":"string"}},{"description":"last pay date YYYY-MM-DD (missing: nothing is selected)","in":"query","name":"to","required":false,"schema":{"type":"string"}},{"description":"employee number","in":"query","name":"employee","required":false,"schema":{"type":"string"}},{"description":"Y | N (default): sub-totals by department","in":"query","name":"by_department","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"PRRECGEN as a text report"},"403":{"description":"needs payroll.manage"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/payroll_receiver_general/text/pdf":{"get":{"operationId":"reports_payroll_receiver_general_text_pdf","parameters":[{"description":"first pay date YYYY-MM-DD","in":"query","name":"from","required":true,"schema":{"type":"string"}},{"description":"last pay date YYYY-MM-DD (missing: nothing is selected)","in":"query","name":"to","required":false,"schema":{"type":"string"}},{"description":"employee number","in":"query","name":"employee","required":false,"schema":{"type":"string"}},{"description":"Y | N (default): sub-totals by department","in":"query","name":"by_department","required":false,"schema":{"type":"string"}},{"description":"portrait|landscape for pages wider than 80 columns","in":"query","name":"orientation","required":false,"schema":{"type":"string"}},{"description":"actual|page for pages wider than 80 columns","in":"query","name":"fit","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"PRRECGEN as a fixed-pitch PDF"},"403":{"description":"needs payroll.manage"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/payroll_register":{"get":{"operationId":"reports_payroll_register","parameters":[{"description":"one pay run, any status","in":"query","name":"run_id","required":false,"schema":{"format":"int64","type":"integer"}},{"description":"first pay date YYYY-MM-DD (without run_id)","in":"query","name":"from","required":false,"schema":{"type":"string"}},{"description":"last pay date YYYY-MM-DD (without run_id)","in":"query","name":"to","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"payroll register table"},"403":{"description":"needs payroll.manage"},"404":{"description":"no such run"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/payroll_register/pdf":{"get":{"operationId":"reports_payroll_register_pdf","parameters":[{"description":"one pay run, any status","in":"query","name":"run_id","required":false,"schema":{"format":"int64","type":"integer"}},{"description":"first pay date YYYY-MM-DD (without run_id)","in":"query","name":"from","required":false,"schema":{"type":"string"}},{"description":"last pay date YYYY-MM-DD (without run_id)","in":"query","name":"to","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"payroll register PDF"},"403":{"description":"needs payroll.manage"},"404":{"description":"no such run"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/payroll_remittance":{"get":{"operationId":"reports_payroll_remittance","parameters":[{"description":"first pay date YYYY-MM-DD","in":"query","name":"from","required":true,"schema":{"type":"string"}},{"description":"last pay date YYYY-MM-DD","in":"query","name":"to","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"payroll remittance table"},"403":{"description":"needs payroll.manage"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/payroll_remittance/pdf":{"get":{"operationId":"reports_payroll_remittance_pdf","parameters":[{"description":"first pay date YYYY-MM-DD","in":"query","name":"from","required":true,"schema":{"type":"string"}},{"description":"last pay date YYYY-MM-DD","in":"query","name":"to","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"payroll remittance PDF"},"403":{"description":"needs payroll.manage"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/payroll_remittances_due":{"get":{"operationId":"reports_payroll_remittances_due","parameters":[{"description":"first day, YYYY-MM-DD; default 1 January","in":"query","name":"from","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"payroll remittances due table"},"403":{"description":"needs payroll.manage"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/payroll_remittances_due/pdf":{"get":{"operationId":"reports_payroll_remittances_due_pdf","parameters":[{"description":"first day, YYYY-MM-DD; default 1 January","in":"query","name":"from","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"payroll remittances due PDF"},"403":{"description":"needs payroll.manage"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/payroll_roe":{"get":{"operationId":"reports_payroll_roe","parameters":[{"description":"the employee (required)","in":"query","name":"employee_id","required":true,"schema":{"format":"int64","type":"integer"}},{"description":"the last day paid YYYY-MM-DD (required)","in":"query","name":"last_day","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the Record of Employment figures: insurable hours and earnings by pay period, vacation pay of the final period"},"403":{"description":"needs payroll.manage"},"404":{"description":"unknown employee"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/payroll_roe/pdf":{"get":{"operationId":"reports_payroll_roe_pdf","parameters":[{"description":"the employee (required)","in":"query","name":"employee_id","required":true,"schema":{"format":"int64","type":"integer"}},{"description":"the last day paid YYYY-MM-DD (required)","in":"query","name":"last_day","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"the Record of Employment figures as a PDF"},"403":{"description":"needs payroll.manage"},"404":{"description":"unknown employee"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/payroll_subcontractor/text":{"get":{"operationId":"reports_payroll_subcontractor_text","parameters":[{"description":"first pay date YYYY-MM-DD","in":"query","name":"from","required":false,"schema":{"type":"string"}},{"description":"last pay date YYYY-MM-DD","in":"query","name":"to","required":false,"schema":{"type":"string"}},{"description":"first employee number","in":"query","name":"employee_from","required":false,"schema":{"type":"string"}},{"description":"last employee number","in":"query","name":"employee_to","required":false,"schema":{"type":"string"}},{"description":"accepted; no effect (print only)","in":"query","name":"detail","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"PRSUBINV as a text report"},"403":{"description":"needs payroll.manage"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/payroll_subcontractor/text/pdf":{"get":{"operationId":"reports_payroll_subcontractor_text_pdf","parameters":[{"description":"first pay date YYYY-MM-DD","in":"query","name":"from","required":false,"schema":{"type":"string"}},{"description":"last pay date YYYY-MM-DD","in":"query","name":"to","required":false,"schema":{"type":"string"}},{"description":"first employee number","in":"query","name":"employee_from","required":false,"schema":{"type":"string"}},{"description":"last employee number","in":"query","name":"employee_to","required":false,"schema":{"type":"string"}},{"description":"accepted; no effect (print only)","in":"query","name":"detail","required":false,"schema":{"type":"string"}},{"description":"portrait|landscape for pages wider than 80 columns","in":"query","name":"orientation","required":false,"schema":{"type":"string"}},{"description":"actual|page for pages wider than 80 columns","in":"query","name":"fit","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"PRSUBINV as a fixed-pitch PDF"},"403":{"description":"needs payroll.manage"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/payroll_subcontractor_invoice":{"get":{"operationId":"reports_payroll_subcontractor_invoice","parameters":[{"description":"first pay date YYYY-MM-DD","in":"query","name":"from","required":true,"schema":{"type":"string"}},{"description":"last pay date YYYY-MM-DD","in":"query","name":"to","required":true,"schema":{"type":"string"}},{"description":"one sub-contractor; absent = every one paid in the period","in":"query","name":"employee_id","required":false,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"sub-contractor invoices table"},"403":{"description":"needs payroll.manage"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/payroll_subcontractor_invoice/pdf":{"get":{"operationId":"reports_payroll_subcontractor_invoice_pdf","parameters":[{"description":"first pay date YYYY-MM-DD","in":"query","name":"from","required":true,"schema":{"type":"string"}},{"description":"last pay date YYYY-MM-DD","in":"query","name":"to","required":true,"schema":{"type":"string"}},{"description":"one sub-contractor; absent = every one paid in the period","in":"query","name":"employee_id","required":false,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"sub-contractor invoices PDF"},"403":{"description":"needs payroll.manage"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/payroll_summary":{"get":{"operationId":"reports_payroll_summary","parameters":[{"description":"first pay date YYYY-MM-DD","in":"query","name":"from","required":true,"schema":{"type":"string"}},{"description":"last pay date YYYY-MM-DD","in":"query","name":"to","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"payroll summary by employee table"},"403":{"description":"needs payroll.manage"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/payroll_summary/pdf":{"get":{"operationId":"reports_payroll_summary_pdf","parameters":[{"description":"first pay date YYYY-MM-DD","in":"query","name":"from","required":true,"schema":{"type":"string"}},{"description":"last pay date YYYY-MM-DD","in":"query","name":"to","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"payroll summary by employee PDF"},"403":{"description":"needs payroll.manage"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/payroll_t4":{"get":{"operationId":"reports_payroll_t4","parameters":[{"description":"tax year, four digits; absent = last year","in":"query","name":"year","required":false,"schema":{"type":"string"}},{"description":"only this employee's slip","in":"query","name":"employee_id","required":false,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"one T4 slip row per employee"},"403":{"description":"needs payroll.manage"},"422":{"description":"invalid year"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/payroll_t4/csv":{"get":{"operationId":"reports_payroll_t4_csv","parameters":[{"description":"tax year, four digits; absent = last year","in":"query","name":"year","required":false,"schema":{"type":"string"}},{"description":"only this employee's slip","in":"query","name":"employee_id","required":false,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"text/csv":{"schema":{"type":"string"}}},"description":"the T4 slip table as CSV"},"403":{"description":"needs payroll.manage"},"422":{"description":"invalid year"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/payroll_t4/pdf":{"get":{"operationId":"reports_payroll_t4_pdf","parameters":[{"description":"tax year, four digits; absent = last year","in":"query","name":"year","required":false,"schema":{"type":"string"}},{"description":"only this employee's slip","in":"query","name":"employee_id","required":false,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"T4 slips PDF"},"403":{"description":"needs payroll.manage"},"422":{"description":"invalid year"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/payroll_t4_summary":{"get":{"operationId":"reports_payroll_t4_summary","parameters":[{"description":"tax year, four digits; absent = last year","in":"query","name":"year","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the T4 Summary lines 14, 16, 16A, 27, 27A, 18, 19, 22, 80 and 88"},"403":{"description":"needs payroll.manage"},"422":{"description":"invalid year"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/payroll_t4_summary/pdf":{"get":{"operationId":"reports_payroll_t4_summary_pdf","parameters":[{"description":"tax year, four digits; absent = last year","in":"query","name":"year","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"T4 Summary PDF"},"403":{"description":"needs payroll.manage"},"422":{"description":"invalid year"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/payroll_t4a":{"get":{"operationId":"reports_payroll_t4a","parameters":[{"description":"tax year, four digits; absent = last year","in":"query","name":"year","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"one T4A slip row per sub-contractor: box 048 fees for services, box 022 income tax"},"403":{"description":"needs payroll.manage"},"422":{"description":"invalid year"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/payroll_t4a/pdf":{"get":{"operationId":"reports_payroll_t4a_pdf","parameters":[{"description":"tax year, four digits; absent = last year","in":"query","name":"year","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"T4A slips PDF"},"403":{"description":"needs payroll.manage"},"422":{"description":"invalid year"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/payroll_vacation":{"get":{"operationId":"reports_payroll_vacation","parameters":[{"description":"vacation date YYYY-MM-DD","in":"query","name":"as_of","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"payroll vacation table"},"403":{"description":"needs payroll.manage"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/payroll_vacation/pdf":{"get":{"operationId":"reports_payroll_vacation_pdf","parameters":[{"description":"vacation date YYYY-MM-DD","in":"query","name":"as_of","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"payroll vacation PDF"},"403":{"description":"needs payroll.manage"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/payroll_vacation/text":{"get":{"operationId":"reports_payroll_vacation_text","parameters":[{"description":"date YYYY-MM-DD","in":"query","name":"as_of","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"PRVACPAY as a text report"},"403":{"description":"needs payroll.manage"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/payroll_vacation/text/pdf":{"get":{"operationId":"reports_payroll_vacation_text_pdf","parameters":[{"description":"date YYYY-MM-DD","in":"query","name":"as_of","required":false,"schema":{"type":"string"}},{"description":"portrait|landscape for pages wider than 80 columns","in":"query","name":"orientation","required":false,"schema":{"type":"string"}},{"description":"actual|page for pages wider than 80 columns","in":"query","name":"fit","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"PRVACPAY as a fixed-pitch PDF"},"403":{"description":"needs payroll.manage"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/payroll_work_class_list/text":{"get":{"operationId":"reports_payroll_work_class_list_text","responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"PRCLASSR as a text report"},"403":{"description":"needs payroll.view"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/payroll_work_class_list/text/pdf":{"get":{"operationId":"reports_payroll_work_class_list_text_pdf","parameters":[{"description":"portrait|landscape for pages wider than 80 columns","in":"query","name":"orientation","required":false,"schema":{"type":"string"}},{"description":"actual|page for pages wider than 80 columns","in":"query","name":"fit","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"PRCLASSR as a fixed-pitch PDF"},"403":{"description":"needs payroll.view"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/payroll_wsib":{"get":{"operationId":"reports_payroll_wsib","parameters":[{"description":"first pay date YYYY-MM-DD, one calendar year","in":"query","name":"from","required":true,"schema":{"type":"string"}},{"description":"last pay date YYYY-MM-DD, one calendar year","in":"query","name":"to","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"WSIB premiums table"},"403":{"description":"needs payroll.manage"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/payroll_wsib/pdf":{"get":{"operationId":"reports_payroll_wsib_pdf","parameters":[{"description":"first pay date YYYY-MM-DD, one calendar year","in":"query","name":"from","required":true,"schema":{"type":"string"}},{"description":"last pay date YYYY-MM-DD, one calendar year","in":"query","name":"to","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"WSIB premiums PDF"},"403":{"description":"needs payroll.manage"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/payroll_year_end_review":{"get":{"operationId":"reports_payroll_year_end_review","parameters":[{"description":"tax year, four digits; absent = last year","in":"query","name":"year","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the year-end review: deductions against the required CPP, CPP2 and EI, and the filing problems"},"403":{"description":"needs payroll.manage"},"422":{"description":"invalid year"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/payroll_year_end_review/pdf":{"get":{"operationId":"reports_payroll_year_end_review_pdf","parameters":[{"description":"tax year, four digits; absent = last year","in":"query","name":"year","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"the year-end review as a PDF"},"403":{"description":"needs payroll.manage"},"422":{"description":"invalid year"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/possible_duplicates":{"get":{"operationId":"reports_possible_duplicates","responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"possible duplicate customers and vehicles as a report table"},"401":{"description":"unauthenticated"},"403":{"description":"needs customers.read"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/possible_duplicates/pdf":{"get":{"operationId":"reports_possible_duplicates_pdf","responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"possible duplicate customers and vehicles as a PDF"},"401":{"description":"unauthenticated"},"403":{"description":"needs customers.read"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/pst":{"get":{"operationId":"reports_pst","parameters":[{"description":"YYYY-MM-DD","in":"query","name":"from","required":true,"schema":{"type":"string"}},{"description":"YYYY-MM-DD","in":"query","name":"to","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"PST table: collected, paid back or adjusted, and net for each PST account"},"403":{"description":"needs reports.view"},"422":{"description":"invalid period"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/pst/pdf":{"get":{"operationId":"reports_pst_pdf","parameters":[{"description":"YYYY-MM-DD","in":"query","name":"from","required":true,"schema":{"type":"string"}},{"description":"YYYY-MM-DD","in":"query","name":"to","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"PST PDF"},"403":{"description":"needs reports.view"},"422":{"description":"invalid period"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/sales_class":{"get":{"operationId":"reports_sales_class","parameters":[{"description":"period 1 start YYYY-MM-DD","in":"query","name":"from1","required":true,"schema":{"type":"string"}},{"description":"period 1 end YYYY-MM-DD","in":"query","name":"to1","required":true,"schema":{"type":"string"}},{"description":"period 2 start (blank suppresses period 2)","in":"query","name":"from2","required":false,"schema":{"type":"string"}},{"description":"period 2 end","in":"query","name":"to2","required":false,"schema":{"type":"string"}},{"description":"period 1 title (10)","in":"query","name":"title1","required":false,"schema":{"type":"string"}},{"description":"period 2 title (10)","in":"query","name":"title2","required":false,"schema":{"type":"string"}},{"description":"80 (default here) | 132","in":"query","name":"width","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"SERCLRPT as a report table"},"401":{"description":"unauthenticated"},"403":{"description":"needs reports.view"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/sales_class/pdf":{"get":{"operationId":"reports_sales_class_pdf","parameters":[{"description":"period 1 start YYYY-MM-DD","in":"query","name":"from1","required":true,"schema":{"type":"string"}},{"description":"period 1 end YYYY-MM-DD","in":"query","name":"to1","required":true,"schema":{"type":"string"}},{"description":"period 2 start (blank suppresses period 2)","in":"query","name":"from2","required":false,"schema":{"type":"string"}},{"description":"period 2 end","in":"query","name":"to2","required":false,"schema":{"type":"string"}},{"description":"period 1 title (10)","in":"query","name":"title1","required":false,"schema":{"type":"string"}},{"description":"period 2 title (10)","in":"query","name":"title2","required":false,"schema":{"type":"string"}},{"description":"132 (default here) | 80","in":"query","name":"width","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"SERCLRPT as a PDF"},"401":{"description":"unauthenticated"},"403":{"description":"needs reports.view"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/sales_class/text":{"get":{"operationId":"reports_sales_class_text","parameters":[{"description":"period 1 start YYYY-MM-DD (blank: everything up to to1)","in":"query","name":"from1","required":false,"schema":{"type":"string"}},{"description":"period 1 end YYYY-MM-DD","in":"query","name":"to1","required":true,"schema":{"type":"string"}},{"description":"period 2 start (blank suppresses period 2)","in":"query","name":"from2","required":false,"schema":{"type":"string"}},{"description":"period 2 end","in":"query","name":"to2","required":false,"schema":{"type":"string"}},{"description":"period 1 title (10)","in":"query","name":"title1","required":false,"schema":{"type":"string"}},{"description":"period 2 title (10)","in":"query","name":"title2","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"SERCLRPT as a text report: condensed parts pages then 80-column labour pages; the screen stops before the labour section"},"401":{"description":"unauthenticated"},"403":{"description":"needs reports.view"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/sales_class/text/pdf":{"get":{"operationId":"reports_sales_class_text_pdf","parameters":[{"description":"period 1 start YYYY-MM-DD (blank: everything up to to1)","in":"query","name":"from1","required":false,"schema":{"type":"string"}},{"description":"period 1 end YYYY-MM-DD","in":"query","name":"to1","required":true,"schema":{"type":"string"}},{"description":"period 2 start (blank suppresses period 2)","in":"query","name":"from2","required":false,"schema":{"type":"string"}},{"description":"period 2 end","in":"query","name":"to2","required":false,"schema":{"type":"string"}},{"description":"period 1 title (10)","in":"query","name":"title1","required":false,"schema":{"type":"string"}},{"description":"period 2 title (10)","in":"query","name":"title2","required":false,"schema":{"type":"string"}},{"description":"portrait|landscape for pages wider than 80 columns (default: the location's reports.print setting, else landscape)","in":"query","name":"orientation","required":false,"schema":{"type":"string"}},{"description":"actual|page for pages wider than 80 columns (default: the setting, else page)","in":"query","name":"fit","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"SERCLRPT as a fixed-pitch PDF"},"401":{"description":"unauthenticated"},"403":{"description":"needs reports.view"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/sales_journal/text":{"get":{"operationId":"reports_sales_journal_text","parameters":[{"description":"date (default) | customer","in":"query","name":"by","required":false,"schema":{"type":"string"}},{"description":"first invoice date YYYY-MM-DD (required)","in":"query","name":"from","required":true,"schema":{"type":"string"}},{"description":"last invoice date YYYY-MM-DD (required)","in":"query","name":"to","required":true,"schema":{"type":"string"}},{"description":"by=customer: first customer number of the range (required)","in":"query","name":"customer_from","required":false,"schema":{"type":"string"}},{"description":"by=customer: last customer number of the range; empty selects nothing","in":"query","name":"customer_to","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the Sales Journal as a text report (FoxPro ARSALER options 2 and 3); no pages when no invoice matches"},"401":{"description":"unauthenticated"},"403":{"description":"needs reports.view"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/sales_journal/text/pdf":{"get":{"operationId":"reports_sales_journal_text_pdf","parameters":[{"description":"date (default) | customer","in":"query","name":"by","required":false,"schema":{"type":"string"}},{"description":"first invoice date YYYY-MM-DD (required)","in":"query","name":"from","required":true,"schema":{"type":"string"}},{"description":"last invoice date YYYY-MM-DD (required)","in":"query","name":"to","required":true,"schema":{"type":"string"}},{"description":"by=customer: first customer number of the range (required)","in":"query","name":"customer_from","required":false,"schema":{"type":"string"}},{"description":"by=customer: last customer number of the range","in":"query","name":"customer_to","required":false,"schema":{"type":"string"}},{"description":"portrait|landscape for pages wider than 80 columns (no effect here)","in":"query","name":"orientation","required":false,"schema":{"type":"string"}},{"description":"actual|page for pages wider than 80 columns (no effect here)","in":"query","name":"fit","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"the same listing as a fixed-pitch PDF"},"401":{"description":"unauthenticated"},"403":{"description":"needs reports.view"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/saved":{"get":{"operationId":"reports_saved_list","responses":{"200":{"description":"the saved reports: name, question, description, params, display, origin (no SQL)"},"401":{"description":"unauthenticated"},"403":{"description":"needs reports.view"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/saved/{name}":{"get":{"operationId":"reports_saved_show","parameters":[{"description":"the report's name","in":"path","name":"name","required":true,"schema":{"type":"string"}},{"description":"a range word such as last_month","in":"query","name":"range","required":false,"schema":{"type":"string"}},{"description":"YYYY-MM-DD, with to","in":"query","name":"from","required":false,"schema":{"type":"string"}},{"description":"YYYY-MM-DD, with from","in":"query","name":"to","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"the report run now, as a report table"},"401":{"description":"unauthenticated"},"403":{"description":"needs reports.view"},"404":{"description":"no saved report of that name"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/saved/{name}/csv":{"get":{"operationId":"reports_saved_show_csv","parameters":[{"description":"the report's name","in":"path","name":"name","required":true,"schema":{"type":"string"}},{"description":"a range word such as last_month","in":"query","name":"range","required":false,"schema":{"type":"string"}},{"description":"YYYY-MM-DD, with to","in":"query","name":"from","required":false,"schema":{"type":"string"}},{"description":"YYYY-MM-DD, with from","in":"query","name":"to","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"text/csv":{"schema":{"type":"string"}}},"description":"the same table as CSV"},"401":{"description":"unauthenticated"},"403":{"description":"needs reports.view"},"404":{"description":"no saved report of that name"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/saved/{name}/pdf":{"get":{"operationId":"reports_saved_show_pdf","parameters":[{"description":"the report's name","in":"path","name":"name","required":true,"schema":{"type":"string"}},{"description":"a range word such as last_month","in":"query","name":"range","required":false,"schema":{"type":"string"}},{"description":"YYYY-MM-DD, with to","in":"query","name":"from","required":false,"schema":{"type":"string"}},{"description":"YYYY-MM-DD, with from","in":"query","name":"to","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"the same table as a PDF"},"401":{"description":"unauthenticated"},"403":{"description":"needs reports.view"},"404":{"description":"no saved report of that name"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/service_sales":{"get":{"operationId":"reports_service_sales","parameters":[{"description":"first invoice date YYYY-MM-DD","in":"query","name":"from","required":true,"schema":{"type":"string"}},{"description":"last invoice date YYYY-MM-DD","in":"query","name":"to","required":true,"schema":{"type":"string"}},{"description":"80 (default here) | 132","in":"query","name":"width","required":false,"schema":{"type":"string"}},{"description":"class = the sales-by-class rows instead of the invoice list","in":"query","name":"by","required":false,"schema":{"type":"string"}},{"description":"previous = the equal-length period before, beside it","in":"query","name":"compare","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"SERSALEJ as a report table"},"401":{"description":"unauthenticated"},"403":{"description":"needs reports.view and customers.read"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/service_sales/pdf":{"get":{"operationId":"reports_service_sales_pdf","parameters":[{"description":"first invoice date YYYY-MM-DD","in":"query","name":"from","required":true,"schema":{"type":"string"}},{"description":"last invoice date YYYY-MM-DD","in":"query","name":"to","required":true,"schema":{"type":"string"}},{"description":"132 (default here) | 80","in":"query","name":"width","required":false,"schema":{"type":"string"}},{"description":"class = the sales-by-class rows instead of the invoice list","in":"query","name":"by","required":false,"schema":{"type":"string"}},{"description":"previous = the equal-length period before, beside it","in":"query","name":"compare","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"SERSALEJ as a PDF"},"401":{"description":"unauthenticated"},"403":{"description":"needs reports.view and customers.read"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/service_sales/text":{"get":{"operationId":"reports_service_sales_text","parameters":[{"description":"first invoice date YYYY-MM-DD","in":"query","name":"from","required":true,"schema":{"type":"string"}},{"description":"last invoice date YYYY-MM-DD","in":"query","name":"to","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"SERSALEJ as a text report: 80-column screen pages and 133-column condensed printer pages; no pages when no invoice is in the range"},"401":{"description":"unauthenticated"},"403":{"description":"needs reports.view and customers.read"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/service_sales/text/pdf":{"get":{"operationId":"reports_service_sales_text_pdf","parameters":[{"description":"first invoice date YYYY-MM-DD","in":"query","name":"from","required":true,"schema":{"type":"string"}},{"description":"last invoice date YYYY-MM-DD","in":"query","name":"to","required":true,"schema":{"type":"string"}},{"description":"portrait|landscape for pages wider than 80 columns (default: the location's reports.print setting, else landscape)","in":"query","name":"orientation","required":false,"schema":{"type":"string"}},{"description":"actual|page for pages wider than 80 columns (default: the setting, else page)","in":"query","name":"fit","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"SERSALEJ as a fixed-pitch PDF"},"401":{"description":"unauthenticated"},"403":{"description":"needs reports.view and customers.read"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/statements/text":{"get":{"operationId":"reports_statements_text","parameters":[{"description":"individual | all (default) | overdue","in":"query","name":"mode","required":false,"schema":{"type":"string"}},{"description":"base date YYYY-MM-DD (required)","in":"query","name":"as_of","required":true,"schema":{"type":"string"}},{"description":"individual: the customer","in":"query","name":"customer_id","required":false,"schema":{"format":"int64","type":"integer"}},{"description":"individual: comma-separated customer ids, printed in this order","in":"query","name":"customer_ids","required":false,"schema":{"type":"string"}},{"description":"individual: the customer number","in":"query","name":"customer_number","required":false,"schema":{"type":"string"}},{"description":"all: first customer number","in":"query","name":"from","required":false,"schema":{"type":"string"}},{"description":"all: last customer number","in":"query","name":"to","required":false,"schema":{"type":"string"}},{"description":"overdue: days (default 30)","in":"query","name":"overdue_days","required":false,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the statements as a text report (FoxPro ARSTATE: 80-column printer pages, no screen pages; no pages when nothing qualifies)"},"401":{"description":"unauthenticated"},"403":{"description":"needs reports.view"},"404":{"description":"unknown customer"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/statements/text/pdf":{"get":{"operationId":"reports_statements_text_pdf","parameters":[{"description":"individual | all (default) | overdue","in":"query","name":"mode","required":false,"schema":{"type":"string"}},{"description":"base date YYYY-MM-DD (required)","in":"query","name":"as_of","required":true,"schema":{"type":"string"}},{"description":"individual: the customer","in":"query","name":"customer_id","required":false,"schema":{"format":"int64","type":"integer"}},{"description":"individual: comma-separated customer ids, printed in this order","in":"query","name":"customer_ids","required":false,"schema":{"type":"string"}},{"description":"individual: the customer number","in":"query","name":"customer_number","required":false,"schema":{"type":"string"}},{"description":"all: first customer number","in":"query","name":"from","required":false,"schema":{"type":"string"}},{"description":"all: last customer number","in":"query","name":"to","required":false,"schema":{"type":"string"}},{"description":"overdue: days (default 30)","in":"query","name":"overdue_days","required":false,"schema":{"format":"int64","type":"integer"}},{"description":"portrait|landscape for pages wider than 80 columns (no effect on a statement)","in":"query","name":"orientation","required":false,"schema":{"type":"string"}},{"description":"actual|page for pages wider than 80 columns (no effect on a statement)","in":"query","name":"fit","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"the statements as a fixed-pitch PDF"},"401":{"description":"unauthenticated"},"403":{"description":"needs reports.view"},"404":{"description":"unknown customer"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/suggested_fleets":{"get":{"operationId":"reports_suggested_fleets","responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"customers that look like fleets as a report table"},"401":{"description":"unauthenticated"},"403":{"description":"needs customers.read"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/suggested_fleets/pdf":{"get":{"operationId":"reports_suggested_fleets_pdf","responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"customers that look like fleets as a PDF"},"401":{"description":"unauthenticated"},"403":{"description":"needs customers.read"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/technician_list/text":{"get":{"operationId":"reports_technician_list_text","responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the Technician List (SERWORK [P]rint) as a text report"},"401":{"description":"unauthenticated"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/technician_list/text/pdf":{"get":{"operationId":"reports_technician_list_text_pdf","parameters":[{"description":"portrait|landscape for pages wider than 80 columns","in":"query","name":"orientation","required":false,"schema":{"type":"string"}},{"description":"actual|page for pages wider than 80 columns","in":"query","name":"fit","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"the Technician List as a fixed-pitch PDF"},"401":{"description":"unauthenticated"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/technician_productivity":{"get":{"operationId":"reports_technician_productivity","parameters":[{"description":"first business date YYYY-MM-DD","in":"query","name":"from","required":true,"schema":{"type":"string"}},{"description":"last business date YYYY-MM-DD","in":"query","name":"to","required":true,"schema":{"type":"string"}},{"description":"technician code; blank = all","in":"query","name":"technician","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"Clocked against billed hours per technician"},"401":{"description":"unauthenticated"},"403":{"description":"needs reports.view"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/technician_productivity/pdf":{"get":{"operationId":"reports_technician_productivity_pdf","parameters":[{"description":"first business date YYYY-MM-DD","in":"query","name":"from","required":true,"schema":{"type":"string"}},{"description":"last business date YYYY-MM-DD","in":"query","name":"to","required":true,"schema":{"type":"string"}},{"description":"technician code; blank = all","in":"query","name":"technician","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"The report as a PDF"},"401":{"description":"unauthenticated"},"403":{"description":"needs reports.view"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/trial_balance":{"get":{"operationId":"reports_trial_balance","parameters":[{"description":"YYYY-MM-DD: lines dated on or before it","in":"query","name":"as_of","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"trial balance table"},"403":{"description":"needs reports.view"},"422":{"description":"invalid as_of"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/trial_balance/pdf":{"get":{"operationId":"reports_trial_balance_pdf","parameters":[{"description":"YYYY-MM-DD","in":"query","name":"as_of","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"trial balance PDF"},"403":{"description":"needs reports.view"},"422":{"description":"invalid as_of"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/user_access_log":{"get":{"operationId":"reports_user_access_log","parameters":[{"description":"first sign-in date YYYY-MM-DD (required)","in":"query","name":"from","required":true,"schema":{"type":"string"}},{"description":"last sign-in date YYYY-MM-DD (required)","in":"query","name":"to","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the user access log (report table)"},"401":{"description":"unauthenticated"},"403":{"description":"needs users.manage"},"422":{"description":"invalid dates"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/user_access_log/pdf":{"get":{"operationId":"reports_user_access_log_pdf","parameters":[{"description":"first sign-in date YYYY-MM-DD (required)","in":"query","name":"from","required":true,"schema":{"type":"string"}},{"description":"last sign-in date YYYY-MM-DD (required)","in":"query","name":"to","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"the user access log as a PDF"},"401":{"description":"unauthenticated"},"403":{"description":"needs users.manage"},"422":{"description":"invalid dates"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/user_access_log/text":{"get":{"operationId":"reports_user_access_log_text","parameters":[{"description":"first sign-in date YYYY-MM-DD (required)","in":"query","name":"from","required":true,"schema":{"type":"string"}},{"description":"last sign-in date YYYY-MM-DD (required); before `from` gives a report with no page","in":"query","name":"to","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the user access log as a text report (printer and screen pages)"},"401":{"description":"unauthenticated"},"403":{"description":"needs users.manage"},"422":{"description":"a date is missing or malformed"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/user_access_log/text/pdf":{"get":{"operationId":"reports_user_access_log_text_pdf","parameters":[{"description":"first sign-in date YYYY-MM-DD (required)","in":"query","name":"from","required":true,"schema":{"type":"string"}},{"description":"last sign-in date YYYY-MM-DD (required)","in":"query","name":"to","required":true,"schema":{"type":"string"}},{"description":"portrait|landscape for pages wider than 80 columns (no effect here)","in":"query","name":"orientation","required":false,"schema":{"type":"string"}},{"description":"actual|page for pages wider than 80 columns (no effect here)","in":"query","name":"fit","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"the user access log as a fixed-pitch PDF"},"401":{"description":"unauthenticated"},"403":{"description":"needs users.manage"},"422":{"description":"a date is missing or malformed"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/user_list/text":{"get":{"operationId":"reports_user_list_text","responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the user list as a text report (printer and screen pages)"},"401":{"description":"unauthenticated"},"403":{"description":"needs users.manage"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/user_list/text/pdf":{"get":{"operationId":"reports_user_list_text_pdf","parameters":[{"description":"portrait|landscape for pages wider than 80 columns (no effect here)","in":"query","name":"orientation","required":false,"schema":{"type":"string"}},{"description":"actual|page for pages wider than 80 columns (no effect here)","in":"query","name":"fit","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"the user list as a fixed-pitch PDF"},"401":{"description":"unauthenticated"},"403":{"description":"needs users.manage"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/vehicle_history":{"get":{"operationId":"reports_vehicle_history","parameters":[{"description":"licence plate","in":"query","name":"license","required":true,"schema":{"type":"string"}},{"description":"first invoice date YYYY-MM-DD","in":"query","name":"from","required":true,"schema":{"type":"string"}},{"description":"last invoice date YYYY-MM-DD","in":"query","name":"to","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"SERHISTR as a report table"},"401":{"description":"unauthenticated"},"403":{"description":"needs reports.view and customers.read"},"422":{"description":"invalid parameters or no such plate"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/vehicle_history/pdf":{"get":{"operationId":"reports_vehicle_history_pdf","parameters":[{"description":"licence plate","in":"query","name":"license","required":true,"schema":{"type":"string"}},{"description":"first invoice date YYYY-MM-DD","in":"query","name":"from","required":true,"schema":{"type":"string"}},{"description":"last invoice date YYYY-MM-DD","in":"query","name":"to","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"SERHISTR as a PDF"},"401":{"description":"unauthenticated"},"403":{"description":"needs reports.view and customers.read"},"422":{"description":"invalid parameters or no such plate"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/vehicle_history/text":{"get":{"operationId":"reports_vehicle_history_text","parameters":[{"description":"licence plate","in":"query","name":"license","required":true,"schema":{"type":"string"}},{"description":"first invoice date YYYY-MM-DD","in":"query","name":"from","required":true,"schema":{"type":"string"}},{"description":"last invoice date YYYY-MM-DD","in":"query","name":"to","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"SERHISTR as a text report, newest invoice first; a range without invoices is a page with a zero total"},"401":{"description":"unauthenticated"},"403":{"description":"needs reports.view and customers.read"},"422":{"description":"invalid parameters, or no posted invoice carries the plate"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/vehicle_history/text/pdf":{"get":{"operationId":"reports_vehicle_history_text_pdf","parameters":[{"description":"licence plate","in":"query","name":"license","required":true,"schema":{"type":"string"}},{"description":"first invoice date YYYY-MM-DD","in":"query","name":"from","required":true,"schema":{"type":"string"}},{"description":"last invoice date YYYY-MM-DD","in":"query","name":"to","required":true,"schema":{"type":"string"}},{"description":"portrait|landscape for pages wider than 80 columns (none here)","in":"query","name":"orientation","required":false,"schema":{"type":"string"}},{"description":"actual|page for pages wider than 80 columns (none here)","in":"query","name":"fit","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"SERHISTR as a fixed-pitch PDF"},"401":{"description":"unauthenticated"},"403":{"description":"needs reports.view and customers.read"},"422":{"description":"invalid parameters, or no posted invoice carries the plate"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/vendor_list/text":{"get":{"operationId":"reports_vendor_list_text","parameters":[{"description":"name | number","in":"query","name":"order","required":true,"schema":{"type":"string"}},{"description":"detailed | summary","in":"query","name":"form","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the Vendor List (FoxPro APVENLIS) as a text report; no pages when there is no vendor"},"401":{"description":"unauthenticated"},"422":{"description":"order or form missing or unknown"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/vendor_list/text/pdf":{"get":{"operationId":"reports_vendor_list_text_pdf","parameters":[{"description":"name | number","in":"query","name":"order","required":true,"schema":{"type":"string"}},{"description":"detailed | summary","in":"query","name":"form","required":true,"schema":{"type":"string"}},{"description":"portrait|landscape for pages wider than 80 columns (no effect here)","in":"query","name":"orientation","required":false,"schema":{"type":"string"}},{"description":"actual|page for pages wider than 80 columns (no effect here)","in":"query","name":"fit","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"the Vendor List as a fixed-pitch PDF"},"401":{"description":"unauthenticated"},"422":{"description":"order or form missing or unknown"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/vendor_terms_list/text":{"get":{"operationId":"reports_vendor_terms_list_text","responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the A/P Payment Terms List (FoxPro APPAYLIS) as a text report; no pages when the table is empty"},"401":{"description":"unauthenticated"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/reports/vendor_terms_list/text/pdf":{"get":{"operationId":"reports_vendor_terms_list_text_pdf","parameters":[{"description":"portrait|landscape for pages wider than 80 columns (no effect here)","in":"query","name":"orientation","required":false,"schema":{"type":"string"}},{"description":"actual|page for pages wider than 80 columns (no effect here)","in":"query","name":"fit","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"the A/P Payment Terms List as a fixed-pitch PDF"},"401":{"description":"unauthenticated"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/sale_codes":{"get":{"operationId":"sale_codes_index","responses":{"200":{"content":{"application/json":{"schema":{"items":{"type":"object"},"type":"array"}}},"description":"the users who may be a customer's sale code: `code` (the user number) and `name`, in code order"},"401":{"description":"unauthenticated"}},"security":[{"bearer":[]}],"tags":["Customers"]}},"/search":{"get":{"operationId":"search_index","parameters":[{"description":"search term","in":"query","name":"q","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"items":{"type":"object"},"type":"array"}}},"description":"search results"},"401":{"description":"unauthenticated"}},"security":[{"bearer":[]}],"tags":["Search"]}},"/search/hits":{"get":{"operationId":"search_hits","parameters":[{"description":"what the person typed","in":"query","name":"q","required":true,"schema":{"type":"string"}},{"description":"comma list: customer, driver, vehicle, work_order, part, package, labor, vendor, note, message","in":"query","name":"types","required":false,"schema":{"type":"string"}},{"description":"hits per page, 1 to 100 (default 20)","in":"query","name":"limit","required":false,"schema":{"minimum":0,"type":"integer"}},{"description":"next_cursor of the page before","in":"query","name":"cursor","required":false,"schema":{"type":"string"}},{"description":"rank this location's stock and orders first","in":"query","name":"location_id","required":false,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"one page of ranked hits with match ranges"},"401":{"description":"unauthenticated"},"422":{"description":"invalid types, limit or cursor"}},"security":[{"bearer":[]}],"tags":["Search"]}},"/search/sections":{"get":{"operationId":"search_sections","parameters":[{"description":"what the person typed","in":"query","name":"q","required":true,"schema":{"type":"string"}},{"description":"comma list, as for /search/hits","in":"query","name":"types","required":false,"schema":{"type":"string"}},{"description":"hits of each type, 1 to 20 (default 5)","in":"query","name":"per_type","required":false,"schema":{"minimum":0,"type":"integer"}},{"description":"rank this location's stock and orders first","in":"query","name":"location_id","required":false,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"a few ranked hits of every type, and the types with more"},"401":{"description":"unauthenticated"},"422":{"description":"invalid types or per_type"}},"security":[{"bearer":[]}],"tags":["Search"]}},"/service_categories":{"get":{"operationId":"service_categories_index","parameters":[{"description":"match the category name, case-insensitive","in":"query","name":"q","required":false,"schema":{"type":"string"}},{"description":"true (default): active categories only","in":"query","name":"active","required":false,"schema":{"type":"boolean"}}],"responses":{"200":{"content":{"application/json":{"schema":{"items":{"type":"object"},"type":"array"}}},"description":"service category list"},"401":{"description":"unauthenticated"}},"security":[{"bearer":[]}],"tags":["ServiceCategories"]},"post":{"operationId":"service_categories_create","requestBody":{"content":{"application/json":{"schema":{"type":"object"}}},"required":true},"responses":{"201":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"service category created"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized"},"422":{"description":"validation failed"}},"security":[{"bearer":[]}],"tags":["ServiceCategories"]}},"/service_categories/{id}":{"get":{"operationId":"service_categories_show","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"service category"},"401":{"description":"unauthenticated"},"404":{"description":"not found"}},"security":[{"bearer":[]}],"tags":["ServiceCategories"]},"patch":{"operationId":"service_categories_update","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"service category updated"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized"},"404":{"description":"not found"},"409":{"description":"conflict"},"422":{"description":"validation failed"}},"security":[{"bearer":[]}],"tags":["ServiceCategories"]}},"/service_options":{"get":{"operationId":"service_options_show","parameters":[{"description":"the location; default: the user's own","in":"query","name":"location_id","required":false,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the Service option document: location_id, last_order_number and last_estimate_number (a number or null), keep_estimates_days, misc_part_margin_hundredths, min_parts_margin_hundredths, check_credit_limit, labor_rates (five of code and rate_cents), function_keys (labour and sublet, nine texts each), fixed (the SEOPTION values Wenmar shows and does not let a user change)"},"401":{"description":"unauthenticated"},"403":{"description":"the user may not read this location"},"404":{"description":"no such location"}},"security":[{"bearer":[]}],"tags":["Workflow Config"]},"patch":{"operationId":"service_options_update","parameters":[{"description":"the location; default: the user's own","in":"query","name":"location_id","required":false,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"properties":{"check_credit_limit":{"default":null,"description":"Refuse posting on account above the customer's credit limit","type":["boolean","null"]},"function_keys":{"anyOf":[{"properties":{"labour":{"default":null,"description":"Nine texts for a labour description, F2 first; left out = not changed","items":{"type":"string"},"type":["array","null"]},"sublet":{"default":null,"description":"Nine texts for a sublet description, F2 first; left out = not changed","items":{"type":"string"},"type":["array","null"]}},"type":"object"},{"type":"null"}],"default":null,"description":"The function-key texts; left out = not changed"},"keep_estimates_days":{"default":null,"description":"Days an estimate is kept, 0-999 (stored; nothing is deleted by age)","format":"int64","type":["integer","null"]},"labor_rates":{"default":null,"description":"The labour rates, at most five; replaces the list; left out = not changed","items":{"properties":{"code":{"default":"","description":"One letter or digit; blank = this place is empty","type":"string"},"rate_cents":{"default":0,"description":"Hourly rate in cents, 0-99999","format":"int64","type":"integer"}},"type":"object"},"type":["array","null"]},"location_id":{"default":null,"description":"The location whose options are changed; default: the user's own","format":"int64","type":["integer","null"]},"min_parts_margin_hundredths":{"default":null,"description":"Minimum margin of a part line, hundredths of a percent, 0-9999; 0 = no check","format":"int64","type":["integer","null"]},"misc_part_margin_hundredths":{"default":null,"description":"Margin proposed for a free-text part and a sublet, hundredths of a percent, 0-9999","format":"int64","type":["integer","null"]}},"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the document after the change"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs settings.manage)"},"404":{"description":"no such location"},"422":{"description":"validation_failed on keep_estimates_days, misc_part_margin_hundredths, min_parts_margin_hundredths, labor_rates or function_keys"}},"security":[{"bearer":[]}],"tags":["Workflow Config"]}},"/services/{id}":{"delete":{"operationId":"work_order_service_delete","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"{removed_id}: the undo copy (plan 3563)"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized or another location's work order"},"404":{"description":"not found"},"409":{"description":"already_posted or work_order_not_editable"},"422":{"description":"invalid request"}},"security":[{"bearer":[]}],"tags":["Work Orders"]},"get":{"operationId":"work_order_service_show","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"service"},"401":{"description":"unauthenticated"},"403":{"description":"another location's work order"},"404":{"description":"not found"}},"security":[{"bearer":[]}],"tags":["Work Orders"]},"patch":{"operationId":"work_order_service_update","parameters":[{"description":"ETag from the last read (plan 105)","in":"header","name":"If-Match","required":false,"schema":{"type":["string","null"]}},{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CrudBody"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"service updated"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized or another location's work order"},"404":{"description":"not found"},"409":{"description":"already_posted or work_order_not_editable"},"412":{"description":"record changed since If-Match; body.current is the record now"},"422":{"description":"invalid request"}},"security":[{"bearer":[]}],"tags":["Work Orders"]}},"/services/{id}/approve":{"post":{"operationId":"work_order_service_approve","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"description":"One customer decision on one service.","properties":{"authorized_by_name":{"default":null,"description":"Who gave the answer; required when the location uses formal authorization","type":["string","null"]},"authorized_by_phone":{"default":null,"description":"Their phone number","type":["string","null"]},"method":{"default":null,"description":"How the customer answered: in_person, phone, portal or agent (default: agent for an AI\nconnection, in_person otherwise)","type":["string","null"]},"notes":{"default":null,"description":"A note, for example why the customer declined","type":["string","null"]},"signature_attachment_id":{"default":null,"description":"The id of a photo of the customer's signature, staged on this work order\n(`POST /work_orders/{id}/attachments`). Optional; never required.","type":["string","null"]}},"required":[],"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"service"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized"},"404":{"description":"not found"},"409":{"description":"authorization_off, invalid_transition, already_posted or work_order_not_editable"},"422":{"description":"validation_failed"}},"security":[{"bearer":[]}],"tags":["Work Orders"]}},"/services/{id}/clock_off":{"post":{"operationId":"work_order_service_clock_off","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"properties":{"stopped_at":{"default":null,"description":"When the work stopped, RFC 3339, for a clock left running (\"I stopped at four\");\ndefault: now","type":["string","null"]}},"required":[],"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the work order's clock"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized"},"404":{"description":"not found"},"409":{"description":"invalid_transition: not on the clock on this service"},"422":{"description":"validation_failed: stopped_at"}},"security":[{"bearer":[]}],"tags":["Work Orders"]}},"/services/{id}/clock_on":{"post":{"operationId":"work_order_service_clock_on","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the work order's clock"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized"},"404":{"description":"not found"},"409":{"description":"invalid_transition, already_posted or work_order_not_editable"}},"security":[{"bearer":[]}],"tags":["Work Orders"]}},"/services/{id}/decline":{"post":{"operationId":"work_order_service_decline","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"description":"One customer decision on one service.","properties":{"authorized_by_name":{"default":null,"description":"Who gave the answer; required when the location uses formal authorization","type":["string","null"]},"authorized_by_phone":{"default":null,"description":"Their phone number","type":["string","null"]},"method":{"default":null,"description":"How the customer answered: in_person, phone, portal or agent (default: agent for an AI\nconnection, in_person otherwise)","type":["string","null"]},"notes":{"default":null,"description":"A note, for example why the customer declined","type":["string","null"]},"signature_attachment_id":{"default":null,"description":"The id of a photo of the customer's signature, staged on this work order\n(`POST /work_orders/{id}/attachments`). Optional; never required.","type":["string","null"]}},"required":[],"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"service"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized"},"404":{"description":"not found"},"409":{"description":"authorization_off, invalid_transition, parts_received, already_posted or work_order_not_editable"},"422":{"description":"validation_failed"}},"security":[{"bearer":[]}],"tags":["Work Orders"]}},"/services/{id}/dismiss":{"post":{"operationId":"work_order_service_dismiss","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"description":"One customer decision on one service.","properties":{"authorized_by_name":{"default":null,"description":"Who gave the answer; required when the location uses formal authorization","type":["string","null"]},"authorized_by_phone":{"default":null,"description":"Their phone number","type":["string","null"]},"method":{"default":null,"description":"How the customer answered: in_person, phone, portal or agent (default: agent for an AI\nconnection, in_person otherwise)","type":["string","null"]},"notes":{"default":null,"description":"A note, for example why the customer declined","type":["string","null"]},"signature_attachment_id":{"default":null,"description":"The id of a photo of the customer's signature, staged on this work order\n(`POST /work_orders/{id}/attachments`). Optional; never required.","type":["string","null"]}},"required":[],"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"service"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized"},"404":{"description":"not found"},"409":{"description":"invalid_transition"},"422":{"description":"validation_failed"}},"security":[{"bearer":[]}],"tags":["Work Orders"]}},"/services/{id}/duplicate":{"post":{"operationId":"work_order_service_duplicate","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"201":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the copy, with its lines and sublets (Idempotency-Key replays it)"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized"},"404":{"description":"not found"},"409":{"description":"invalid_transition (the general service or a declined one), already_posted or work_order_not_editable"},"422":{"description":"idempotency_key_reused"}},"security":[{"bearer":[]}],"tags":["Work Orders"]}},"/services/{id}/move":{"post":{"operationId":"work_order_service_move","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"properties":{"work_order_id":{"description":"Another open work order of the same vehicle","format":"int64","type":"integer"}},"required":["work_order_id"],"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the moved service"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized or another location's order"},"404":{"description":"not found"},"409":{"description":"invalid_transition, already_posted or work_order_not_editable"},"422":{"description":"validation_failed: not another open order of the same vehicle"}},"security":[{"bearer":[]}],"tags":["Work Orders"]}},"/services/{id}/revive":{"post":{"operationId":"work_order_service_revive","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"description":"One customer decision on one service.","properties":{"authorized_by_name":{"default":null,"description":"Who gave the answer; required when the location uses formal authorization","type":["string","null"]},"authorized_by_phone":{"default":null,"description":"Their phone number","type":["string","null"]},"method":{"default":null,"description":"How the customer answered: in_person, phone, portal or agent (default: agent for an AI\nconnection, in_person otherwise)","type":["string","null"]},"notes":{"default":null,"description":"A note, for example why the customer declined","type":["string","null"]},"signature_attachment_id":{"default":null,"description":"The id of a photo of the customer's signature, staged on this work order\n(`POST /work_orders/{id}/attachments`). Optional; never required.","type":["string","null"]}},"required":[],"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"service"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized"},"404":{"description":"not found"},"409":{"description":"invalid_transition, already_posted or work_order_not_editable"},"422":{"description":"validation_failed"}},"security":[{"bearer":[]}],"tags":["Work Orders"]}},"/services/{id}/save_as_package":{"post":{"operationId":"work_order_service_save_as_package","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"properties":{"code":{"description":"The new package's code (unique, as on the Packages screen)","type":"string"},"name":{"default":null,"description":"The package's name; the service's name when left out","type":["string","null"]}},"required":["code"],"type":"object"}}},"required":false},"responses":{"201":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"{package (the GET /packages/{id} body), skipped (lines a package cannot hold)}"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized (needs catalog.write)"},"404":{"description":"not found"},"409":{"description":"the code is taken"},"422":{"description":"validation_failed or idempotency_key_reused"}},"security":[{"bearer":[]}],"tags":["Work Orders"]}},"/standard_time_cards":{"get":{"operationId":"standard_time_cards_index","parameters":[{"description":"one employee's standard cards","in":"query","name":"employee_id","required":false,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"`{data, total, next_offset, amount_total_cents, regular_total_hundredths, ot1_total_hundredths, ot2_total_hundredths}`; the amounts are computed with the employee's current multipliers"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs payroll.view)"}},"security":[{"bearer":[]}],"tags":["Payroll"]},"post":{"operationId":"standard_time_cards_create","requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"department_id":{"default":null,"format":"int64","type":["integer","null"]},"employee_id":{"default":null,"format":"int64","type":["integer","null"]},"id":{"default":null,"description":"Absent on create; the card to change on update","format":"int64","type":["integer","null"]},"ot1_hundredths":{"default":null,"format":"int64","type":["integer","null"]},"ot2_hundredths":{"default":null,"format":"int64","type":["integer","null"]},"rate_cents":{"default":null,"format":"int64","type":["integer","null"]},"regular_hundredths":{"default":null,"format":"int64","type":["integer","null"]},"work_class_id":{"default":null,"format":"int64","type":["integer","null"]}},"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the new standard card, with the server's rate and amount"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs payroll.manage)"},"422":{"description":"validation_failed: employee_id, hours, rate_cents; idempotency_key_reused"}},"security":[{"bearer":[]}],"tags":["Payroll"]}},"/standard_time_cards/{id}":{"delete":{"operationId":"standard_time_cards_delete","parameters":[{"description":"standard card id","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"`{id, deleted}`"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs payroll.manage)"},"404":{"description":"no such standard card"}},"security":[{"bearer":[]}],"tags":["Payroll"]},"get":{"operationId":"standard_time_cards_show","parameters":[{"description":"standard card id","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the standard card; `rate_cents` and `amount_cents` null without payroll.manage"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs payroll.view)"},"404":{"description":"no such standard card"}},"security":[{"bearer":[]}],"tags":["Payroll"]},"patch":{"operationId":"standard_time_cards_update","parameters":[{"description":"standard card id","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"department_id":{"default":null,"format":"int64","type":["integer","null"]},"employee_id":{"default":null,"format":"int64","type":["integer","null"]},"ot1_hundredths":{"default":null,"format":"int64","type":["integer","null"]},"ot2_hundredths":{"default":null,"format":"int64","type":["integer","null"]},"rate_cents":{"default":null,"format":"int64","type":["integer","null"]},"regular_hundredths":{"default":null,"format":"int64","type":["integer","null"]},"work_class_id":{"default":null,"format":"int64","type":["integer","null"]}},"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the standard card, with the recomputed amount"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs payroll.manage)"},"404":{"description":"no such standard card"},"422":{"description":"validation_failed: employee_id, hours, rate_cents"}},"security":[{"bearer":[]}],"tags":["Payroll"]}},"/statements":{"get":{"operationId":"statements_pdf","parameters":[{"description":"individual | all (default) | overdue","in":"query","name":"mode","required":false,"schema":{"type":"string"}},{"description":"base date YYYY-MM-DD (required)","in":"query","name":"as_of","required":true,"schema":{"type":"string"}},{"description":"individual: the customer","in":"query","name":"customer_id","required":false,"schema":{"format":"int64","type":"integer"}},{"description":"individual: comma-separated customer ids, printed in this order","in":"query","name":"customer_ids","required":false,"schema":{"type":"string"}},{"description":"individual: the FoxPro customer number","in":"query","name":"customer_number","required":false,"schema":{"type":"string"}},{"description":"all: first customer number","in":"query","name":"from","required":false,"schema":{"type":"string"}},{"description":"all: last customer number","in":"query","name":"to","required":false,"schema":{"type":"string"}},{"description":"overdue: days (default 30)","in":"query","name":"overdue_days","required":false,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"every statement in one PDF"},"401":{"description":"unauthenticated"},"403":{"description":"needs reports.view"},"404":{"description":"unknown customer"},"409":{"description":"no_statements: nothing qualifies"},"422":{"description":"invalid parameters"}},"security":[{"bearer":[]}],"tags":["Reports"]}},"/statements/send":{"post":{"operationId":"statements_send","requestBody":{"content":{"application/json":{"schema":{"type":"object"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"`{as_of, sent, no_email}`: the customers an e-mail was queued for and the ones with no e-mail to print"},"401":{"description":"unauthenticated"},"403":{"description":"needs reports.view and messages.send"},"409":{"description":"no_statements: nothing qualifies"},"422":{"description":"invalid parameters, mode individual, or a missing Idempotency-Key"}},"security":[{"bearer":[]}],"summary":"`POST /statements/send` (plan 4006): the month-end batch. Every customer the batch selects\nis e-mailed their statement (one queued message each, rendered at delivery); the answer\nnames who was sent one and who has no e-mail so the shop can print theirs. `Idempotency-Key`\nis required: a repeat queues nothing new and finishes a request cut off half way.","tags":["Reports"]}},"/sublet_orders/{id}":{"delete":{"operationId":"sublet_order_delete","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"204":{"description":"sublet order deleted"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized or another location's work order"},"404":{"description":"not found"},"409":{"description":"already_posted or work_order_not_editable"}},"security":[{"bearer":[]}],"tags":["Work Orders"]},"patch":{"operationId":"sublet_order_update","parameters":[{"description":"ETag from the last read (plan 105)","in":"header","name":"If-Match","required":false,"schema":{"type":["string","null"]}},{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CrudBody"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"sublet order updated"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized or another location's work order"},"404":{"description":"not found"},"409":{"description":"already_posted or work_order_not_editable"},"412":{"description":"record changed since If-Match; body.current is the record now"},"422":{"description":"invalid request"}},"security":[{"bearer":[]}],"tags":["Work Orders"]}},"/technician_sales_accounts":{"get":{"operationId":"technician_sales_accounts_index","responses":{"200":{"content":{"application/json":{"schema":{"items":{"type":"object"},"type":"array"}}},"description":"G/L accounts a technician may be given (number, name), in number order; empty when the location has no account list"},"401":{"description":"unauthenticated"}},"security":[{"bearer":[]}],"tags":["Technicians"]}},"/technicians":{"get":{"operationId":"technicians_index","parameters":[{"description":"match technician code or name, case-insensitive","in":"query","name":"q","required":false,"schema":{"type":"string"}},{"description":"true: active technicians only","in":"query","name":"active","required":false,"schema":{"type":"boolean"}},{"description":"exact technician number, inactive included; other filters are ignored with it","in":"query","name":"code","required":false,"schema":{"type":"string"}},{"description":"that location's technicians plus the shared ones (no location)","in":"query","name":"location_id","required":false,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"items":{"type":"object"},"type":"array"}}},"description":"technician list"},"401":{"description":"unauthenticated"}},"security":[{"bearer":[]}],"tags":["Technicians"]},"post":{"operationId":"technicians_create","requestBody":{"content":{"application/json":{"schema":{"type":"object"}}},"required":true},"responses":{"201":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"technician created"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized"},"409":{"description":"conflict"},"422":{"description":"validation failed"}},"security":[{"bearer":[]}],"tags":["Technicians"]}},"/technicians/{id}":{"get":{"operationId":"technicians_show","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"technician"},"401":{"description":"unauthenticated"},"404":{"description":"not found"}},"security":[{"bearer":[]}],"tags":["Technicians"]},"patch":{"operationId":"technicians_update","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"technician updated"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized"},"404":{"description":"not found"},"409":{"description":"conflict"},"422":{"description":"validation failed"}},"security":[{"bearer":[]}],"tags":["Technicians"]}},"/technicians/{id}/user":{"put":{"operationId":"technicians_link_user","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LinkUserBody"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"technician with its linked user"},"401":{"description":"unauthenticated"},"403":{"description":"needs users.manage"},"404":{"description":"technician not found"},"409":{"description":"user already linked to another technician"},"422":{"description":"user not found in this account, or disabled"}},"security":[{"bearer":[]}],"tags":["Technicians"]}},"/terms":{"delete":{"operationId":"terms_delete","parameters":[{"description":"the terms code to delete","in":"query","name":"code","required":true,"schema":{"type":"string"}},{"description":"the location; default: the user's own","in":"query","name":"location_id","required":false,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"`{ code, deleted: true }`"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs settings.manage)"},"404":{"description":"no such code"},"422":{"description":"terms_in_use: a customer, an open order or an unpaid invoice uses the code"}},"security":[{"bearer":[]}],"tags":["Workflow Config"]},"get":{"operationId":"terms_index","parameters":[{"description":"the location; default: the user's own","in":"query","name":"location_id","required":false,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"items":{"type":"object"},"type":"array"}}},"description":"the payment-terms rows in code order: code, description, due_days, due_day_of_month, discount_bp, discount_days, finance_company (true, false or null), cash"},"401":{"description":"unauthenticated"}},"security":[{"bearer":[]}],"tags":["Workflow Config"]},"put":{"operationId":"terms_upsert","parameters":[{"description":"the location; default: the user's own","in":"query","name":"location_id","required":false,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"properties":{"code":{"default":"","description":"One or two characters; stored upper-cased","type":"string"},"description":{"default":"","description":"At most 15 characters; case kept","type":"string"},"discount_bp":{"default":0,"description":"Discount in basis points, 0-9999 (2.00 % = 200)","format":"int64","type":"integer"},"discount_days":{"default":0,"description":"Days the discount is valid, 0-999","format":"int64","type":"integer"},"due_day_of_month":{"default":0,"description":"Day of the following month, 0-31 (0 = not used)","format":"int64","type":"integer"},"due_days":{"default":0,"description":"Days after the invoice date, 0-99","format":"int64","type":"integer"},"finance_company":{"default":null,"description":"true = yes, false = no, null = blank","type":["boolean","null"]},"location_id":{"default":null,"description":"The location whose table is edited; default: the user's own","format":"int64","type":["integer","null"]}},"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the stored row plus `created`"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs settings.manage)"},"422":{"description":"validation_failed: code, description, due_days, due_day_of_month, discount_bp, discount_days"}},"security":[{"bearer":[]}],"tags":["Workflow Config"]}},"/time_cards":{"get":{"operationId":"time_cards_index","parameters":[{"description":"one employee's cards","in":"query","name":"employee_id","required":false,"schema":{"format":"int64","type":"integer"}},{"description":"true: unpaid cards only; false: paid only","in":"query","name":"open","required":false,"schema":{"type":"boolean"}},{"description":"first work date, YYYY-MM-DD","in":"query","name":"from","required":false,"schema":{"type":"string"}},{"description":"last work date, YYYY-MM-DD","in":"query","name":"to","required":false,"schema":{"type":"string"}},{"description":"1-100, default 50","in":"query","name":"limit","required":false,"schema":{"format":"int64","type":"integer"}},{"description":"rows to skip","in":"query","name":"offset","required":false,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"`{data, total, next_offset, amount_total_cents, regular_total_hundredths, ot1_total_hundredths, ot2_total_hundredths}`: the totals cover every card the filter selects; `amount_cents` and `amount_total_cents` are null without payroll.manage"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs payroll.view)"},"422":{"description":"validation_failed: from, to"}},"security":[{"bearer":[]}],"tags":["Payroll"]},"post":{"operationId":"time_cards_create","requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"department_id":{"default":null,"description":"The department; absent = the employee's","format":"int64","type":["integer","null"]},"employee_id":{"default":0,"description":"The employee","format":"int64","type":"integer"},"flat":{"default":false,"description":"Flat-rate hours: no overtime","type":"boolean"},"notes":{"default":"","description":"At most 120 characters","type":"string"},"ot1_hundredths":{"default":0,"description":"Overtime-1 hours in hundredths, paid at the employee's OT1 multiplier","format":"int64","type":"integer"},"ot2_hundredths":{"default":0,"description":"Overtime-2 hours in hundredths, paid at the employee's OT2 multiplier","format":"int64","type":"integer"},"rate_cents":{"default":null,"description":"The rate in cents an hour; absent = the employee's hourly rate (flat cards: flat rate)","format":"int64","type":["integer","null"]},"regular_hundredths":{"default":0,"description":"Regular hours in hundredths (8.50 h = 850)","format":"int64","type":"integer"},"time_off_kind":{"default":null,"description":"Leave taken instead of work: sick, personal or vacation. Regular hours only. Paid\nleave (a paid grant) pays at the rate; unpaid leave and vacation pay nothing","type":["string","null"]},"work_class_id":{"default":null,"description":"The work class","format":"int64","type":["integer","null"]},"work_date":{"default":"","description":"The day worked, YYYY-MM-DD","type":"string"},"work_order_id":{"default":null,"description":"The work order the hours were worked on","format":"int64","type":["integer","null"]}},"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the new card, with the server's rate and amount"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs payroll.manage)"},"422":{"description":"validation_failed: employee_id, work_date, hours, rate_cents, notes; idempotency_key_reused"}},"security":[{"bearer":[]}],"tags":["Payroll"]}},"/time_cards/copy_standard":{"post":{"operationId":"time_cards_copy_standard","requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"work_date":{"default":"","description":"The date every copied card carries (FoxPro: the pay period ending date), YYYY-MM-DD","type":"string"}},"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"`{created, cards}`: one card per standard card, dated `work_date`"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs payroll.manage)"},"409":{"description":"conflict: these standard cards were already copied for this date"},"422":{"description":"validation_failed: work_date"}},"security":[{"bearer":[]}],"tags":["Payroll"]}},"/time_cards/import_flagged":{"post":{"operationId":"time_cards_import_flagged","requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"from":{"default":"","description":"First invoice date, YYYY-MM-DD","type":"string"},"to":{"default":"","description":"Last invoice date, YYYY-MM-DD","type":"string"}},"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"`{created, hours_hundredths, cards, skipped}`: flat-rate cards from the flagged labour hours of posted invoices"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs payroll.manage)"},"422":{"description":"validation_failed: from, to"}},"security":[{"bearer":[]}],"tags":["Payroll"]}},"/time_cards/{id}":{"delete":{"operationId":"time_cards_delete","parameters":[{"description":"time card id","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"`{id, deleted}`"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs payroll.manage)"},"404":{"description":"no such card"},"409":{"description":"conflict: this time card is paid"}},"security":[{"bearer":[]}],"tags":["Payroll"]},"get":{"operationId":"time_cards_show","parameters":[{"description":"time card id","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the card; `rate_cents` and `amount_cents` null without payroll.manage"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs payroll.view)"},"404":{"description":"no such card"}},"security":[{"bearer":[]}],"tags":["Payroll"]},"patch":{"operationId":"time_cards_update","parameters":[{"description":"time card id","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"department_id":{"default":null,"format":"int64","type":["integer","null"]},"notes":{"default":null,"type":["string","null"]},"ot1_hundredths":{"default":null,"format":"int64","type":["integer","null"]},"ot2_hundredths":{"default":null,"format":"int64","type":["integer","null"]},"rate_cents":{"default":null,"format":"int64","type":["integer","null"]},"regular_hundredths":{"default":null,"format":"int64","type":["integer","null"]},"work_class_id":{"default":null,"format":"int64","type":["integer","null"]},"work_date":{"default":null,"type":["string","null"]},"work_order_id":{"default":null,"description":"The work order the hours were worked on; manual cards only (a flagged card's comes\nfrom its invoice)","format":"int64","type":["integer","null"]}},"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the card, with the recomputed amount"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs payroll.manage)"},"404":{"description":"no such card"},"409":{"description":"conflict: this time card is paid"},"422":{"description":"validation_failed: work_date, hours, rate_cents, notes"}},"security":[{"bearer":[]}],"tags":["Payroll"]}},"/tire_sets":{"get":{"operationId":"tires_index","parameters":[{"description":"a vehicle's sets","in":"query","name":"vehicle_id","required":false,"schema":{"format":"int64","type":"integer"}},{"description":"a customer's sets","in":"query","name":"customer_id","required":false,"schema":{"format":"int64","type":"integer"}},{"description":"mounted, stored, with_customer or disposed","in":"query","name":"state","required":false,"schema":{"type":"string"}},{"description":"summer, winter or all_season","in":"query","name":"season","required":false,"schema":{"type":"string"}},{"description":"sets stored at this location","in":"query","name":"location_id","required":false,"schema":{"format":"int64","type":"integer"}},{"description":"1-100, default 50","in":"query","name":"limit","required":false,"schema":{"format":"int64","type":"integer"}},{"description":"rows to skip","in":"query","name":"offset","required":false,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"`{data, total, next_offset}`"},"401":{"description":"unauthenticated"},"422":{"description":"validation_failed: state, season, vehicle_id, customer_id, location_id, limit, offset"}},"security":[{"bearer":[]}],"tags":["Tires"]}},"/tire_sets/{id}":{"get":{"operationId":"tire_sets_show","parameters":[{"description":"tire set id","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the set with its tires and its newest 100 events"},"401":{"description":"unauthenticated"},"404":{"description":"no such set"}},"security":[{"bearer":[]}],"tags":["Tires"]},"patch":{"operationId":"tire_sets_update","parameters":[{"description":"tire set id","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"properties":{"description":{"default":null,"description":"\"\" clears; absent = unchanged","type":["string","null"]},"notes":{"default":null,"description":"\"\" clears; absent = unchanged","type":["string","null"]},"on_rims":{"default":null,"type":["boolean","null"]},"season":{"default":null,"description":"summer, winter or all_season; absent = unchanged","type":["string","null"]},"vehicle_id":{"default":null,"description":"Moves the set to another vehicle (sold with the car); refused while mounted","format":"int64","type":["integer","null"]}},"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the set after the change"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs work_orders.write or customers.write)"},"404":{"description":"no such set"},"409":{"description":"invalid_transition: another set is mounted"},"422":{"description":"validation_failed: season, vehicle_id"}},"security":[{"bearer":[]}],"tags":["Tires"]}},"/tire_sets/{id}/attachments":{"get":{"operationId":"tire_set_attachment_index","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the set's photos, newest first"},"401":{"description":"unauthenticated"},"404":{"description":"tire set not found"}},"security":[{"bearer":[]}],"tags":["Attachments"]},"post":{"operationId":"tire_set_attachment_create","parameters":[{"description":"replays the first stage with this key","in":"header","name":"idempotency-key","required":false,"schema":{"type":["string","null"]}},{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateAttachmentBody"}}},"required":true},"responses":{"200":{"description":"replayed"},"201":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"a photo of the set staged: {attachment, upload}, as for a work order"},"401":{"description":"unauthenticated"},"403":{"description":"needs work_orders.write or customers.write"},"404":{"description":"tire set not found"},"422":{"description":"invalid request"}},"security":[{"bearer":[]}],"tags":["Attachments"]}},"/tire_sets/{id}/dispose":{"post":{"operationId":"tire_sets_dispose","parameters":[{"description":"tire set id","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"properties":{"note":{"default":null,"description":"Why, e.g. \"worn out\" (at most 200 characters)","type":["string","null"]}},"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the disposed set"},"401":{"description":"unauthenticated"},"403":{"description":"needs work_orders.write or customers.write"},"404":{"description":"no such set"},"409":{"description":"invalid_transition: already disposed"},"422":{"description":"validation_failed: note"}},"security":[{"bearer":[]}],"tags":["Tires"]}},"/tire_sets/{id}/move":{"post":{"operationId":"tire_sets_move","parameters":[{"description":"tire set id","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"properties":{"note":{"default":null,"description":"At most 200 characters","type":["string","null"]},"odometer":{"default":null,"description":"The odometer at the move, when known","format":"int64","type":["integer","null"]},"slot_id":{"default":null,"description":"The slot to store it in; required when `to` is stored","format":"int64","type":["integer","null"]},"to":{"default":"","description":"mounted, stored or with_customer (\"disposed\" is tire_sets.dispose)","type":"string"},"work_order_id":{"default":null,"description":"The work order the move happened on (stamped on every event)","format":"int64","type":["integer","null"]}},"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the set after the move"},"401":{"description":"unauthenticated"},"403":{"description":"needs work_orders.write or customers.write"},"404":{"description":"no such set"},"409":{"description":"invalid_transition: the set is disposed"},"422":{"description":"validation_failed: to, slot_id, work_order_id"}},"security":[{"bearer":[]}],"tags":["Tires"]}},"/tire_sets/{id}/tag":{"get":{"operationId":"tire_sets_tag","parameters":[{"description":"tire set id","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"the 4 x 6 inch storage tag"},"401":{"description":"unauthenticated"},"404":{"description":"no such set"}},"security":[{"bearer":[]}],"tags":["Tires"]}},"/tire_sets/{id}/tires":{"post":{"operationId":"tires_add","parameters":[{"description":"tire set id","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the set with the added tire"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs work_orders.write or customers.write)"},"404":{"description":"no such set"},"409":{"description":"invalid_transition: the set is disposed"},"422":{"description":"validation_failed: position, size, dot_code; idempotency_key_reused"}},"security":[{"bearer":[]}],"tags":["Tires"]}},"/tire_sets/{id}/tread":{"post":{"operationId":"tires_record_tread","parameters":[{"description":"tire set id","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"properties":{"inspection_id":{"default":null,"description":"An inspection of that work order: each reading is noted on its wheel's item and rates it\nwhen nobody rated it yet","format":"int64","type":["integer","null"]},"readings":{"default":[],"items":{"properties":{"position":{"default":"","description":"lf, rf, lr, rr or spare","type":"string"},"pressure_kpa":{"default":null,"description":"Pressure in kPa (0 to 1000); optional","format":"int64","type":["integer","null"]},"tread_mm_hundredths":{"default":0,"description":"Tread depth in hundredths of a millimetre: 6.5 mm = 650 (0 to 2000)","format":"int64","type":"integer"}},"type":"object"},"type":"array"},"season":{"default":null,"description":"The season of the set made when the vehicle has none mounted (default all_season)","type":["string","null"]},"vehicle_id":{"default":null,"description":"The vehicle, when no set is named","format":"int64","type":["integer","null"]},"work_order_id":{"default":null,"description":"The work order the readings were taken on","format":"int64","type":["integer","null"]}},"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the set with its readings recorded"},"401":{"description":"unauthenticated"},"403":{"description":"needs work_orders.write or customers.write"},"404":{"description":"no such set"},"409":{"description":"invalid_transition: the set is disposed"},"422":{"description":"validation_failed: readings, position, tread_mm_hundredths, pressure_kpa"}},"security":[{"bearer":[]}],"tags":["Tires"]}},"/tire_storage_slots":{"get":{"operationId":"tire_storage_slots_index","parameters":[{"description":"the location; default: the user's own","in":"query","name":"location_id","required":false,"schema":{"format":"int64","type":"integer"}},{"description":"true: only slots with room","in":"query","name":"free","required":false,"schema":{"type":"boolean"}},{"description":"true: include retired slots","in":"query","name":"include_retired","required":false,"schema":{"type":"boolean"}}],"responses":{"200":{"content":{"application/json":{"schema":{"items":{"type":"object"},"type":"array"}}},"description":"the slots by label, each with its sets"},"401":{"description":"unauthenticated"},"403":{"description":"another location's slots"},"422":{"description":"validation_failed: location_id, free, include_retired"}},"security":[{"bearer":[]}],"tags":["Tires"]},"post":{"operationId":"tire_storage_slots_create","requestBody":{"content":{"application/json":{"schema":{"properties":{"capacity":{"default":null,"description":"How many sets it holds (1 to 20, default 1)","format":"int64","type":["integer","null"]},"label":{"default":"","description":"e.g. A-3-2 (at most 20 characters, stored upper-case)","type":"string"},"location_id":{"default":null,"description":"The location whose storage this is; default: the user's own, else the first location","format":"int64","type":["integer","null"]},"notes":{"default":null,"description":"At most 200 characters","type":["string","null"]}},"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the new slot"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs settings.manage)"},"404":{"description":"no such location"},"422":{"description":"validation_failed: label, capacity, notes; idempotency_key_reused"}},"security":[{"bearer":[]}],"tags":["Tires"]}},"/tire_storage_slots/{id}":{"patch":{"operationId":"tire_storage_slots_update","parameters":[{"description":"slot id","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"properties":{"active":{"default":null,"description":"false retires the slot; refused while it holds a set","type":["boolean","null"]},"capacity":{"default":null,"description":"1 to 20; not below the sets stored there now","format":"int64","type":["integer","null"]},"label":{"default":null,"description":"At most 20 characters; stored upper-case","type":["string","null"]},"notes":{"default":null,"description":"\"\" clears; absent = unchanged","type":["string","null"]}},"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the slot after the change"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs settings.manage)"},"404":{"description":"no such slot"},"422":{"description":"validation_failed: label, capacity, active"}},"security":[{"bearer":[]}],"tags":["Tires"]}},"/tires/storage_due":{"get":{"operationId":"tires_storage_due","parameters":[{"description":"summer or winter; default: the season whose window is open","in":"query","name":"season","required":false,"schema":{"type":"string"}},{"description":"sets stored at this location; default: the user's own","in":"query","name":"location_id","required":false,"schema":{"format":"int64","type":"integer"}},{"description":"1-100, default 50","in":"query","name":"limit","required":false,"schema":{"format":"int64","type":"integer"}},{"description":"rows to skip","in":"query","name":"offset","required":false,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"`{season, window_from, window_until, data, total, next_offset}`"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs customers.read)"},"422":{"description":"validation_failed: season, location_id, limit, offset"}},"security":[{"bearer":[]}],"tags":["Tires"]}},"/tires/{id}":{"patch":{"operationId":"tires_update","parameters":[{"description":"tire id","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"properties":{"brand":{"default":null,"type":["string","null"]},"dot_code":{"default":null,"type":["string","null"]},"load_index":{"default":null,"format":"int64","type":["integer","null"]},"model":{"default":null,"type":["string","null"]},"position":{"default":null,"description":"Absent fields are unchanged; \"\" clears a text field","type":["string","null"]},"purchased_on":{"default":null,"type":["string","null"]},"retired":{"default":false,"description":"true: the tire is off the set for good (worn out, replaced)","type":"boolean"},"run_flat":{"default":null,"description":"true: a run-flat tire (it takes longer to mount and repair)","type":["boolean","null"]},"size":{"default":null,"type":["string","null"]},"speed_rating":{"default":null,"type":["string","null"]}},"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the set with the changed tire"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs work_orders.write or customers.write)"},"404":{"description":"no such tire"},"422":{"description":"validation_failed: position, size, dot_code"}},"security":[{"bearer":[]}],"tags":["Tires"]}},"/today":{"get":{"operationId":"today","parameters":[{"description":"location to report on; a scoped user's own location always wins","in":"query","name":"location_id","required":false,"schema":{"format":"int64","type":"integer"}},{"description":"orders listed per group; default 5, at most 500","in":"query","name":"limit","required":false,"schema":{"format":"int64","type":"integer"}},{"description":"only this technician's work: their open services and lines, or WOs they took","in":"query","name":"technician_id","required":false,"schema":{"format":"int64","type":"integer"}},{"description":"only the caller's work (the same rule)","in":"query","name":"mine","required":false,"schema":{"type":"boolean"}},{"description":"only WOs nobody is on","in":"query","name":"unassigned","required":false,"schema":{"type":"boolean"}},{"description":"how `groups` is partitioned (plan 3378): `waits_on` (default, today's groups), `technician` (one `tech:<id>` group per technician, `tech:none` last), `bay` (one `bay:<text>` group per vehicle location, `bay:none` last), `none` (one `all` group)","in":"query","name":"group","required":false,"schema":{"type":"string"}},{"description":"rows inside each group: default (each group's own order), newest, oldest, activity (latest first) or promised (soonest first)","in":"query","name":"order","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the shop's local `date` and `time_zone`, `location` (null = every location), and `stages` (`estimates`, `in_progress`, `completed`), each with `count` and the oldest few `orders` (`id`, `number`, `customer_name`, `vehicle`, `opened_on`, `age_days`, `total_cents`), and `groups` (`coming_in` when booked, `here_not_started`, `waiting_on_customer`, `waiting_on_parts`, `in_bay`, `ready_to_post`), the same row shape, every open WO in exactly one; with `group` the same rows partitioned by technician, bay or into one group; sell totals only"},"401":{"description":"unauthenticated"},"404":{"description":"location not found"},"422":{"description":"an unknown group, or more than one of mine/technician_id/unassigned"}},"security":[{"bearer":[]}],"tags":["Work Orders"]}},"/tools":{"get":{"operationId":"tools_list","responses":{"200":{"content":{"application/json":{"schema":{"items":{"type":"object"},"type":"array"}}},"description":"every registry tool: name, description, params_schema, read_only, effect, confirm"},"401":{"description":"unauthenticated"}},"security":[{"bearer":[]}],"tags":["Tools"]}},"/tools/{name}":{"post":{"operationId":"tools_call","parameters":[{"in":"path","name":"name","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"OperationResult {status: success, data}"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized, or a read-only agent token on a write tool"},"404":{"description":"unknown tool or record"},"409":{"description":"invalid transition"},"422":{"description":"invalid params"}},"security":[{"bearer":[]}],"tags":["Tools"]}},"/usage/llm":{"get":{"operationId":"llm_usage","parameters":[{"description":"`YYYY-MM`; omitted = this month in the shop's first location's zone.","in":"query","name":"month","required":false,"schema":{"type":["string","null"]}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the month's model calls and their cost in micro-dollars"},"401":{"description":"unauthenticated"},"403":{"description":"needs settings.manage"},"422":{"description":"validation_failed: month is not YYYY-MM"}},"security":[{"bearer":[]}],"summary":"`GET /usage/llm?month=YYYY-MM` (plan 1487): the month's model calls, their tokens and their\ncost, by feature, model and day. `settings.manage`.","tags":["Billing"]}},"/vehicle_catalog/makes":{"get":{"operationId":"vehicle_catalog_makes","parameters":[{"description":"a model year (four digits)","in":"query","name":"year","required":false,"schema":{"format":"int32","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the catalog's makes, popular first: {makes: [{id, name}]}"},"401":{"description":"unauthenticated"},"503":{"description":"vehicle data is off or Wenmar Open did not answer"}},"security":[{"bearer":[]}],"tags":["Vehicles"]}},"/vehicle_catalog/models":{"get":{"operationId":"vehicle_catalog_models","parameters":[{"description":"a make as typed (\"Honda\", \"honda\", \"mercedes-benz\")","in":"query","name":"make","required":false,"schema":{"type":"string"}},{"description":"a model year (four digits)","in":"query","name":"year","required":false,"schema":{"format":"int32","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the make's Open id and its models: {make, models: [{id, name}]}"},"401":{"description":"unauthenticated"},"503":{"description":"vehicle data is off or Wenmar Open did not answer"}},"security":[{"bearer":[]}],"tags":["Vehicles"]}},"/vehicle_catalog/trims":{"get":{"operationId":"vehicle_catalog_trims","parameters":[{"description":"a make as typed (\"Honda\", \"honda\", \"mercedes-benz\")","in":"query","name":"make","required":false,"schema":{"type":"string"}},{"description":"a model as typed","in":"query","name":"model","required":false,"schema":{"type":"string"}},{"description":"a model year (four digits); the trims are per model year","in":"query","name":"year","required":false,"schema":{"format":"int32","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the make's and model's Open ids and the model's trims: {make, model, trims: [{id, name}]}"},"401":{"description":"unauthenticated"},"503":{"description":"vehicle data is off or Wenmar Open did not answer"}},"security":[{"bearer":[]}],"tags":["Vehicles"]}},"/vehicles":{"get":{"operationId":"vehicles_index","parameters":[{"description":"licence plate, exact, case-insensitive: one row per vehicle with that plate (FoxPro SESCAN licence list). Sent alone, except for `near`; the other filters are not combined with it","in":"query","name":"license","required":false,"schema":{"type":"string"}},{"description":"with `license`: the vehicles whose plate is one edit away from it (a typed wrong letter, a missing or extra one, or two adjacent letters swapped), for a licence search that found nothing; at most ten, in id order, live vehicles of live customers","in":"query","name":"near","required":false,"schema":{"type":"string"}},{"description":"vehicle ID#, whole value, case-insensitive: one row per vehicle with that ID# (FoxPro SERINQS ID# search). Sent alone","in":"query","name":"id_number","required":false,"schema":{"type":"string"}},{"description":"only that customer's vehicles","in":"query","name":"customer_id","required":false,"schema":{"format":"int64","type":"integer"}},{"description":"only these vehicle types; a comma list is any of them","in":"query","name":"vehicle_type","required":false,"schema":{"type":"string"}},{"description":"only these statuses (`active`, `inactive`, `trashed`); a comma list is any of them. Without it, the trashed rows are hidden","in":"query","name":"status","required":false,"schema":{"type":"string"}},{"description":"search: year make model, VIN, plate, or owner name (substring, case-insensitive)","in":"query","name":"q","required":false,"schema":{"type":"string"}},{"description":"plain list only. `id_number` with customer_id: that customer's vehicles in ID# order, blank first (FoxPro vehicle list). `vehicle`: year make model A–Z. `vin`: VIN. `plate`: licence plate. `number`: vehicle ID#","in":"query","name":"sort","required":false,"schema":{"type":"string"}},{"description":"`asc` (default) or `desc`; the direction of `sort` (plain list only)","in":"query","name":"dir","required":false,"schema":{"type":"string"}},{"description":"page, 1-based","in":"query","name":"page","required":false,"schema":{"format":"int64","type":"integer"}},{"description":"rows per page, 1-100 (default 50)","in":"query","name":"per_page","required":false,"schema":{"format":"int64","type":"integer"}},{"description":"rows updated after this RFC 3339 timestamp","in":"query","name":"updated_since","required":false,"schema":{"type":"string"}},{"description":"keyset paging: rows with id greater than this, in id order (plain list only)","in":"query","name":"after","required":false,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"items":{"type":"object"},"type":"array"}}},"description":"vehicle list"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden"},"422":{"description":"sort without customer_id, an unknown sort, an invalid dir, or `after` on a non-plain list"}},"security":[{"bearer":[]}],"tags":["Vehicles"]},"post":{"operationId":"vehicles_create","parameters":[{"description":"`1`: only the checks of before plan 1309, no `warnings` (the FoxPro view)","in":"query","name":"legacy_validation","required":false,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{}}},"required":true},"responses":{"201":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"vehicle created"},"401":{"description":"unauthenticated"},"422":{"description":"validation failed"}},"security":[{"bearer":[]}],"tags":["Vehicles"]}},"/vehicles/by_public_id/{public_id}":{"get":{"operationId":"vehicles_show_by_public_id","parameters":[{"description":"The ULID the client made for the record","in":"path","name":"public_id","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the vehicle, as GET /vehicles/{id}"},"401":{"description":"unauthenticated"},"404":{"description":"no vehicle you can see has this public id"}},"security":[{"bearer":[]}],"tags":["Vehicles"]}},"/vehicles/{id}":{"delete":{"operationId":"vehicles_delete","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"204":{"description":"vehicle trashed"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden"},"404":{"description":"not found"}},"security":[{"bearer":[]}],"tags":["Vehicles"]},"get":{"operationId":"vehicles_show","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"vehicle"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden"},"404":{"description":"not found"}},"security":[{"bearer":[]}],"tags":["Vehicles"]},"patch":{"operationId":"vehicles_update","parameters":[{"description":"ETag from the last read (plan 105)","in":"header","name":"If-Match","required":false,"schema":{"type":["string","null"]}},{"description":"`1`: only the checks of before plan 1309, no `warnings` (the FoxPro view)","in":"query","name":"legacy_validation","required":false,"schema":{"type":"string"}},{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"vehicle updated"},"401":{"description":"unauthenticated"},"404":{"description":"not found"},"412":{"description":"record changed since If-Match; body.current is the record now"},"422":{"description":"validation failed"}},"security":[{"bearer":[]}],"tags":["Vehicles"]}},"/vehicles/{id}/duplicates":{"get":{"operationId":"vehicles_duplicates","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"possible duplicates: {data: [{id, name, reasons}], total}"},"401":{"description":"unauthenticated"},"403":{"description":"needs customers.read"},"404":{"description":"vehicle not found"}},"security":[{"bearer":[]}],"tags":["Vehicles"]}},"/vehicles/{id}/fitting_parts":{"get":{"operationId":"vehicle_fitting_parts","parameters":[{"description":"the vehicle","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}},{"description":"only parts of this type","in":"query","name":"part_type","required":false,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"items":{"type":"object"},"type":"array"}}},"description":"`{data: [rows]}`: `{part: {id, number, name}, fit, on_hand, bin, price_cents, on_open_wo}`; in-stock first, then part type and number"},"401":{"description":"unauthenticated"},"404":{"description":"no such vehicle"}},"security":[{"bearer":[]}],"tags":["Vehicles"]}},"/vehicles/{id}/history":{"get":{"operationId":"vehicles_history","parameters":[{"description":"`newest` (default) or `oldest` (the FoxPro order)","in":"query","name":"order","required":false,"schema":{"type":"string"}},{"description":"page, 1-based","in":"query","name":"page","required":false,"schema":{"format":"int64","type":"integer"}},{"description":"rows per page, 1-100 (default 50)","in":"query","name":"per_page","required":false,"schema":{"format":"int64","type":"integer"}},{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"items":{"type":"object"},"type":"array"}}},"description":"the vehicle's posted invoices"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden"},"404":{"description":"not found"}},"security":[{"bearer":[]}],"tags":["Vehicles"]}},"/vehicles/{id}/labor_estimates":{"get":{"operationId":"vehicles_labor_estimates","parameters":[{"description":"vehicle id","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}},{"description":"a Wenmar Open job id or the job in words","in":"query","name":"job","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"labour estimates in hundredths of an hour; available=false when the data is not on the server"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized"},"404":{"description":"not found"},"503":{"description":"vehicle data is off or Wenmar Open did not answer"}},"security":[{"bearer":[]}],"tags":["Vehicles"]}},"/vehicles/{id}/labour_jobs":{"get":{"operationId":"vehicles_labour_jobs","parameters":[{"description":"vehicle id","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}},{"description":"the words a person typed; they rank every job","in":"query","name":"q","required":false,"schema":{"type":"string"}},{"description":"a category id (brakes, …) or quick","in":"query","name":"category","required":false,"schema":{"type":"string"}},{"description":"an order: its labour codes matching q come back too","in":"query","name":"work_order_id","required":false,"schema":{"format":"int64","type":"integer"}},{"description":"the location whose \"adjust Wenmar's figures\" setting decides whether the estimate for this shop is offered; absent offers it","in":"query","name":"location_id","required":false,"schema":{"format":"int64","type":"integer"}},{"description":"the rim (19) or a tire size (225/65R17): prices the tire jobs for it","in":"query","name":"tire_size","required":false,"schema":{"type":"string"}},{"description":"the rear rim or size of a staggered set","in":"query","name":"rear_tire_size","required":false,"schema":{"type":"string"}},{"description":"how many tires or wheels, 1 to 6","in":"query","name":"tires","required":false,"schema":{"format":"int64","type":"integer"}},{"description":"true: run-flat tires","in":"query","name":"run_flat","required":false,"schema":{"type":"boolean"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"{vehicle_id, categories, codes, jobs}: the jobs that match, best first, each with the hours a line gets here (quote_hundredths, hundredths of an hour) and where they come from"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized"},"404":{"description":"not found"},"422":{"description":"validation_failed: category (an unknown one)"}},"security":[{"bearer":[]}],"tags":["Vehicles"]}},"/vehicles/{id}/labour_times":{"get":{"operationId":"vehicles_labour_times","parameters":[{"description":"vehicle id","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}},{"description":"a Wenmar Open job id or the job in words","in":"query","name":"job","required":false,"schema":{"type":"string"}},{"description":"one of the shop's labour codes","in":"query","name":"labor_code","required":false,"schema":{"type":"string"}},{"description":"a labour operation id","in":"query","name":"labour_operation_id","required":false,"schema":{"format":"int64","type":"integer"}},{"description":"the location whose \"adjust Wenmar's figures\" setting decides whether the estimate for this shop is offered; absent offers it","in":"query","name":"location_id","required":false,"schema":{"format":"int64","type":"integer"}},{"description":"the rim (19) or a tire size (225/65R17): prices the tire jobs for it","in":"query","name":"tire_size","required":false,"schema":{"type":"string"}},{"description":"the rear rim or size of a staggered set","in":"query","name":"rear_tire_size","required":false,"schema":{"type":"string"}},{"description":"how many tires or wheels, 1 to 6","in":"query","name":"tires","required":false,"schema":{"format":"int64","type":"integer"}},{"description":"true: run-flat tires","in":"query","name":"run_flat","required":false,"schema":{"type":"boolean"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"labour times best first, each with basis, source, confidence and `use` (the line fields that pick it); hours in hundredths"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized"},"404":{"description":"not found"}},"security":[{"bearer":[]}],"tags":["Vehicles"]}},"/vehicles/{id}/labour_times/generate":{"post":{"operationId":"vehicles_labour_times_generate","parameters":[{"description":"vehicle id","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"{job?, labor_code?, labour_operation_id?}","required":true},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"{time, cached}: the AI labour time (an estimate), kept so the same job on the same vehicle is asked once"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized, or ai_data_sharing_off"},"422":{"description":"validation_failed: job (no_operation), vehicle_id (unknown_vehicle)"},"503":{"description":"the AI model is not available, or its answer did not make sense"}},"security":[{"bearer":[]}],"tags":["Vehicles"]}},"/vehicles/{id}/labour_times/shop":{"post":{"operationId":"vehicles_labour_times_set_shop","parameters":[{"description":"vehicle id","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"{labor_code? | open_job_id? | labour_operation_id?, scope?, typical_hundredths, low_hundredths?, high_hundredths?, notes?}","required":true},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the shop's new labour time for this vehicle (the earlier one is superseded)"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized (catalog.write)"},"422":{"description":"validation_failed: labor_code, open_job_id, scope, typical_hundredths"}},"security":[{"bearer":[]}],"tags":["Vehicles"]}},"/vehicles/{id}/merge":{"post":{"operationId":"vehicles_merge","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"properties":{"into_id":{"description":"The record to keep","format":"int64","type":"integer"}},"required":["into_id"],"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"{from_id, into_id, moved, left}: rows moved and rows a unique index kept on the trashed vehicle"},"401":{"description":"unauthenticated"},"403":{"description":"needs records.merge and customers.write"},"422":{"description":"same vehicle, unknown or trashed vehicle, or a vehicle of another customer"}},"security":[{"bearer":[]}],"tags":["Vehicles"]}},"/vehicles/{id}/ownerships":{"get":{"operationId":"vehicles_ownerships","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the vehicle's owners, current first: {vehicle_id, ownerships: [{id, customer_id, customer_name, from_on, to_on, source, note}]}"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden"},"404":{"description":"vehicle not found"}},"security":[{"bearer":[]}],"tags":["Vehicles"]}},"/vehicles/{id}/recalls":{"get":{"operationId":"vehicles_recalls","parameters":[{"description":"vehicle id","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}},{"description":"also list manufacturer bulletins (default true)","in":"query","name":"bulletins","required":false,"schema":{"type":"boolean"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"recalls that may apply to the vehicle's model year, and bulletins"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized"},"404":{"description":"not found"},"503":{"description":"vehicle data is off or Wenmar Open did not answer"}},"security":[{"bearer":[]}],"tags":["Vehicles"]}},"/vehicles/{id}/recommendations":{"get":{"operationId":"vehicles_recommendations","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"items":{"type":"object"},"type":"array"}}},"description":"the vehicle's open recommendations, newest first"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden"}},"security":[{"bearer":[]}],"tags":["Vehicles"]}},"/vehicles/{id}/reminders":{"get":{"operationId":"vehicle_reminders_index","parameters":[{"description":"the vehicle","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"{vehicle_id, distance_unit, km_per_day, km_per_day_is_default, reminders: [...]}: the maker's and the shop's reminders with state and estimated due"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized"},"404":{"description":"no such vehicle"}},"security":[{"bearer":[]}],"tags":["Vehicles"]}},"/vehicles/{id}/reminders/{source}/{key}":{"patch":{"operationId":"vehicle_reminders_update","parameters":[{"description":"the vehicle","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}},{"description":"maker or shop","in":"path","name":"source","required":true,"schema":{"type":"string"}},{"description":"the reminder key","in":"path","name":"key","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"disabled":{"default":null,"description":"true turns the reminder off for this vehicle","type":["boolean","null"]},"every_km":{"default":null,"description":"The interval in kilometres; 0 = no distance interval","format":"int64","type":["integer","null"]},"every_months":{"default":null,"description":"The interval in months (maker only)","format":"int64","type":["integer","null"]}},"required":[],"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the reminder with the override applied"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized"},"404":{"description":"no such vehicle or reminder"},"422":{"description":"validation_failed: source, key, every_km, every_months"}},"security":[{"bearer":[]}],"tags":["Vehicles"]}},"/vehicles/{id}/restore":{"post":{"operationId":"vehicles_restore","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"vehicle restored"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden"},"404":{"description":"not found"}},"security":[{"bearer":[]}],"tags":["Vehicles"]}},"/vehicles/{id}/specs":{"get":{"operationId":"vehicles_specs","parameters":[{"description":"vehicle id","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"what Wenmar Open holds for the vehicle: decoded detail, powertrains, oil grades, fluids, tires, fuel use, owners' complaints, safety ratings, bulletins and generation; available=false when Open did not answer"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized"},"404":{"description":"not found"},"503":{"description":"vehicle data is off on this server"}},"security":[{"bearer":[]}],"tags":["Vehicles"]}},"/vehicles/{id}/tire_sets":{"get":{"operationId":"tires_vehicle_sets","parameters":[{"description":"vehicle id","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"items":{"type":"object"},"type":"array"}}},"description":"the vehicle's tire sets, each with its tires"},"401":{"description":"unauthenticated"}},"security":[{"bearer":[]}],"tags":["Tires"]},"post":{"operationId":"tires_create_set","parameters":[{"description":"vehicle id","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"properties":{"description":{"default":null,"description":"e.g. \"Michelin X-Ice on steel rims\"; at most 120 characters","type":["string","null"]},"notes":{"default":null,"description":"At most 500 characters","type":["string","null"]},"on_rims":{"default":false,"description":"On their own rims","type":"boolean"},"season":{"default":"","description":"summer, winter or all_season","type":"string"},"state":{"default":null,"description":"mounted (default, takes the place of nothing: refused when another set is mounted) or\nwith_customer; store a set with tire_sets.move","type":["string","null"]},"tires":{"default":[],"description":"The tires, one per position; may be empty and added later","items":{"description":"One tire as a tool or route sends it.","properties":{"brand":{"default":null,"description":"e.g. Michelin; at most 40 characters","type":["string","null"]},"dot_code":{"default":null,"description":"The DOT (TIN) code; its last four digits are the week and year it was made","type":["string","null"]},"load_index":{"default":null,"description":"The load index, e.g. 102 (50 to 150)","format":"int64","type":["integer","null"]},"model":{"default":null,"description":"e.g. X-Ice Snow; at most 60 characters","type":["string","null"]},"position":{"default":"","description":"lf, rf, lr, rr or spare","type":"string"},"purchased_on":{"default":null,"description":"When the shop sold or fitted it, YYYY-MM-DD","type":["string","null"]},"run_flat":{"default":null,"description":"true: a run-flat tire (it takes longer to mount and repair)","type":["boolean","null"]},"size":{"default":null,"description":"As on the sidewall, e.g. 225/65R17; kept as typed when it does not parse","type":["string","null"]},"speed_rating":{"default":null,"description":"The speed rating, e.g. H (one or two letters)","type":["string","null"]}},"type":"object"},"type":"array"}},"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the new set with its tires"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs work_orders.write or customers.write)"},"404":{"description":"no such vehicle"},"409":{"description":"invalid_transition: another set is mounted"},"422":{"description":"validation_failed: season, state, tires; idempotency_key_reused"}},"security":[{"bearer":[]}],"tags":["Tires"]}},"/vehicles/{id}/while_here":{"get":{"operationId":"vehicles_while_here","parameters":[{"description":"the vehicle","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"{vehicle_id, reminders: [...], declined_work: [...], recalls: {count, may_apply, note}}: the due and soon-due reminders, the declined work not yet done, and the count of recalls that may apply"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized"},"404":{"description":"no such vehicle"}},"security":[{"bearer":[]}],"tags":["Vehicles"]}},"/vehicles/{id}/work_orders":{"get":{"operationId":"vehicles_work_orders","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"items":{"type":"object"},"type":"array"}}},"description":"the vehicle's work orders"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden"}},"security":[{"bearer":[]}],"tags":["Vehicles"]}},"/vendor_returns":{"get":{"operationId":"vendor_returns_index","parameters":[{"description":"only this status (open, sent, credited, cancelled)","in":"query","name":"status","required":false,"schema":{"type":"string"}},{"description":"only this vendor's returns","in":"query","name":"vendor_id","required":false,"schema":{"format":"int64","type":"integer"}},{"description":"only this location's returns","in":"query","name":"location_id","required":false,"schema":{"format":"int64","type":"integer"}},{"description":"true: only the open statuses (open, sent)","in":"query","name":"open_only","required":false,"schema":{"type":"boolean"}},{"description":"1-100, default 50","in":"query","name":"limit","required":false,"schema":{"format":"int64","type":"integer"}},{"description":"rows to skip","in":"query","name":"offset","required":false,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"`{data, total, next_offset}`: returns newest first, each with line_count and total_cost_cents"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs costs.view)"},"422":{"description":"validation_failed: status"}},"security":[{"bearer":[]}],"tags":["Parts"]},"post":{"operationId":"vendor_returns_create","requestBody":{"content":{"application/json":{"schema":{"type":"object"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the vendor return with its lines and its total_cost_cents"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs inventory.count and costs.view)"},"404":{"description":"no such vendor, location or work order"},"409":{"description":"idempotency_key_reused"},"422":{"description":"validation_failed: vendor_id, location_id, rma_number, reason, notes, lines"}},"security":[{"bearer":[]}],"tags":["Parts"]}},"/vendor_returns/{id}":{"get":{"operationId":"vendor_returns_show","parameters":[{"description":"vendor return id","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the vendor return with its lines and its photos (`url` null until the file exists)"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs costs.view)"},"404":{"description":"no such vendor return"}},"security":[{"bearer":[]}],"tags":["Parts"]},"patch":{"operationId":"vendor_returns_update","parameters":[{"description":"vendor return id","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the vendor return with its lines and its total_cost_cents"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs inventory.count and costs.view)"},"404":{"description":"no such vendor return"},"409":{"description":"conflict: not open"},"422":{"description":"validation_failed: rma_number"}},"security":[{"bearer":[]}],"tags":["Parts"]}},"/vendor_returns/{id}/attachments":{"post":{"operationId":"vendor_return_attachment_create","parameters":[{"description":"the vendor return","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}},{"description":"replays the first stage with this key","in":"header","name":"idempotency-key","required":false,"schema":{"type":["string","null"]}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateAttachmentBody"}}},"required":true},"responses":{"200":{"description":"replayed"},"201":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"a photo of the return staged: {attachment, upload}, as for a work order"},"401":{"description":"unauthenticated"},"403":{"description":"needs inventory.count and costs.view"},"404":{"description":"no such vendor return"},"422":{"description":"invalid request"}},"security":[{"bearer":[]}],"summary":"`POST /vendor_returns/{id}/attachments` (plan 3090): stages a photo of the return (proof it\nwent back), as the vendor returns policy allows — its location in scope, `inventory.count`\nfor staging and filing.","tags":["Attachments"]}},"/vendor_returns/{id}/cancel":{"post":{"operationId":"vendor_returns_cancel","parameters":[{"description":"vendor return id","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{}}}},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the cancelled vendor return"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs inventory.count and costs.view)"},"404":{"description":"no such vendor return"},"409":{"description":"conflict: already credited or cancelled"}},"security":[{"bearer":[]}],"tags":["Parts"]}},"/vendor_returns/{id}/credit":{"post":{"operationId":"vendor_returns_record_credit","parameters":[{"description":"vendor return id","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the credited vendor return"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs inventory.count and costs.view)"},"404":{"description":"no such vendor return"},"409":{"description":"conflict: already credited or cancelled"},"422":{"description":"validation_failed: credited_on, credit_reference"}},"security":[{"bearer":[]}],"tags":["Parts"]}},"/vendor_returns/{id}/send":{"post":{"operationId":"vendor_returns_send","parameters":[{"description":"vendor return id","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the sent vendor return"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs inventory.count and costs.view)"},"404":{"description":"no such vendor return"},"409":{"description":"conflict: not open"},"422":{"description":"validation_failed: rma_number"}},"security":[{"bearer":[]}],"tags":["Parts"]}},"/vendor_terms":{"delete":{"operationId":"vendor_terms_delete","parameters":[{"description":"the vendor terms code to delete","in":"query","name":"code","required":true,"schema":{"type":"string"}},{"description":"true: a refusal carries FoxPro's message text","in":"query","name":"fox","required":false,"schema":{"type":"boolean"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"`{ code, deleted: true }`"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs catalog.write)"},"404":{"description":"no such code"},"422":{"description":"vendor_terms_in_use: a vendor has the code (details.vendors)"}},"security":[{"bearer":[]}],"tags":["Vendors"]},"get":{"operationId":"vendor_terms_index","responses":{"200":{"content":{"application/json":{"schema":{"items":{"type":"object"},"type":"array"}}},"description":"every vendor payment-terms code in code order: code, description, due_days, due_day_of_month, discount_bp, discount_days"},"401":{"description":"unauthenticated"}},"security":[{"bearer":[]}],"tags":["Vendors"]},"put":{"operationId":"vendor_terms_upsert","requestBody":{"content":{"application/json":{"schema":{"properties":{"code":{"default":"","description":"One or two characters, no blanks inside; stored trimmed, upper case","type":"string"},"description":{"default":"","description":"At most 15 characters; case kept; may be blank","type":"string"},"discount_bp":{"default":0,"description":"Prompt-payment discount in basis points, 0-9999 (2.00 % = 200)","format":"int64","type":"integer"},"discount_days":{"default":0,"description":"Days from the invoice date within which the discount applies, 0-999","format":"int64","type":"integer"},"due_day_of_month":{"default":0,"description":"Day of the month the invoice is due, 0-31 (0 = not used)","format":"int64","type":"integer"},"due_days":{"default":0,"description":"Days from the invoice date to the due date, 0-99 (0 = use due_day_of_month)","format":"int64","type":"integer"}},"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the stored row plus `created`"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs catalog.write)"},"422":{"description":"validation_failed: code, description, due_days, due_day_of_month, discount_bp, discount_days"}},"security":[{"bearer":[]}],"tags":["Vendors"]}},"/vendors":{"get":{"operationId":"vendors_index","parameters":[{"description":"exact vendor number (with exact=false: the first characters of it)","in":"query","name":"number","required":false,"schema":{"type":"string"}},{"description":"false turns number into a prefix search (default true)","in":"query","name":"exact","required":false,"schema":{"type":"boolean"}},{"description":"the first characters of the vendor number; sent blank: every vendor","in":"query","name":"prefix","required":false,"schema":{"type":"string"}},{"description":"a fragment of the vendor name, case-insensitive","in":"query","name":"name","required":false,"schema":{"type":"string"}},{"description":"seven digits: the local phone number","in":"query","name":"phone","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"items":{"type":"object"},"type":"array"}}},"description":"every vendor the search selects (FoxPro APSCAN): by exact number, number prefix, name fragment or seven phone digits"},"401":{"description":"unauthenticated"},"422":{"description":"no search key, or only blank ones without `prefix` (query: one_of), or a phone without seven digits (phone: seven_digits)"}},"security":[{"bearer":[]}],"tags":["Vendors"]},"post":{"operationId":"vendors_create","requestBody":{"content":{"application/json":{"schema":{"description":"The body of `vendors.create` and `vendors.update`. A text field that is not sent is not changed.","properties":{"address1":{"default":null,"description":"Address lines, at most 30 characters each","type":["string","null"]},"address2":{"default":null,"type":["string","null"]},"address3":{"default":null,"type":["string","null"]},"agent":{"default":null,"description":"At most 40 characters","type":["string","null"]},"agent_fax":{"default":null,"type":["string","null"]},"agent_phone":{"default":null,"type":["string","null"]},"bank_account":{"default":null,"type":["string","null"]},"bank_address1":{"default":null,"type":["string","null"]},"bank_address2":{"default":null,"type":["string","null"]},"bank_address3":{"default":null,"type":["string","null"]},"bank_address4":{"default":null,"type":["string","null"]},"bank_beneficiary":{"default":null,"type":["string","null"]},"bank_branch":{"default":null,"type":["string","null"]},"bank_fax":{"default":null,"type":["string","null"]},"bank_name":{"default":null,"description":"The vendor's bank: name (40), four address lines (30), phone and fax (15), branch (10), account (12), beneficiary (40)","type":["string","null"]},"bank_phone":{"default":null,"type":["string","null"]},"contact":{"default":null,"description":"At most 20 characters","type":["string","null"]},"credit_limit_cents":{"default":null,"description":"The credit limit in cents, 0-999999900","format":"int64","type":["integer","null"]},"email":{"default":null,"description":"The supplier's e-mail address on file, at most 254 characters. Mail from it never lands in an Unknown conversation","type":["string","null"]},"fax":{"default":null,"type":["string","null"]},"fox":{"default":false,"description":"true = the rules of FoxPro's vendor editor: a 6-character number, a terms code that is on file, a G/L account from the chart. Default false","type":"boolean"},"gl_account":{"default":null,"description":"The default G/L expense account, at most 10 characters","type":["string","null"]},"gst_number":{"default":null,"description":"The vendor's GST number, at most 10 characters","type":["string","null"]},"id":{"default":null,"description":"vendors.update: the vendor's id. Never sent to vendors.create","format":"int64","type":["integer","null"]},"if_updated_at":{"default":null,"description":"vendors.update: the updated_at read with the vendor; when the vendor changed since, the write is refused (stale)","type":["string","null"]},"name":{"default":null,"description":"At most 40 characters","type":["string","null"]},"notes":{"default":null,"description":"At most 25 characters","type":["string","null"]},"number":{"default":null,"description":"vendors.create: the vendor number, 1-6 characters without blanks, stored upper case. Never sent to vendors.update (vendors.renumber changes it)","type":["string","null"]},"our_account":{"default":null,"description":"Our account number at the vendor, at most 10 characters","type":["string","null"]},"phone":{"default":null,"description":"Phone and fax numbers, at most 15 characters each","type":["string","null"]},"postal":{"default":null,"description":"At most 10 characters","type":["string","null"]},"terms_code":{"default":null,"description":"A vendor terms code (vendor_terms), at most 2 characters","type":["string","null"]}},"type":"object"}}},"required":false},"responses":{"201":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the vendor with its bank fields and updated_at"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs catalog.write)"},"422":{"description":"validation_failed (number, a text field, credit_limit_cents, terms_code, gl_account), vendor_number_taken, or with `fox: true` vendor_number_format"}},"security":[{"bearer":[]}],"tags":["Vendors"]}},"/vendors/{id}":{"delete":{"operationId":"vendors_delete","parameters":[{"description":"vendor id","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}},{"description":"the updated_at read with the vendor","in":"query","name":"if_updated_at","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"`{ id, number, deleted: true }`"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs catalog.write)"},"404":{"description":"vendor not found"},"412":{"description":"stale"},"422":{"description":"vendor_in_use: a part names the vendor (details.parts)"}},"security":[{"bearer":[]}],"tags":["Vendors"]},"get":{"operationId":"vendors_show","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"one vendor (no bank details)"},"401":{"description":"unauthenticated"},"404":{"description":"vendor not found"}},"security":[{"bearer":[]}],"tags":["Vendors"]},"patch":{"operationId":"vendors_update","parameters":[{"description":"vendor id","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"description":"The body of `vendors.create` and `vendors.update`. A text field that is not sent is not changed.","properties":{"address1":{"default":null,"description":"Address lines, at most 30 characters each","type":["string","null"]},"address2":{"default":null,"type":["string","null"]},"address3":{"default":null,"type":["string","null"]},"agent":{"default":null,"description":"At most 40 characters","type":["string","null"]},"agent_fax":{"default":null,"type":["string","null"]},"agent_phone":{"default":null,"type":["string","null"]},"bank_account":{"default":null,"type":["string","null"]},"bank_address1":{"default":null,"type":["string","null"]},"bank_address2":{"default":null,"type":["string","null"]},"bank_address3":{"default":null,"type":["string","null"]},"bank_address4":{"default":null,"type":["string","null"]},"bank_beneficiary":{"default":null,"type":["string","null"]},"bank_branch":{"default":null,"type":["string","null"]},"bank_fax":{"default":null,"type":["string","null"]},"bank_name":{"default":null,"description":"The vendor's bank: name (40), four address lines (30), phone and fax (15), branch (10), account (12), beneficiary (40)","type":["string","null"]},"bank_phone":{"default":null,"type":["string","null"]},"contact":{"default":null,"description":"At most 20 characters","type":["string","null"]},"credit_limit_cents":{"default":null,"description":"The credit limit in cents, 0-999999900","format":"int64","type":["integer","null"]},"email":{"default":null,"description":"The supplier's e-mail address on file, at most 254 characters. Mail from it never lands in an Unknown conversation","type":["string","null"]},"fax":{"default":null,"type":["string","null"]},"fox":{"default":false,"description":"true = the rules of FoxPro's vendor editor: a 6-character number, a terms code that is on file, a G/L account from the chart. Default false","type":"boolean"},"gl_account":{"default":null,"description":"The default G/L expense account, at most 10 characters","type":["string","null"]},"gst_number":{"default":null,"description":"The vendor's GST number, at most 10 characters","type":["string","null"]},"if_updated_at":{"default":null,"description":"vendors.update: the updated_at read with the vendor; when the vendor changed since, the write is refused (stale)","type":["string","null"]},"name":{"default":null,"description":"At most 40 characters","type":["string","null"]},"notes":{"default":null,"description":"At most 25 characters","type":["string","null"]},"number":{"default":null,"description":"vendors.create: the vendor number, 1-6 characters without blanks, stored upper case. Never sent to vendors.update (vendors.renumber changes it)","type":["string","null"]},"our_account":{"default":null,"description":"Our account number at the vendor, at most 10 characters","type":["string","null"]},"phone":{"default":null,"description":"Phone and fax numbers, at most 15 characters each","type":["string","null"]},"postal":{"default":null,"description":"At most 10 characters","type":["string","null"]},"terms_code":{"default":null,"description":"A vendor terms code (vendor_terms), at most 2 characters","type":["string","null"]}},"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the vendor with its bank fields and updated_at"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs catalog.write)"},"404":{"description":"vendor not found"},"412":{"description":"stale: `if_updated_at` was sent and the vendor changed since"},"422":{"description":"validation_failed"}},"security":[{"bearer":[]}],"tags":["Vendors"]}},"/vendors/{id}/bank":{"get":{"operationId":"vendors_bank","parameters":[{"description":"vendor id","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the vendor's ten bank fields"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs catalog.write)"},"404":{"description":"vendor not found"}},"security":[{"bearer":[]}],"tags":["Vendors"]}},"/vendors/{id}/renumber":{"post":{"operationId":"vendors_renumber","parameters":[{"description":"vendor id","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"properties":{"fox":{"default":false,"description":"true = FoxPro's rule: exactly 6 characters. Default false","type":"boolean"},"if_updated_at":{"default":null,"description":"The updated_at read with the vendor; when the vendor changed since, the write is refused (stale)","type":["string","null"]},"number":{"default":"","description":"The new number, 1-6 characters without blanks, stored upper case","type":"string"}},"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the vendor under its new number, plus `renumbered: { parts, stock_movements }`"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs catalog.write)"},"404":{"description":"vendor not found"},"412":{"description":"stale"},"422":{"description":"validation_failed (number), vendor_number_taken, or with `fox: true` vendor_number_format"}},"security":[{"bearer":[]}],"tags":["Vendors"]}},"/vins/{vin}":{"get":{"operationId":"vins_decode","parameters":[{"description":"the VIN; spaces and dashes are ignored","in":"path","name":"vin","required":true,"schema":{"type":"string"}},{"description":"compare the decode with this vehicle's typed year, make and model","in":"query","name":"vehicle_id","required":false,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the decode: year, make, model, trim, engine, fuel, drivetrain, body, check_digit_ok, warnings, differs"},"401":{"description":"unauthenticated"},"422":{"description":"not a VIN"},"503":{"description":"vehicle data is off or Wenmar Open did not answer"}},"security":[{"bearer":[]}],"tags":["Vehicles"]}},"/vins/{vin}/recalls":{"get":{"operationId":"vins_recalls","parameters":[{"description":"the VIN","in":"path","name":"vin","required":true,"schema":{"type":"string"}},{"description":"also list manufacturer bulletins (default true)","in":"query","name":"bulletins","required":false,"schema":{"type":"boolean"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"recalls that may apply to the model year, and bulletins"},"401":{"description":"unauthenticated"},"503":{"description":"vehicle data is off or Wenmar Open did not answer"}},"security":[{"bearer":[]}],"tags":["Vehicles"]}},"/vins/{vin}/specs":{"get":{"operationId":"vins_specs","parameters":[{"description":"the VIN; spaces and dashes are ignored","in":"path","name":"vin","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"what Wenmar Open holds for the VIN's vehicle"},"401":{"description":"unauthenticated"},"422":{"description":"not a VIN"},"503":{"description":"vehicle data is off on this server"}},"security":[{"bearer":[]}],"tags":["Vehicles"]}},"/work_order_flags":{"get":{"operationId":"work_order_flags_index","parameters":[{"description":"the location whose flags to list; a scoped user's own location always wins","in":"query","name":"location_id","required":false,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"items":{"type":"object"},"type":"array"}}},"description":"the flags a WO at the location may carry: [{id, name, location_id, position}]"},"401":{"description":"unauthenticated"}},"security":[{"bearer":[]}],"tags":["Work Orders"]}},"/work_order_line_items/{id}/labour_feedback":{"post":{"operationId":"work_order_line_items_labour_feedback","parameters":[{"description":"labour line item id","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"{verdict, reasons?}: verdict low|right|high, or null to clear; reasons (access, wrong_vehicle, seized, extra_work, discounted) with low or high only","required":true},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"{line_item_id, verdict, reasons, guide_source}: the answer now kept (verdict null when cleared)"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized (work_orders.write)"},"404":{"description":"not found"},"422":{"description":"validation_failed: line_item_id (not_labour, not_wenmar), verdict, reasons"}},"security":[{"bearer":[]}],"tags":["Work orders"]}},"/work_order_notes/{id}":{"get":{"operationId":"work_order_notes_show","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"note"},"401":{"description":"unauthenticated"},"403":{"description":"another location's work order"},"404":{"description":"not found"}},"security":[{"bearer":[]}],"tags":["Work Orders"]}},"/work_orders":{"get":{"operationId":"work_orders_index","parameters":[{"description":"false (default): hide cancelled orders; true: only cancelled; all: both. With updated_since and no cancelled, both. stage=9 needs cancelled=true or all","in":"query","name":"cancelled","required":false,"schema":{"type":"string"}},{"description":"only these stages; a comma list is any of them (`stage=0,5`)","in":"query","name":"stage","required":false,"schema":{"type":"string"}},{"description":"only these kinds (`service`, `counter`); a comma list is any of them","in":"query","name":"kind","required":false,"schema":{"type":"string"}},{"description":"only these locations; a comma list is any of them. A user scoped to one location always sees that one","in":"query","name":"location_id","required":false,"schema":{"type":"string"}},{"description":"only the orders on these technicians; a comma list is any of them, and `none` is the orders with no technician (`technician_id=12,none`)","in":"query","name":"technician_id","required":false,"schema":{"type":"string"}},{"description":"only the orders carrying these flags (`POST /work_orders/{id}/flag`); a comma list is any of them, and `none` is the orders with no flag","in":"query","name":"flag_id","required":false,"schema":{"type":"string"}},{"description":"the list's order. `number`: order number. `customer`: customer name A–Z. `opened`: opened date. `total`: total. `stage`: stage. `technician`: technician name, the orders on no technician last in `asc`, first in `desc`","in":"query","name":"sort","required":false,"schema":{"type":"string"}},{"description":"`asc` (default) or `desc`; the direction of `sort`","in":"query","name":"dir","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"items":{"type":"object"},"type":"array"}}},"description":"work order list"},"401":{"description":"unauthenticated"},"422":{"description":"an unknown sort, an invalid dir, or a value of stage, location_id, technician_id or flag_id that is not a whole number"}},"security":[{"bearer":[]}],"tags":["Work Orders"]},"post":{"operationId":"work_orders_create","requestBody":{"content":{"application/json":{"schema":{}}},"required":true},"responses":{"201":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"work order created"},"401":{"description":"unauthenticated"},"422":{"description":"invalid or missing attributes"}},"security":[{"bearer":[]}],"tags":["Work Orders"]}},"/work_orders/by_public_id/{public_id}":{"get":{"operationId":"work_orders_show_by_public_id","parameters":[{"description":"The ULID the client made for the record","in":"path","name":"public_id","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the work order, as GET /work_orders/{id}"},"401":{"description":"unauthenticated"},"404":{"description":"no work order you can see has this public id"}},"security":[{"bearer":[]}],"tags":["Work Orders"]}},"/work_orders/groups":{"get":{"operationId":"work_orders_groups","parameters":[{"description":"required. `stage`: one `stage:<n>` group per stage present, in stage order. `technician`: one `tech:<id>` group per technician with orders, label order, `tech:none` (\"No technician\") last","in":"query","name":"by","required":false,"schema":{"type":"string"}},{"description":"the list's own filters narrow the counts: `stage`, `customer_id`, `vehicle_id`, `kind`, `location_id`, `technician_id`, `flag_id`, `updated_since`, `cancelled` (each of the lists on `GET /work_orders` takes several values)","in":"query","name":"stage","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"items":{"type":"object"},"type":"array"}}},"description":"the group counts: a bare array of `{key, label, count}`; `count` covers every order the filters keep, not one page; `label` is the stage's word, the technician's name, or \"No technician\""},"401":{"description":"unauthenticated"},"422":{"description":"an unknown by"}},"security":[{"bearer":[]}],"tags":["Work Orders"]}},"/work_orders/intake":{"post":{"operationId":"work_orders_intake","requestBody":{"content":{"application/json":{"schema":{"properties":{"arrived_at":{"default":null,"type":["string","null"]},"booking_id":{"default":null,"description":"The booking this visit was booked as (bookings.list with open = true); it is converted","format":"int64","type":["integer","null"]},"concerns":{"default":[],"description":"What the customer says is wrong, one entry per concern; blank entries are skipped","items":{"type":"string"},"type":"array"},"customer":{"properties":{"id":{"default":null,"description":"An existing customer (customers.list)","format":"int64","type":["integer","null"]},"new":{"anyOf":[{"properties":{"email":{"default":null,"type":["string","null"]},"name":{"default":null,"description":"The name as said (\"Marc Tremblay\"; the last word is the last name)","type":["string","null"]},"phone":{"default":null,"type":["string","null"]},"public_id":{"default":null,"description":"The client's own id for this customer (plan 1441); a second call with it answers the row","type":["string","null"]},"texts_ok":{"default":null,"description":"The phone may be texted: filed as the customer's mobile. Left out or false, it is\nfiled as their home phone, which is not texted","type":["boolean","null"]}},"type":"object"},{"type":"null"}],"default":null,"description":"A new customer: a name or a phone is enough"},"public_id":{"default":null,"description":"An existing customer by the client's own id (plan 1441)","type":["string","null"]}},"type":"object"},"driver":{"anyOf":[{"description":"A driver written on the order: `{\"full_name\": …, \"phone\": …, \"email\": …}`.","properties":{"email":{"default":null,"type":["string","null"]},"full_name":{"default":null,"description":"Required: the driver's name","type":["string","null"]},"phone":{"default":null,"type":["string","null"]}},"type":"object"},{"type":"null"}],"default":null,"description":"A new driver for this order, made under the customer: {\"full_name\", \"phone\", \"email\"};\na name the customer already has is that driver"},"driver_id":{"default":null,"description":"An existing driver of the customer (drivers.list with customer_id). Leave driver_id,\ndriver and no_driver all out to take the vehicle's usual driver","format":"int64","type":["integer","null"]},"intake":{"default":null,"description":"waiting (the customer waits at the shop) or drop_off","type":["string","null"]},"keys_location":{"default":null,"type":["string","null"]},"location_id":{"default":null,"description":"Default: the user's location","format":"int64","type":["integer","null"]},"no_driver":{"default":false,"description":"true: the order names no driver, not even the vehicle's usual one","type":"boolean"},"notes":{"default":null,"description":"The order's notes (not printed)","type":["string","null"]},"odometer_in":{"default":null,"format":"int64","type":["integer","null"]},"promised_at":{"default":null,"description":"\"Back by\", a time with its offset","type":["string","null"]},"public_id":{"default":null,"description":"The client's own id for this order (plan 1441); a second call with it answers the order","type":["string","null"]},"return_method":{"default":null,"description":"pickup, drop_off or other","type":["string","null"]},"return_notes":{"default":null,"type":["string","null"]},"vehicle":{"anyOf":[{"properties":{"id":{"default":null,"description":"An existing vehicle of this customer (vehicles.list with customer_id)","format":"int64","type":["integer","null"]},"new":{"anyOf":[{"properties":{"colour":{"default":null,"description":"The vehicle's colour (plan 3249)","type":["string","null"]},"make":{"default":null,"type":["string","null"]},"model":{"default":null,"type":["string","null"]},"plate":{"default":null,"type":["string","null"]},"plate_region":{"default":null,"description":"The plate's province or state as its two-letter code (\"ON\"; plan 3249)","type":["string","null"]},"province":{"default":null,"description":"The plate's province or state, as vehicles.create's license_plate_state code","format":"int64","type":["integer","null"]},"public_id":{"default":null,"description":"The client's own id for this vehicle (plan 1441); a second call with it answers the row","type":["string","null"]},"submodel":{"default":null,"description":"The trim (\"EX-L\")","type":["string","null"]},"vin":{"default":null,"type":["string","null"]},"year":{"default":null,"format":"int64","type":["integer","null"]}},"type":"object"},{"type":"null"}],"default":null,"description":"A new vehicle: any one of vin, plate, year, make or model"},"public_id":{"default":null,"description":"An existing vehicle of this customer by the client's own id (plan 1441)","type":["string","null"]}},"type":"object"},{"type":"null"}],"default":null,"description":"What car: {\"id\": …} or {\"new\": {…}}; leave it out when none was said"},"vehicle_location":{"default":null,"type":["string","null"]}},"type":"object"}}},"required":false},"responses":{"201":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the new work order's document (Idempotency-Key replays it)"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized (needs work_orders.create)"},"409":{"description":"the named booking is already a work order, or was removed"},"422":{"description":"validation_failed (customer, vehicle, driver, concerns) or idempotency_key_reused"}},"security":[{"bearer":[]}],"summary":"`POST /work_orders/intake` (plan 1104): a new work order with its customer, vehicle, visit\nfields and concerns in one call; the named booking is converted. Answers the new order's\ndocument. Keyed on `Idempotency-Key`.","tags":["Work Orders"]}},"/work_orders/open":{"get":{"operationId":"work_orders_open","responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the Open board (plan 2601): `groups` in the stage order the sidebar uses (`estimates`, `in_progress`, `completed`), each with `orders` — the full work order rows, most recently updated first, each carrying its `next_step` (`{kind, args}`, the one thing the order is waiting on; absent when it waits on nothing); empty groups keep an empty list"},"401":{"description":"unauthenticated"}},"security":[{"bearer":[]}],"tags":["Work Orders"]}},"/work_orders/{id}":{"get":{"operationId":"work_orders_show","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"work order"},"401":{"description":"unauthenticated"},"404":{"description":"not found"}},"security":[{"bearer":[]}],"tags":["Work Orders"]},"patch":{"operationId":"work_orders_update","parameters":[{"description":"ETag from the last read (plan 105)","in":"header","name":"If-Match","required":false,"schema":{"type":["string","null"]}},{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"work order updated"},"401":{"description":"unauthenticated"},"404":{"description":"not found"},"409":{"description":"work order finalized"},"412":{"description":"record changed since If-Match; body.current is the record now"},"422":{"description":"invalid request"}},"security":[{"bearer":[]}],"tags":["Work Orders"]}},"/work_orders/{id}/activity":{"get":{"operationId":"work_orders_activity","parameters":[{"description":"one group (notes, customer, parts, money, assistant, work) or one item kind","in":"query","name":"kind","required":false,"schema":{"type":"string"}},{"description":"only one chip: customer, notes, parts, money, changes","in":"query","name":"show","required":false,"schema":{"type":"string"}},{"description":"only items holding these words (what was said, the actor's name)","in":"query","name":"q","required":false,"schema":{"type":"string"}},{"description":"the next_before of the previous page","in":"query","name":"before","required":false,"schema":{"type":"string"}},{"description":"1 to 200, default 50","in":"query","name":"limit","required":false,"schema":{"format":"int64","type":"integer"}},{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"{items: [{id, at, day, kind, group, chip, actor {kind, id, name}, summary, event, args, body, job {id, name}, who, who_kind, subject {type, id}, amount_cents, changes}], counts {all, customer, notes, parts, money, changes}, time_zone, next_before}, newest first"},"401":{"description":"unauthenticated"},"403":{"description":"another location's work order"},"404":{"description":"not found"},"422":{"description":"an unknown kind or chip, a bad before cursor, or limit outside 1 to 200"}},"security":[{"bearer":[]}],"tags":["Work Orders"]}},"/work_orders/{id}/answer":{"post":{"operationId":"work_orders_answer","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"approve":{"default":[],"description":"The service ids the customer approved. Empty when the customer approved nothing.","items":{"format":"int64","type":"integer"},"type":"array"},"authorized_by_name":{"default":null,"description":"Who answered; defaults to the customer's name. Required when the location tracks the\nauthorizer's name (formal mode).","type":["string","null"]},"decline":{"default":[],"description":"The service ids the customer declined. Empty when the customer declined nothing.","items":{"format":"int64","type":"integer"},"type":"array"},"method":{"default":null,"description":"`in_person`, `phone`, `text`, `portal` or `agent`; the method the customer answered by.\n`portal` and `agent` are for the customer's page; the advisor records in_person, phone or\ntext. Omitted = in_person.","type":["string","null"]},"notes":{"default":null,"description":"The words the customer said; shown in the order's history. Optional.","type":["string","null"]},"services":{"description":"The waiting services the order's next actions hand the client to draw the rows; the\noperation only reads `approve` and `decline`, so this is accepted and ignored.","items":true,"type":"array","writeOnly":true},"start":{"default":false,"description":"Start the work now, when this is an estimate. Default `false`.","type":"boolean"}},"required":[],"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the approved and declined services, the order's stage, and the batch id"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized"},"404":{"description":"not found"},"409":{"description":"authorization_off, already_posted, work_order_not_editable or invalid_transition"},"422":{"description":"validation_failed"}},"security":[{"bearer":[]}],"summary":"`POST /work_orders/{id}/answer` (plan 3060): the customer's yes and no answers, recorded in\none step. Not a create, so no `Idempotency-Key`.","tags":["Work Orders"]}},"/work_orders/{id}/apply_credit":{"post":{"operationId":"work_orders_apply_credit","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"properties":{"amount_cents":{"default":null,"description":"At most this much, in cents; default: as much as the credit and the balance allow","format":"int64","type":["integer","null"]}},"required":[],"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the credit application that paid the invoice"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized"},"404":{"description":"not found"},"409":{"description":"not_posted, nothing_owing, or no_credit"},"422":{"description":"invalid request"}},"security":[{"bearer":[]}],"tags":["Work Orders"]}},"/work_orders/{id}/approve_all":{"post":{"operationId":"work_orders_approve_all","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"description":"The customer's answer for every pending service of an order.","properties":{"authorized_by_name":{"default":null,"description":"Who gave the answer; required when the location uses formal authorization","type":["string","null"]},"authorized_by_phone":{"default":null,"description":"Their phone number","type":["string","null"]},"method":{"default":null,"description":"How the customer answered: in_person, phone, portal or agent","type":["string","null"]},"notes":{"default":null,"description":"A note","type":["string","null"]},"service_ids":{"default":null,"description":"Approve only these services (ids of the order's pending services). Absent: every\npending service. An id that is not pending on this order is skipped.","items":{"format":"int64","type":"integer"},"type":["array","null"]},"signature_attachment_id":{"default":null,"description":"The id of a photo of the customer's signature, staged on this work order\n(`POST /work_orders/{id}/attachments`). Optional; never required.","type":["string","null"]}},"required":[],"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the services approved and their batch id"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized"},"404":{"description":"not found"},"409":{"description":"authorization_off, already_posted or work_order_not_editable"},"422":{"description":"validation_failed"}},"security":[{"bearer":[]}],"tags":["Work Orders"]}},"/work_orders/{id}/attachments":{"get":{"operationId":"attachment_index","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"attachments"},"401":{"description":"unauthenticated"},"404":{"description":"not found"}},"security":[{"bearer":[]}],"tags":["Attachments"]},"post":{"operationId":"attachment_create","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateAttachmentBody"}}},"required":true},"responses":{"200":{"description":"replayed: the same attachment, its upload target signed again; attachment.status tells whether the bytes already arrived"},"201":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"attachment staged"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized"},"404":{"description":"not found"},"422":{"description":"invalid request"}},"security":[{"bearer":[]}],"tags":["Attachments"]}},"/work_orders/{id}/authorization_logs":{"get":{"operationId":"work_orders_authorization_logs","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"items":{"type":"object"},"type":"array"}}},"description":"approvals and declines, oldest first"},"401":{"description":"unauthenticated"},"403":{"description":"another location's work order"},"404":{"description":"not found"}},"security":[{"bearer":[]}],"tags":["Work Orders"]}},"/work_orders/{id}/clock":{"get":{"operationId":"work_orders_clock","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"who is on the clock, the time on each service, every clock entry, and the caller's running clock"},"401":{"description":"unauthenticated"},"403":{"description":"another location's work order"},"404":{"description":"not found"}},"security":[{"bearer":[]}],"tags":["Work Orders"]}},"/work_orders/{id}/close":{"post":{"operationId":"work_orders_close","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"properties":{"by_order_terms":{"default":false,"description":"Let the order's terms decide (plan 408, FoxPro `[P]` `[I]`): cash\nterms must be paid in full by `tenders` and cannot be charged; any\nother terms take no payment and charge the whole balance.\n`charge_to_account` is then only checked, not obeyed.","type":"boolean"},"cash_received_cents":{"description":"The cash the customer handed over for the cash tender (plan 1599). Stored with the\nchange on the tender's receipt header, so a reprinted receipt shows both. Never refuses\nthe post: a value below the cash tendered, or without a cash tender, is ignored with the\nwarning `cash_received_ignored`. Absent: nothing changes.","format":"int64","type":["integer","null"]},"charge_to_account":{"default":false,"description":"Charge the unpaid balance to the customer's account (any customer; a\ncash-terms customer is charged with a `cash_terms_charged` warning).\nWithout it the order must be paid in full.","type":"boolean"},"complete_first":{"default":false,"description":"Ignored (design D7: an open order posts directly; a refused post\nleaves it open, as it was). Kept: released clients send it.","type":"boolean"},"expected_invoice_number":{"default":null,"description":"The invoice number the client printed from\n`POST /work_orders/{id}/close/preview/document`. When the post would\nassign another number, nothing is posted: 409 `conflict` on this field.","format":"int64","type":["integer","null"]},"invoice_date":{"default":null,"description":"Invoice date `YYYY-MM-DD` (O2). Omitted = the shop's today\n(`post::posting_today`); must fall inside the posting window.","type":["string","null"]},"tenders":{"default":[],"description":"Payments taken at the post (plan 67): each `{ method, amount_cents,\nreference? }`, one per payment type. Without `charge_to_account` they\nmust cover the balance exactly; with it, the rest is charged.","items":{"description":"One payment type's share of a posting (FoxPro ARDEPOS/ARCASHD row).","properties":{"amount_cents":{"description":"Cents: > 0 on a balance owed; < 0 (money handed back) on a credit order\nwhose balance is negative. Never zero.","format":"int64","type":"integer"},"card_last4":{"description":"The card's last 4 digits (plan 1680); only on a card method","type":["string","null"]},"method":{"description":"cash | cheque | debit | visa | mastercard | amex | other","type":"string"},"reference":{"default":null,"description":"Cheque or authorization number","type":["string","null"]}},"required":["method","amount_cents"],"type":"object"},"type":"array"}},"required":[],"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"work order posted as an invoice; `warnings` lists e.g. cash_terms_charged, cash_received_ignored; `cash_received_cents` and `change_cents` when the cash handed over was recorded"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized"},"404":{"description":"not found"},"409":{"description":"invalid_transition, already_posted, or conflict (credit limit / invoice number); conflict on expected_invoice_number when the printed invoice number would not be the one posted"},"422":{"description":"balance_outstanding, no_customer, posting_window, invalid_date, tenders_unbalanced, tenders_exceed_balance, tax_not_configured (the order has taxable lines and the location has no province or GST/HST rate), validation_failed"}},"security":[{"bearer":[]}],"tags":["Work Orders"]}},"/work_orders/{id}/close/preview":{"post":{"operationId":"work_orders_close_preview","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CloseBody"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"{ result: { remaining_cents, tendered_cents, balance_to_distribute_cents, charged_cents }, errors: { field: message } } computed from the order's lines as the close would (errors.tax = tax not configured); writes nothing"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized"},"404":{"description":"not found"},"409":{"description":"already_posted or invalid_transition"}},"security":[{"bearer":[]}],"tags":["Work Orders"]}},"/work_orders/{id}/close/preview/document":{"post":{"operationId":"work_orders_close_preview_document","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CloseBody"}}},"required":true},"responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"the invoice the post would freeze, as a Letter-size PDF; the header `X-Invoice-Number` carries the number shown (send it as `expected_invoice_number` on close); writes nothing"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized"},"404":{"description":"not found"},"409":{"description":"already_posted, or invalid_transition (an estimate, a cancelled or a declined order)"},"422":{"description":"invalid_date, validation_failed (a payment line), tenders_unbalanced, tenders_exceed_balance, cash_terms_no_charge, charge_terms_no_tenders"}},"security":[{"bearer":[]}],"tags":["Work Orders"]}},"/work_orders/{id}/complete":{"post":{"operationId":"work_orders_complete","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"work order completed"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized"},"404":{"description":"not found"},"409":{"description":"invalid transition"},"422":{"description":"invalid request"}},"security":[{"bearer":[]}],"tags":["Work Orders"]}},"/work_orders/{id}/concerns":{"get":{"operationId":"work_order_concerns_list","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"items":{"type":"object"},"type":"array"}}},"description":"the order's concerns, in order"},"401":{"description":"unauthenticated"},"403":{"description":"another location's work order"}},"security":[{"bearer":[]}],"tags":["Work Orders"]},"post":{"operationId":"work_order_concerns_create","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CrudBody"}}},"required":true},"responses":{"201":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"concern added at the end (attrs: body, source)"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized or another location's work order"},"409":{"description":"already_posted or work_order_not_editable"},"422":{"description":"invalid request"}},"security":[{"bearer":[]}],"tags":["Work Orders"]}},"/work_orders/{id}/concerns/reorder":{"patch":{"operationId":"work_order_concerns_reorder","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReorderBody"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"items":{"type":"object"},"type":"array"}}},"description":"the order's concerns in their new order"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized or another location's work order"},"409":{"description":"already_posted or work_order_not_editable"},"422":{"description":"invalid request"}},"security":[{"bearer":[]}],"tags":["Work Orders"]}},"/work_orders/{id}/convert_estimate":{"post":{"operationId":"work_orders_convert_estimate","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the order the estimate became: stage 5, a new order number, today's order date, the estimate number kept"},"401":{"description":"unauthenticated"},"403":{"description":"needs work_orders.lifecycle, or another location's order"},"404":{"description":"not found"},"409":{"description":"not an estimate (already converted, started or cancelled)"}},"security":[{"bearer":[]}],"tags":["Work Orders"]}},"/work_orders/{id}/correct":{"post":{"operationId":"work_orders_correct","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"properties":{"copy":{"default":null,"description":"false: post the credit only (the invoice is cancelled). Absent or true: also open a copy\nto fix and post again.","type":["boolean","null"]}},"required":[],"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the posted credit and the open copy: `{credit: {id, work_order_number, invoice_number, total_cents}, copy: {id, work_order_number, total_cents}}`; `copy` is left out when `copy: false` was sent (the credit only)"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized"},"404":{"description":"not found"},"409":{"description":"not_posted, already_corrected, manual_invoice (corrected with a manual credit), imported_history (an invoice imported from the previous system), no_customer (a walk-in sale is corrected with a refund), unsupported_invoice (a line or sublet without a service), or conflict (the credit could not be posted)"}},"security":[{"bearer":[]}],"tags":["Work Orders"]}},"/work_orders/{id}/decline":{"post":{"operationId":"work_orders_decline","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"properties":{"closure_reason":{"default":null,"description":"Older name for `reason`; kept for released clients.","type":["string","null"]},"code":{"default":null,"description":"Optional code: price, timing, not_needed, second_opinion, going_elsewhere,\nwill_book_later, other. Send one when the reason clearly fits; never ask the user for\none. An unknown code is stored as other.","type":["string","null"]},"payments_to_credit":{"default":false,"description":"Plan 1089: when the order holds payments, keep them as the customer's shop credit and\ndecline (void) anyway. Without it an order with payments is refused, as before.","type":"boolean"},"reason":{"default":null,"description":"Why the customer said no, in any words. Optional: leave it out when none was given.","type":["string","null"]}},"required":[],"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"work order declined"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized"},"404":{"description":"not found"},"409":{"description":"invalid transition"},"422":{"description":"invalid request"}},"security":[{"bearer":[]}],"tags":["Work Orders"]}},"/work_orders/{id}/document":{"get":{"operationId":"work_orders_document","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"work order with services, line items, and sublets; `phase` (derived: no_work, estimate_ready, in_work, ready_to_post, posted_unpaid, credit_due, paid, voided, declined; more may be added) and `next_actions` (`[{action, label, tool, args, allowed}]`, in order)"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized"},"404":{"description":"work order not found"}},"security":[{"bearer":[]}],"tags":["Work Orders"]}},"/work_orders/{id}/documents/{kind}":{"get":{"operationId":"work_orders_document_pdf","parameters":[{"description":"Work order id","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}},{"description":"invoice | work_order | estimate","in":"path","name":"kind","required":true,"schema":{"type":"string"}},{"description":"`foxpro`, `modern` (every kind) and `fox_reprint` (the invoice): kept for old clients; they all print exactly what the route prints without `form`. Absent: the same","in":"query","name":"form","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"the document as a Letter-size PDF"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized (location scope)"},"404":{"description":"not found"},"409":{"description":"not_posted: only a posted order has an invoice"},"422":{"description":"unknown_kind; unknown_form"}},"security":[{"bearer":[]}],"tags":["Work Orders"]}},"/work_orders/{id}/documents/{kind}/data":{"get":{"operationId":"work_orders_document_data","parameters":[{"description":"Work order id","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}},{"description":"invoice | work_order | estimate","in":"path","name":"kind","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"one document's data: `{ work_order_id, kind, number, location_id, customer_id, updated_at, data }`, `data` the PDF route's `DocumentData`"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized (location scope)"},"404":{"description":"not found"},"409":{"description":"not_posted: only a posted order has an invoice"},"422":{"description":"unknown_kind"}},"security":[{"bearer":[]}],"summary":"One document's data for a client that renders it on the computer (plan 2777, engine spec\nD18b). The PDF route reads the same `DocumentData`.","tags":["Work Orders"]}},"/work_orders/{id}/estimate_number":{"post":{"operationId":"work_orders_estimate_number","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the estimate, with its estimate number (assigned now when it had none)"},"401":{"description":"unauthenticated"},"403":{"description":"needs work_orders.write, or another location's order"},"404":{"description":"not found"},"409":{"description":"not an estimate"}},"security":[{"bearer":[]}],"tags":["Work Orders"]}},"/work_orders/{id}/flag":{"post":{"operationId":"work_orders_flag","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"properties":{"flag":{"default":null,"description":"The flag to set, by name (\"On hold\"); case and spaces ignored","type":["string","null"]},"flag_id":{"default":null,"description":"The flag to set, by id (work_order_flags.list)","format":"int64","type":["integer","null"]}},"required":[],"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the WO's flag now: id, number, flag ({id, name} or null), group, changed"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized"},"404":{"description":"not found"},"409":{"description":"the WO is not open on the floor (posted, cancelled, voided, declined)"},"422":{"description":"no such flag at the WO's location"}},"security":[{"bearer":[]}],"tags":["Work Orders"]}},"/work_orders/{id}/history":{"get":{"operationId":"work_orders_history","parameters":[{"description":"one group (notes, messages, customer, parts, money, assistant, work) or one item kind","in":"query","name":"kind","required":false,"schema":{"type":"string"}},{"description":"only one chip: customer, notes, parts, money, changes","in":"query","name":"show","required":false,"schema":{"type":"string"}},{"description":"only items holding these words (what was said, the actor's name)","in":"query","name":"q","required":false,"schema":{"type":"string"}},{"description":"the next_before of the previous page","in":"query","name":"before","required":false,"schema":{"type":"string"}},{"description":"1 to 200, default 50","in":"query","name":"limit","required":false,"schema":{"format":"int64","type":"integer"}},{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"{items: [{id, at, day, kind, group, chip, actor {kind, id, name}, summary, event, args, body, job {id, name}, who, who_kind, subject {type, id}, amount_cents, changes}], counts {all, customer, notes, parts, money, changes}, time_zone, next_before}, newest first"},"401":{"description":"unauthenticated"},"403":{"description":"another location's work order"},"404":{"description":"not found"},"422":{"description":"an unknown kind or chip, a bad before cursor, or limit outside 1 to 200"}},"security":[{"bearer":[]}],"summary":"The order's History feed (plan 2631): the activity feed as a route of its own. The\ndesktop History tab and the mobile history call it; `/activity` stays for the TUI.","tags":["Work Orders"]}},"/work_orders/{id}/history_view":{"get":{"operationId":"work_orders_history_view","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the posted invoice as FoxPro's History Inquiry shows it: `header` (with `pay_by_shown`), `totals` (cents and the `99,999.99` text; subtotal and total recomputed), flat `parts`, `labour`, `sublets`, per part `inquiry`, and `profit` (the `basis=foxpro` profit object, null without costs.view)"},"401":{"description":"unauthenticated"},"403":{"description":"needs customers.read, or the order is outside the user's location"},"404":{"description":"work order not found"},"409":{"description":"`not_posted`: the order is not a posted invoice"}},"security":[{"bearer":[]}],"tags":["Work Orders"]}},"/work_orders/{id}/inspection_video_marks":{"get":{"operationId":"inspection_video_marks_list","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"items":{"type":"object"},"type":"array"}}},"description":"the order's video marks, in playback order"},"401":{"description":"unauthenticated"},"403":{"description":"another location's work order"}},"security":[{"bearer":[]}],"tags":["Work Orders"]},"post":{"operationId":"inspection_video_marks_create","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CrudBody"}}},"required":true},"responses":{"201":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"mark added (attrs: attachment_id, start_ms, end_ms, rating, item, finding_id)"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized, another location's work order, or a posted order"},"422":{"description":"invalid request"}},"security":[{"bearer":[]}],"tags":["Work Orders"]}},"/work_orders/{id}/inspections":{"get":{"operationId":"work_order_inspections_list","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"items":{"type":"object"},"type":"array"}}},"description":"the order's inspections with progress, oldest first"},"401":{"description":"unauthenticated"},"403":{"description":"another location's work order"},"404":{"description":"no such work order"}},"security":[{"bearer":[]}],"tags":["Work Orders"]},"post":{"operationId":"work_order_inspections_apply","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"properties":{"technician_id":{"description":"The technician doing it (technicians.list); omitted = nobody yet","format":"int64","type":["integer","null"]},"template_id":{"description":"The template (inspection_templates.list); omitted = the shop's first","format":"int64","type":["integer","null"]}},"required":[],"type":"object"}}},"required":false},"responses":{"201":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the new inspection with its groups and items (Idempotency-Key replays it)"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized or another location's work order"},"409":{"description":"already_posted or work_order_not_editable"},"422":{"description":"unknown template or technician; idempotency_key_reused"}},"security":[{"bearer":[]}],"tags":["Work Orders"]}},"/work_orders/{id}/labour_feedback":{"get":{"operationId":"work_orders_labour_feedback","parameters":[{"description":"work order id","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"{work_order_id, answers: [{line_item_id, verdict, reasons, guide_source, updated_at}]}"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized"},"404":{"description":"not found"}},"security":[{"bearer":[]}],"tags":["Work orders"]}},"/work_orders/{id}/labour_search":{"get":{"operationId":"work_order_labour_search","parameters":[{"description":"words to find in the code or description","in":"query","name":"q","required":true,"schema":{"type":"string"}},{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"{items: [{kind (labour_code | history), code, description, hours (hundredths), labor_rate_type, rate_cents, total_cents (null without a known rate type), work_order_id, work_order_number, on}]}: labour codes, then this vehicle's earlier labour lines. Hours are the labour code's; the Wenmar Open labour guide is not connected"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized (labour codes, or another location's order)"},"404":{"description":"work order not found"}},"security":[{"bearer":[]}],"tags":["Work Orders"]}},"/work_orders/{id}/line_items":{"get":{"operationId":"work_order_line_items_list","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"items":{"type":"object"},"type":"array"}}},"description":"direct line items for the work order (not under a service)"},"401":{"description":"unauthenticated"},"403":{"description":"another location's work order"},"422":{"description":"invalid request"}},"security":[{"bearer":[]}],"tags":["Work Orders"]},"post":{"operationId":"work_order_line_items_create","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CrudBody"}}},"required":true},"responses":{"201":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"line item created"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized or another location's work order"},"409":{"description":"already_posted or work_order_not_editable"},"422":{"description":"invalid request"}},"security":[{"bearer":[]}],"tags":["Work Orders"]}},"/work_orders/{id}/line_items/preview":{"post":{"operationId":"work_order_line_items_preview","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LinePreviewBody"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"{ line, warnings, summary }: the line as it would be saved (defaults from the part or labour code, the price at the customer's level or from the cost, the amount) and warnings with figures: below_min_margin {net_unit_cents, floor_cents}, quantity_exceeded {on_hand_hundredths, committed_hundredths, on_order_hundredths, this_order_hundredths}, obsolete; with per_location the quantity_exceeded figures are the order's location's and carry location_id. summary {line_cents, core_cents, margin_cents and margin_bp (null without costs.view or on labour), pst_cents, gst_cents, tax_cents (this line alone)}. Prices labour (0) and part (1) lines, and fee (2) and discount (3) lines: flat or a percentage (plan 1139). Writes nothing"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized (line writes; a price or discount override; a cost without costs.view)"},"404":{"description":"work order or part not found"},"422":{"description":"part_number or labor_code not on file, unknown labor_rate_type, unknown class, resource, unknown percent_of"}},"security":[{"bearer":[]}],"tags":["Work Orders"]}},"/work_orders/{id}/maintenance_due":{"get":{"operationId":"work_orders_maintenance_due","parameters":[{"description":"work order id","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"items":{"type":"object"},"type":"array"}}},"description":"the appointments due for the order's vehicle, in code order: code, description"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized"},"404":{"description":"not found"}},"security":[{"bearer":[]}],"tags":["Appointments"]}},"/work_orders/{id}/mark_reviewed":{"post":{"operationId":"work_orders_mark_reviewed","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"properties":{},"required":[],"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the review: id, number, reviewed_at, reviewed_by_user_id"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized (the work_orders.review permission, and an editable order)"},"404":{"description":"not found"},"422":{"description":"invalid request"}},"security":[{"bearer":[]}],"tags":["Work Orders"]}},"/work_orders/{id}/messages":{"get":{"operationId":"work_order_messages","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the order's messages"}},"security":[{"bearer":[]}],"tags":["Messages"]}},"/work_orders/{id}/my_part_done":{"post":{"operationId":"work_orders_my_part_done","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"properties":{"done":{"default":true,"description":"true (the default) marks my services done; false undoes it","type":"boolean"}},"required":[],"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the caller's services marked done (or undone): id, number, done, mine, changed, all_work_done"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized"},"404":{"description":"not found"},"409":{"description":"the order can no longer change (posted, voided, declined)"},"422":{"description":"invalid request"}},"security":[{"bearer":[]}],"tags":["Work Orders"]}},"/work_orders/{id}/notes":{"get":{"operationId":"work_order_notes_list","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"items":{"type":"object"},"type":"array"}}},"description":"the order's notes, oldest first"},"401":{"description":"unauthenticated"},"403":{"description":"another location's work order"}},"security":[{"bearer":[]}],"tags":["Work Orders"]},"post":{"operationId":"work_order_notes_create","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CrudBody"}}},"required":true},"responses":{"201":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"note added (attrs: kind note|phone_call, body, amount_cents); allowed at every stage"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized or another location's work order"},"422":{"description":"invalid request"}},"security":[{"bearer":[]}],"tags":["Work Orders"]}},"/work_orders/{id}/part_requests":{"get":{"operationId":"work_order_part_requests_list","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"items":{"type":"object"},"type":"array"}}},"description":"the order's part requests, every state, oldest first"},"401":{"description":"unauthenticated"},"403":{"description":"another location's work order"}},"security":[{"bearer":[]}],"tags":["Work Orders"]},"post":{"operationId":"work_order_part_requests_create","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CrudBody"}}},"required":true},"responses":{"201":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"part request made (attrs: body, work_order_service_id, state (open or ordered), po_number); the advisor is told"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized or another location's work order"},"409":{"description":"already_posted or work_order_not_editable"},"422":{"description":"invalid request"}},"security":[{"bearer":[]}],"tags":["Work Orders"]}},"/work_orders/{id}/part_search":{"get":{"operationId":"work_order_part_search","parameters":[{"description":"words to find in the number, vendor numbers or name","in":"query","name":"q","required":true,"schema":{"type":"string"}},{"description":"the vehicle the parts are for (default: the order's own)","in":"query","name":"vehicle_id","required":false,"schema":{"format":"int64","type":"integer"}},{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"{items: [{part_id, number, name, product_line, stocked, in_stock_here, on_hand (hundredths, this order's location), bin, other_locations_on_hand: [{location_id, name, on_hand}], cost_cents (null without costs.view), sell_cents, price_source, last_purchase: {vendor, cost_cents, on} | null, used_on_vehicle, fit (typed | installed | both | unknown; null without a vehicle)}]}: fitting parts first, then an exact key, then in stock here"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized (parts, or another location's order)"},"404":{"description":"work order not found"}},"security":[{"bearer":[]}],"tags":["Work Orders"]}},"/work_orders/{id}/payments":{"get":{"operationId":"work_order_payments_list","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"items":{"type":"object"},"type":"array"}}},"description":"payments on the work order (voided included)"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized"}},"security":[{"bearer":[]}],"tags":["Payments"]},"post":{"operationId":"work_order_payments_create","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"properties":{"amount_cents":{"description":"Amount in cents, always positive (set is_refund to pay money back)","format":"int64","type":"integer"},"card_last4":{"default":null,"description":"The card's last 4 digits (debit, visa, mastercard, amex, other). Never the full number","type":["string","null"]},"is_refund":{"default":false,"description":"Money returned to the customer rather than received","type":"boolean"},"method":{"description":"cash | cheque | debit | visa | mastercard | amex | other","type":"string"},"notes":{"default":null,"description":"Free-text note","type":["string","null"]},"reference":{"default":null,"description":"Cheque number, card authorization, or other tender reference","type":["string","null"]}},"required":["method","amount_cents"],"type":"object"}}},"required":false},"responses":{"201":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"payment recorded; includes the work order's paid/remaining"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized"},"404":{"description":"work order not found"},"422":{"description":"invalid_method, validation_failed, overpayment, or work_order_not_payable"}},"security":[{"bearer":[]}],"tags":["Payments"]}},"/work_orders/{id}/pill_suggestions":{"get":{"operationId":"work_orders_pill_suggestions","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"{keys: [..], where: [..], last_odometer: {reading, on, work_order_number} | null}"},"401":{"description":"unauthenticated"},"403":{"description":"another location's work order"},"404":{"description":"not found"}},"security":[{"bearer":[]}],"summary":"`GET /work_orders/{id}/pill_suggestions` (plan 3561): what the WO's detail\npills suggest — the location's last five keys and car-location values, and\nthe vehicle's last odometer reading on another work order.","tags":["Work Orders"]}},"/work_orders/{id}/postings":{"get":{"operationId":"work_orders_postings","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the order's posts and unposts, oldest first: {work_order_id, work_order_number, reposted, postings: [{event, invoice_number, invoice_date, due_date, total_cents, tax_total_cents, paid_cents, charged_to_account, actor_id, created_at}]}"},"401":{"description":"unauthenticated"},"403":{"description":"the order is outside the user's location"},"404":{"description":"work order not found"}},"security":[{"bearer":[]}],"tags":["Work Orders"]}},"/work_orders/{id}/profit":{"get":{"operationId":"work_orders_profit","parameters":[{"description":"`foxpro`: FoxPro's gross profit (parts profit + labour + sublet sell − discount; fees count as labour). Absent or `wenmar`: the sublet cost and the labour cost are subtracted, and `labour_cost_cents`, `labour_profit_cents`, `labour_cost_complete` and `gross_profit_bp` are answered","in":"query","name":"basis","required":false,"schema":{"type":"string"}},{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"order profit inquiry (FoxPro [I]nquiry): parts cost, margin, gross profit; integer cents, percentages in basis points (null when the denominator is 0); on the Wenmar basis also the labour cost (stamped at posting, today's rate on an unposted order) and `labour_cost_complete`"},"401":{"description":"unauthenticated"},"403":{"description":"needs costs.view, or the order is outside the user's location"},"404":{"description":"work order not found"},"422":{"description":"basis is neither foxpro nor wenmar"}},"security":[{"bearer":[]}],"tags":["Work Orders"]}},"/work_orders/{id}/receipt":{"get":{"operationId":"work_orders_receipt_pdf","parameters":[{"description":"Work order id: any posted order","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}},{"description":"The cash the customer handed over: the receipt prints it and the change. Absent: the tenders only (a reprint)","in":"query","name":"cash_received_cents","required":false,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/pdf":{"schema":{"items":{"format":"int32","minimum":0,"type":"integer"},"type":"array"}}},"description":"the 80 mm receipt, one page as long as its content, in the customer's language (the location's for a walk-in)"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized (location scope)"},"404":{"description":"not found"},"409":{"description":"not_posted: only a posted order has a receipt"},"422":{"description":"validation_failed on cash_received_cents: negative, less than the cash paid, or the sale took no cash"}},"security":[{"bearer":[]}],"tags":["Work Orders"]}},"/work_orders/{id}/recommendations":{"post":{"operationId":"work_orders_add_recommendation","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"properties":{"service_id":{"description":"The declined service (from vehicles.recommendations)","format":"int64","type":"integer"}},"required":["service_id"],"type":"object"}}},"required":false},"responses":{"201":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the copied service"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized or another location's work order"},"404":{"description":"not found"},"409":{"description":"invalid_transition, already_posted or work_order_not_editable"},"422":{"description":"validation_failed"}},"security":[{"bearer":[]}],"tags":["Work Orders"]}},"/work_orders/{id}/refund":{"post":{"operationId":"work_orders_refund","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"properties":{"lines":{"default":[],"items":{"properties":{"line_item_id":{"default":0,"description":"A line of the posted counter sale","format":"int64","type":"integer"},"quantity_hundredths":{"default":0,"description":"How much of it comes back, in hundredths (1.00 = 100); at most what is not yet refunded","format":"int64","type":"integer"}},"type":"object"},"type":"array"},"reason":{"default":null,"description":"Why, in the customer's words; optional","type":["string","null"]},"refund_method":{"default":null,"description":"Hand the whole refund back by this one method (cash, debit, …) with no tenders: the\nserver fills the amount from the credit's total, so a client computes nothing","type":["string","null"]},"tenders":{"default":[],"description":"The money handed back: negative amounts, e.g. [{\"method\": \"cash\", \"amount_cents\": -3000}];\nthey must cover the refund unless to_account","items":{"description":"One payment type's share of a posting (FoxPro ARDEPOS/ARCASHD row).","properties":{"amount_cents":{"description":"Cents: > 0 on a balance owed; < 0 (money handed back) on a credit order\nwhose balance is negative. Never zero.","format":"int64","type":"integer"},"card_last4":{"description":"The card's last 4 digits (plan 1680); only on a card method","type":["string","null"]},"method":{"description":"cash | cheque | debit | visa | mastercard | amex | other","type":"string"},"reference":{"default":null,"description":"Cheque or authorization number","type":["string","null"]}},"required":["method","amount_cents"],"type":"object"},"type":"array"},"to_account":{"default":false,"description":"Keep the refund as the customer's shop credit instead (not for a walk-in)","type":"boolean"}},"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the posted counter credit: `{credit: {id, work_order_number, total_cents, kind, credit_of_work_order_id}, lines: [{line_item_id, original_line_item_id, quantity_hundredths}]}`"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized"},"404":{"description":"not found"},"409":{"description":"not_a_counter_sale, not_posted, conflict (the credit could not be posted), or idempotency_key_reused"},"422":{"description":"invalid lines, quantities or tenders"}},"security":[{"bearer":[]}],"summary":"`POST /work_orders/{id}/refund` (plan 1537): refund lines of a posted counter sale.","tags":["Work Orders"]}},"/work_orders/{id}/reopen":{"post":{"operationId":"work_orders_reopen","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"work order reopened"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized"},"404":{"description":"not found"},"409":{"description":"invalid transition, imported_history (an invoice imported from the previous system), manual_invoice (a manual invoice is corrected with a manual credit)"},"422":{"description":"posting_window (the invoice date is outside the posting window) or invalid request"}},"security":[{"bearer":[]}],"tags":["Work Orders"]}},"/work_orders/{id}/reprice":{"post":{"operationId":"work_orders_reprice","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RepriceBody"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the estimate with its new totals and `repriced_lines`"},"401":{"description":"unauthenticated"},"403":{"description":"needs work_orders.post, or another location's order"},"404":{"description":"not found"},"409":{"description":"not an estimate"},"422":{"description":"level is not 0 to 4"}},"security":[{"bearer":[]}],"tags":["Work Orders"]}},"/work_orders/{id}/scanned_parts":{"post":{"operationId":"work_orders_add_scanned_parts","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"properties":{"extraction_id":{"description":"The stored extraction (packing slip) the lines were read from (`attachments.extract`)","format":"int64","type":"integer"},"lines":{"description":"The extraction's line indices to add, in the order shown to the user","items":{"format":"int64","type":"integer"},"type":"array"},"service_id":{"default":null,"description":"The job (service) the lines belong to; default the order's lines on no service","format":"int64","type":["integer","null"]},"status":{"default":null,"description":"`ordered` (the default) or `received`: the part state to mark the lines with","type":["string","null"]}},"required":["extraction_id","lines"],"type":"object"}}},"required":false},"responses":{"201":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the part lines added and the order's new total"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized or another location's work order"},"404":{"description":"not found"},"409":{"description":"already_posted or work_order_not_editable"}},"security":[{"bearer":[]}],"tags":["Work Orders"]}},"/work_orders/{id}/service_sources":{"get":{"operationId":"work_orders_service_sources","parameters":[{"description":"words to look for; blank: everything","in":"query","name":"q","required":false,"schema":{"type":"string"}},{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"{items: [{kind (concern, package, declined, history), id, title, subtitle, total_cents}]}"},"401":{"description":"unauthenticated"},"403":{"description":"another location's work order"},"404":{"description":"not found"}},"security":[{"bearer":[]}],"tags":["Work Orders"]}},"/work_orders/{id}/services":{"get":{"operationId":"work_order_services_list","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"items":{"type":"object"},"type":"array"}}},"description":"services for the work order"},"401":{"description":"unauthenticated"},"403":{"description":"another location's work order"},"422":{"description":"invalid request"}},"security":[{"bearer":[]}],"tags":["Work Orders"]},"post":{"operationId":"work_order_services_create","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ServiceCreateBody"}}},"required":true},"responses":{"201":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"service created (attrs), or started from a source (from: {kind, id})"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized or another location's work order"},"409":{"description":"already_posted or work_order_not_editable"},"422":{"description":"invalid request"}},"security":[{"bearer":[]}],"tags":["Work Orders"]}},"/work_orders/{id}/services/packages":{"post":{"operationId":"work_orders_apply_package","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"properties":{"fox":{"default":false,"description":"Sent by the FoxPro view: the old program's apply, unless the location turns on\n`fox.package_labour_times` (spec 2026-10-30 §3, D6). Default false.","type":"boolean"},"package_id":{"description":"Package id to apply","format":"int64","type":"integer"},"technician_id":{"default":null,"description":"Technician for every labour line of the package (legacy SEROSPEC asks\nonce). Required when the package has a priced labour line and the shop\nhas an active technician.","format":"int64","type":["integer","null"]}},"required":["package_id"],"type":"object"}}},"required":false},"responses":{"201":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"service created from package"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized or another location's work order"},"404":{"description":"not found"},"409":{"description":"already_posted or work_order_not_editable"}},"security":[{"bearer":[]}],"tags":["Work Orders"]}},"/work_orders/{id}/services/reorder":{"patch":{"operationId":"work_order_services_reorder","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReorderBody"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"items":{"type":"object"},"type":"array"}}},"description":"reordered service list"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized or another location's work order"},"409":{"description":"already_posted or work_order_not_editable"},"422":{"description":"invalid request"}},"security":[{"bearer":[]}],"tags":["Work Orders"]}},"/work_orders/{id}/services/{sid}/line_items":{"get":{"operationId":"work_order_service_line_items_list","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}},{"in":"path","name":"sid","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"items":{"type":"object"},"type":"array"}}},"description":"line items for the service"},"401":{"description":"unauthenticated"},"403":{"description":"another location's work order"},"404":{"description":"service not found"},"422":{"description":"service does not belong to this work order"}},"security":[{"bearer":[]}],"tags":["Work Orders"]},"post":{"operationId":"work_order_service_line_items_create","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}},{"in":"path","name":"sid","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CrudBody"}}},"required":true},"responses":{"201":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"line item created"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized or another location's work order"},"404":{"description":"service not found"},"409":{"description":"already_posted or work_order_not_editable"},"422":{"description":"service does not belong to this work order"}},"security":[{"bearer":[]}],"tags":["Work Orders"]}},"/work_orders/{id}/services/{sid}/line_items/reorder":{"post":{"operationId":"work_order_service_line_items_reorder","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}},{"in":"path","name":"sid","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReorderBody"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"items":{"type":"object"},"type":"array"}}},"description":"reordered line item list"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized or another location's work order"},"404":{"description":"service not found"},"409":{"description":"already_posted or work_order_not_editable"},"422":{"description":"invalid request"}},"security":[{"bearer":[]}],"tags":["Work Orders"]}},"/work_orders/{id}/services/{sid}/sublet_orders":{"get":{"operationId":"work_order_service_sublet_orders_list","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}},{"in":"path","name":"sid","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"items":{"type":"object"},"type":"array"}}},"description":"sublet orders for the service"},"401":{"description":"unauthenticated"},"403":{"description":"another location's work order"},"404":{"description":"service not found"},"422":{"description":"service does not belong to this work order"}},"security":[{"bearer":[]}],"tags":["Work Orders"]},"post":{"operationId":"work_order_service_sublet_orders_create","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}},{"in":"path","name":"sid","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CrudBody"}}},"required":true},"responses":{"201":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"sublet order created"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized or another location's work order"},"404":{"description":"service not found"},"409":{"description":"already_posted or work_order_not_editable"},"422":{"description":"service does not belong to this work order"}},"security":[{"bearer":[]}],"tags":["Work Orders"]}},"/work_orders/{id}/share_links":{"delete":{"operationId":"share_links_revoke","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"`{revoked}`: how many links stopped working"},"403":{"description":"needs messages.send"}},"security":[{"bearer":[]}],"tags":["Messages"]},"get":{"operationId":"share_links_list","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"items":{"type":"object"},"type":"array"}}},"description":"the order's approval links, newest first"}},"security":[{"bearer":[]}],"tags":["Messages"]},"post":{"operationId":"share_links_create","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{}}},"required":true},"responses":{"201":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"`{link, url}`; url is null on a replay of the key"},"403":{"description":"needs messages.send"},"422":{"description":"no_customer"}},"security":[{"bearer":[]}],"tags":["Messages"]}},"/work_orders/{id}/start":{"post":{"operationId":"work_orders_start","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"work order started"},"401":{"description":"unauthenticated"},"404":{"description":"not found"},"409":{"description":"invalid transition"},"422":{"description":"invalid request"}},"security":[{"bearer":[]}],"tags":["Work Orders"]}},"/work_orders/{id}/sublet_orders":{"get":{"operationId":"work_order_sublet_orders_list","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"items":{"type":"object"},"type":"array"}}},"description":"every sublet order of the work order, in entry order"},"401":{"description":"unauthenticated"},"404":{"description":"work order not found"}},"security":[{"bearer":[]}],"tags":["Work Orders"]},"post":{"operationId":"work_order_sublet_orders_create","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CrudBody"}}},"required":true},"responses":{"201":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"sublet order created under the order's first service (created when the order has none)"},"401":{"description":"unauthenticated"},"404":{"description":"work order not found"},"422":{"description":"validation failed"}},"security":[{"bearer":[]}],"tags":["Work Orders"]}},"/work_orders/{id}/summary":{"get":{"operationId":"work_orders_summary","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"a short plain-text, customer-ready summary: `{work_order_id, work_order_number, phase, text}`; sell prices and stored totals only, never a cost"},"401":{"description":"unauthenticated"},"403":{"description":"the order is outside the user's location"},"404":{"description":"work order not found"}},"security":[{"bearer":[]}],"tags":["Work Orders"]}},"/work_orders/{id}/take":{"post":{"operationId":"work_orders_take","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"properties":{"release":{"default":false,"description":"Give it back: clear the taker. Default `false`.","type":"boolean"},"technician_id":{"default":null,"description":"The technician to assign. Omit: the caller's own (via `technicians.user_id`).","format":"int64","type":["integer","null"]}},"required":[],"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"the order's taker: id, number, technician_id, taken_by, taken_at, previous_technician_id, changed"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized"},"404":{"description":"not found"},"409":{"description":"not an estimate or an open order"},"422":{"description":"no technician linked, or an unknown technician_id"}},"security":[{"bearer":[]}],"tags":["Work Orders"]}},"/work_orders/{id}/tire_swap":{"post":{"operationId":"tires_swap","parameters":[{"description":"work order id","in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"properties":{"mount_set_id":{"default":0,"description":"The set to put on the vehicle","format":"int64","type":"integer"},"store_slot_id":{"default":null,"description":"Where the set coming off goes; omitted = home with the customer","format":"int64","type":["integer","null"]}},"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"`{mounted, removed}`: the set going on and the one coming off"},"401":{"description":"unauthenticated"},"403":{"description":"forbidden (needs work_orders.write)"},"404":{"description":"no such work order or set"},"409":{"description":"invalid_transition: the order is not open"},"422":{"description":"validation_failed: mount_set_id, store_slot_id"}},"security":[{"bearer":[]}],"tags":["Tires"]}},"/work_orders/{id}/void":{"post":{"operationId":"work_orders_void","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"properties":{"closure_reason":{"description":"Optional reason for voiding","type":["string","null"]},"code":{"default":null,"description":"Optional code: entered_in_error, duplicate, no_show, customer_cancelled, other. Never\nask the user for one. An unknown code is stored as other.","type":["string","null"]},"payments_to_credit":{"default":false,"description":"Plan 1089: when the order holds payments, keep them as the customer's shop credit and\ndecline (void) anyway. Without it an order with payments is refused, as before.","type":"boolean"},"reason":{"default":null,"description":"Why the order is cancelled (plan 104). Wins over `closure_reason`.","type":["string","null"]}},"required":[],"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"work order cancelled"},"401":{"description":"unauthenticated"},"403":{"description":"not authorized"},"404":{"description":"not found"},"409":{"description":"posted, declined, already cancelled, or changed concurrently"},"422":{"description":"invalid request"}},"security":[{"bearer":[]}],"tags":["Work Orders"]}}},"tags":[{"description":"Health and API metadata","name":"Meta"},{"description":"Authentication and sessions","name":"Auth"},{"description":"The shop's plan, monthly charge and usage","name":"Billing"},{"description":"Work order operations","name":"Work Orders"},{"description":"The change feed","name":"Events"},{"description":"Customer accounts","name":"Customers"},{"description":"Work order payments, refunds, and voids","name":"Payments"},{"description":"Customer vehicles","name":"Vehicles"},{"description":"The number beside each page of an area","name":"Pages"},{"description":"Parts catalog","name":"Parts"},{"description":"Vendors: look-ups, edits and payment terms","name":"Vendors"},{"description":"The chart of accounts: list and edits","name":"Chart of Accounts"},{"description":"The general ledger: entries, settings and the lock date","name":"Ledger"},{"description":"Payroll: settings, employees, time cards, pay runs","name":"Payroll"},{"description":"Bills, expenses and bill payments (accounts payable)","name":"Bills"},{"description":"The QuickBooks Online connection, sync start, maps and QBO lists","name":"QuickBooks"},{"description":"Bank statements, matching to the ledger, and reconciliation","name":"Bank"},{"description":"Maintenance appointment codes, appointments and what is due on an order","name":"Appointments"},{"description":"Labour rate templates","name":"Labor Templates"},{"description":"Bay technicians","name":"Technicians"},{"description":"Push notification device registrations","name":"Devices"},{"description":"Service packages","name":"Packages"},{"description":"Global cross-entity search","name":"Search"},{"description":"Shop locations","name":"Locations"},{"description":"Per-location workflow configuration","name":"Workflow Config"},{"description":"Generic resource CRUD","name":"Resources"},{"description":"Account user management","name":"Users"},{"description":"Background job monitor","name":"Jobs"},{"description":"Assistant chat","name":"Assistant"},{"description":"Named, revocable agent credentials","name":"Agent Tokens"},{"description":"Operation registry catalog and dispatch","name":"Tools"},{"description":"Read-only server-computed reports","name":"Reports"},{"description":"Photos on work orders and parts","name":"Attachments"}]}