Skip to main content

Invoices

Invoices represent a formal statement issued by a seller to a buyer, which indicates the quantities and costs of the products or services provided by the vendor.

Schema​

Invoice​

NameTypeDescriptionExample
idIDUnique identifier for invoices"ckmnpybisiy5x08abky4g2d1f"
createdAtDateTimeWhen this invoice was created"2021-03-24 17:26:46.983Z"
createdByIdIDID of the user who created this invoice"ckmnpybisiy5x08abky4g2d1f"
updatedAtDateTimeWhen this invoice was updated"2021-03-24 17:26:46.983Z"
deletedAtDateTime?When this invoice was deleted"2021-03-24 17:26:46.983Z"
titlestring?Title of the invoice"Invoice 1234"
approvedAtDateTime?When this invoice was approved"2021-03-24 17:26:46.983Z"
approvedByIdID?ID of the user who approved this invoice"ckmnpybisiy5x08abky4g2d1f"
categoryInvoiceCategory?Category of the invoice"miscellaneous"
dueDateDateTime?When a payment for the invoice is due"2021-03-24 17:26:46.983Z"
invoiceDateDateTime?When this invoices was issued by the vendor"2021-03-24 17:26:46.983Z"
exceptionsstring[]Array indicating which fields in the invoice have exceptions or discrepancies["totalDue","subtotal"]
flaggedAtDateTime?When this invoice was flagged"2021-03-24 17:26:46.983Z"
flaggedByIdID?ID of the user who flagged this invoice"ckmnpybisiy5x08abky4g2d1f"
flagMessagestring?User's description of the flagged issue with this invoice"This invoice is important"
invoiceNumberstring?User-defined value to identify this invoice"Invoice-1234"
paidAtDateTime?When this invoice was paid"2021-03-24 17:26:46.983Z"
paidByIdID?ID of the user who made a payment for this invoice"ckmnpybisiy5x08abky4g2d1f"
paymentsfloat?The amount of payments on the invoice20.55
rejectedAtDateTime?When this invoice was rejected"2021-03-24 17:26:46.983Z"
rejectedByIdID?ID of the user who rejected this invoice"ckmnpybisiy5x08abky4g2d1f"
rejectedReasonstring?Reason provided by the user for rejecting the invoice"Created by accident"
salespersonstring?Salesperson associated with this invoice"Mikey P."
shipDateDateTime?Date when the products stated in the invoice were shipped"2021-03-24 17:26:46.983Z"
shippingCostFloatfloat?The cost of shipping20.55
shipViastring?Method of shipment"Boat"
stateInvoiceStateThe current state of the invoicePENDING
integrationStateIntegrationStateThe synchronization status between the invoice and the integrated systemLINKED
integrationMessagestring?A message about the status of the integration's sync"GL Code is required for item 1"
attachmentsFile[]The files associated with the invoiceSee File[]
subtotalfloat?Subtotal of the invoice before addition of other costs such as taxes20.55
taxfloat?The amount of tax on the invoice20.55
termsstring?Terms of payment for the invoice"CBS"
totalDuefloat?The total amount due20.55
voidedAtDateTime?When this invoice was voided"2021-03-24 17:26:46.983Z"
voidedByIdID?ID of the user who voided the invoice"ckmnpybisiy5x08abky4g2d1f"

Enums​

InvoiceCategory​

ValueDescription
genContractorInvoice is for a general contractor
materialInvoice is for materials
miscellaneousInvoice falls under miscellaneous expenses
rentalsInvoice is for rentals

InvoiceState​

ValueDescription
APPROVEDInvoice has been approved
CLOSEDInvoice has been settled and is no longer active
INBOXInvoice is new
PENDINGInvoice needs to be reviewed and approved

IntegrationState​

ValueDescription
NOT_LINKEDThe invoice is not linked to any integrated system, either because no integration is configured or because no attempt has been made to link it
LINKINGLinking to the other system is in progress
LINKEDThe invoice was successfully linked to the other system
ERRORAn error occurred while trying to sync the invoice to the other system. When this state is used, it's helpful to set an integrationMessage explaining the problem to the user.

Note: The only Scalar Filter that IntegrationState currently supports is integrationState_in.

File​

NameTypeDescriptionExample
idIDUnique identifier for the file"ckmnpybisiy5x08abky4g2d1f"
namestring?Name of the file"document.pdf"
createdAtDateTimeWhen this file was created"2024-09-03T12:00:00Z"
updatedAtDateTimeWhen this file was last updated"2024-09-03T12:00:00Z"
urlstring?URL where the file can be accessed"https://example.com/file1.pdf"

REST Endpoints​

GET /invoices​

Read all invoices, with pagination.

Parameters​

Accepts all standard pagination parameters.

Allowed orderBy fields: approvedAt, createdAt, flaggedAt, id, invoiceDate, paidAt, rejectedAt, shipDate, updatedAt, voidedAt.

Allowed filter fields: approvedAt, createdAt, category, flagged, flaggedAt, id, invoiceDate, invoiceNumber, paidAt, rejectedAt, shipDate, state, integrationState_in, taxExempt, type, updatedAt, voidedAt.

Accepts an includeDeleted boolean parameter which determines if deleted invoices will be returned (e.g. ?includeDeleted=true). By default, deleted invoices are not returned.

Response​

A list of Invoice objects.

Example Request​

GET https://api.kojo.tech/invoices?limit=10

Example Response​

[
{
"id": "ckmnpybisiy5x08abky4g2d1f",
"title": null,
"createdAt": "2021-03-24 17:26:46.983Z",
"updatedAt": "2021-03-24 17:26:46.983Z",
"approvedAt": null,
"approvedById": null,
"category": "miscellaneous",
"createdById": "clj3k7gl90003ajlj45ld2xdx",
"dueDate": null,
"invoiceDate": "2020-06-26T00:00:00.000Z",
"exceptions": ["totalDue"],
"flaggedAt": null,
"flaggedById": null,
"flagMessage": null,
"invoiceNumber": "S060988116",
"paidAt": null,
"paidById": null,
"payments": null,
"rejectedAt": null,
"rejectedById": null,
"rejectedReason": null,
"salesperson": null,
"shipDate": null,
"shippingCostFloat": null,
"shipVia": null,
"state": "PENDING",
"subtotal": 1328.22,
"tax": 79.69,
"terms": null,
"totalDue": 1407.91,
"voidedAt": null,
"voidedById": null
}
]

GET /invoices/:id​

Reads a single invoice by ID

Parameters​

NameDescriptionExample
idThe ID of the invoice to fetch"ckmnpybisiy5x08abky4g2d1f"

Response​

A single Invoice.

Example Request​

GET https://api.kojo.tech/invoices/ckmnpybisiy5x08abky4g2d1f

Example Response​

{
"id": "ckmnpybisiy5x08abky4g2d1f",
"title": null,
"createdAt": "2021-03-24 17:26:46.983Z",
"updatedAt": "2021-03-24 17:26:46.983Z",
"approvedAt": null,
"approvedById": null,
"category": "miscellaneous",
"createdById": "clj3k7gl90003ajlj45ld2xdx",
"dueDate": null,
"invoiceDate": "2020-06-26T00:00:00.000Z",
"exceptions": ["totalDue"],
"flaggedAt": null,
"flaggedById": null,
"flagMessage": null,
"invoiceNumber": "S060988116",
"paidAt": null,
"paidById": null,
"payments": null,
"rejectedAt": null,
"rejectedById": null,
"rejectedReason": null,
"salesperson": null,
"shipDate": null,
"shippingCostFloat": null,
"shipVia": null,
"state": "PENDING",
"subtotal": 1328.22,
"tax": 79.69,
"terms": null,
"totalDue": 1407.91,
"voidedAt": null,
"voidedById": null
}

POST /invoices/paid​

Marks invoices as paid.

Parameters​

NameDescriptionExample
idsAn array of invoice IDs to mark as paid["ckmnpybisiy5x08abky4g2d1f"]
userIdThe ID of the user marking the invoices as paid"clj3k7gl90003ajlj45ld2xdx"

Response​

A list of Invoice objects.

Example Request​

POST https://api.kojo.tech/invoices/paid
Content-Type: application/json

{
"ids": ["ckmnpybisiy5x08abky4g2d1f"],
"userId": "clj3k7gl90003ajlj45ld2xdx"
}

Example Response​

[
{
"id": "ckmnpybisiy5x08abky4g2d1f",
"title": null,
"createdAt": "2021-03-24 17:26:46.983Z",
"updatedAt": "2021-03-24 17:26:46.983Z",
"approvedAt": "2021-03-24 17:26:46.983Z",
"approvedById": "clj3k7gl90003ajlj45ld2xdx",
"category": "miscellaneous",
"createdById": "clj3k7gl90003ajlj45ld2xdx",
"dueDate": null,
"invoiceDate": "2020-06-26T00:00:00.000Z",
"exceptions": ["totalDue"],
"flaggedAt": null,
"flaggedById": null,
"flagMessage": null,
"invoiceNumber": "S060988116",
"paidAt": "2021-03-24 17:26:46.983Z",
"paidById": "clj3k7gl90003ajlj45ld2xdx",
"payments": null,
"rejectedAt": null,
"rejectedById": null,
"rejectedReason": null,
"salesperson": null,
"shipDate": null,
"shippingCostFloat": null,
"shipVia": null,
"state": "CLOSED",
"subtotal": 1328.22,
"tax": 79.69,
"terms": null,
"totalDue": 1407.91,
"voidedAt": null,
"voidedById": null
}
]