Flow
ServicesVendors Service

API

The vendors service's routes, who may call each one, and the refusals worth knowing about.

Every command takes the usual envelope, {"data": {...}}, and an Idempotency-Key header. The spec is services/vendors/openapi.yaml.

RouteWhat it does
POST /v1/vendors, GET /v1/vendorsAdd a firm; list firms by name, filtered by status, kind, part of the name (q), or a comma-separated list of up to 100 ids
GET /v1/vendors/{id}One firm with its people and its insurance now
POST /v1/vendors/{id}/statusMark a firm active or inactive
POST /v1/vendors/{id}/contacts, /contacts/{contact_id}/activeAdd a person who may sign in to the vendor portal; let them sign in or stop them
POST /v1/vendors/{id}/insurance, GET /v1/vendors/{id}/insuranceRecord a certificate; list every certificate the firm has given
GET /v1/vendor-insuranceEvery active firm's latest certificate for each coverage, soonest expiry first, filtered by status and coverage
GET /v1/vendor-portal/contactThe signed-in vendor portal user: their firm, themselves and their colleagues

Who may call

CallerHow they prove itWhat they may do
A Flow employeeThe Cloudflare Access token for the internal application (VENDORS_ACCESS_AUD)Read everything; change anything if named in VENDORS_EDITORS
A firm's contactThe vendor portal's Access token (VENDORS_PORTAL_ACCESS_AUD), on /v1/vendor-portal/ onlyLearn which firm they sign in for
Another Flow serviceX-Flow-Service-Token matching VENDORS_SERVICE_TOKEN, with X-Flow-On-Behalf-Of naming the personRead, for that person; never change anything

A service token on a /v1/vendor-portal/ route acts for the named contact; construction uses it after checking that contact's portal token itself.

Refusals

StatusCodeWhat happened
403not_a_vendor_contactThe portal user is not an active contact of an active firm
409vendor_existsA firm with that name exists, ignoring case
409contact_existsThat email is already a contact, at this firm or another
409insurance_existsThat firm already has that certificate: same coverage, policy number and start date
422A certificate that expires before it starts, an unknown coverage, kind or discipline, or ids naming more than 100 firms

Events

Published through the outbox to Service Bus. No event carries a contact's email or name.

EventWhen
vendor.registeredA firm was added
vendor.status_changedA firm was marked active or inactive
vendor.contact_addedA person was added to a firm
vendor.contact_access_changedA person was allowed to sign in, or stopped
vendor.insurance_recordedA certificate was recorded

On this page