Borrowing API
Borrowing sheets (replacing the paper process) and external borrowers.
Sheet lifecycle: draft → pending_approval → checked_out → partially_returned → returned (+ cancelled
before checkout). Sheet ARN: atl:borrowing:<site>:sheet/<id>; the site (atl:settings:<site>:site/<site>)
and, when set, the project (atl:projects:<site>:project/<id>) are passed to authz as parents.
Checkout, return and signature files are uploaded through the files service with the sheet ARN as owner.
Items are validated against inventory with the caller principal (they must be available on the sheet
site and not held by another checked out sheet).
Access: the member borrower and the creator of a sheet may always read and act on it (edit, submit,
cancel, detect, return). Otherwise borrowing.sheet.read / borrowing.sheet.update apply, with
borrowing.sheet.read_all (elevated, admin mode) and borrowing.sheet.approve (approvers) as read
fallbacks. A draft may be created without items (e.g. to upload photos for a QR detection); submitting
requires at least one item. Approval needs
borrowing.sheet.approve and a human member; a member borrower may approve their own sheet.
Lists are filtered with the Lookup scope of borrowing.sheet.read (plus read_all in admin mode)
and always include the caller's own sheets.
External persons (ARN atl:borrowing:*:person/<id>, parents: their sites) need
borrowing.person.manage. Their identity (names, birth date, contact) is encrypted per person and
the ID document photo is stored sealed in a dedicated bucket. Identity data and the photo are only
served by GET /persons/{id}/identity and GET /persons/{id}/photo, which require
borrowing.identity.read (sensitive) and a passkey step-up within 15 minutes; every access is audited.
The photo is streamed, never exposed through a presigned URL. Retention: once a person has no
unresolved sheet, the photo and contact are deleted after BORROWING_ID_PHOTO_RETENTION (default 1 day,
status archived), names and birth date are crypto-shredded after BORROWING_ARCHIVE_RETENTION
(default 5 years, status erased; sheets then show a pseudonym). Nothing is deleted while a sheet
is unresolved.
Events: borrowing.sheet.v1 (created, updated, submitted, approved, checked_out
{sheet_id, site_id, item_ids}, items_returned {sheet_id, item_ids}, returned, cancelled),
borrowing.person.v1 (created, updated, photo_replaced, reactivated, archived, shredded;
identity fields sealed), borrowing.reminder.v1 (due_soon, overdue; identifiers only).
Authentication
- API Key: session
- HTTP: Bearer Auth
Security Scheme Type: | apiKey |
|---|---|
Cookie parameter name: | atl_session |
Security Scheme Type: | http |
|---|---|
HTTP Authorization Scheme: | bearer |