seahaven-ap/packages/api/openapi/paths/invoices.yaml

106 lines
3 KiB
YAML

get:
tags: [Invoices]
summary: List invoices
description: Returns invoices with their coding lines.
operationId: get-api-invoices
responses:
"200":
description: Invoice list.
content:
application/json:
schema:
type: object
required: [items]
properties:
items:
type: array
items:
$ref: ../components/schemas.yaml#/Invoice
"401":
description: Missing session.
content:
application/json:
schema:
$ref: ../components/schemas.yaml#/Error
post:
tags: [Invoices]
summary: Create an invoice
description: Inserts an invoice. Line amounts must sum to amount when lines are sent. Duplicate active vendor plus invoice number is a conflict.
operationId: post-api-invoices
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [vendorId, invoiceNumber, amount, dueDate]
properties:
vendorId:
type: string
format: uuid
example: 55555555-5555-4555-8555-555555555555
invoiceNumber:
type: string
example: INV-2002
amount:
type: string
example: "100.00"
dueDate:
type: string
example: "2026-10-01"
paymentMethod:
type: string
enum: [check, ach]
example: check
memo:
type: string
example: Harbor repair
lines:
type: array
items:
type: object
required: [description, amount]
properties:
description:
type: string
example: Labor
amount:
type: string
example: "100.00"
glAccountId:
type: string
format: uuid
departmentId:
type: string
format: uuid
responses:
"201":
description: Created invoice.
content:
application/json:
schema:
$ref: ../components/schemas.yaml#/Invoice
"400":
description: Validation failed.
content:
application/json:
schema:
$ref: ../components/schemas.yaml#/Error
"401":
description: Missing session.
content:
application/json:
schema:
$ref: ../components/schemas.yaml#/Error
"403":
description: Caller lacks write:invoices.
content:
application/json:
schema:
$ref: ../components/schemas.yaml#/Error
"409":
description: Active vendor and invoice number already exist.
content:
application/json:
schema:
$ref: ../components/schemas.yaml#/Error