Skip to main content

Orders

Orders, also known as purchase orders, track the costs and details surrounding a request for materials, equipment, or other job costs.

Schema

Order

NameTypeDescriptionExample
idIDUnique identifier for orders"ckmnpybisiy5x08abky4g2d1f"
createdAtDateTimeWhen this order was created"2021-03-24 17:26:46.983Z"
createdByUser❌ Not implemented The user who created the orderSee User docs
deliveryInstructionsstring?Additional instructions for how to deliver the items"Gate code is 1234"
deliveryLocationLocation?Delivery location for orderSee Location docs
discountfloat?The dollar amount of discounts to subtract from the order total125.60
fieldContactNamestring?Name of the field contact receiving the order"John Doe"
fieldContactPhonestring?Phone number of the field contact receiving the order"8001854367"
flaggedbooleanTracks whether the order has been flagged with an issuetrue
flaggedAtDateTime?The date/time this order was flagged"2021-03-24 17:26:46.983Z"
flagMessagestring?User's description of the flagged issue with this order"Missing items"
glCodeGLCode?The default GL code to use for items in this orderSee GL Code docs
integrationLastSyncDateTime?(Read-only) Last time the order's integrationState was updated to LINKED"2021-03-24 17:26:46.983Z"
integrationMessagestring?A message about the status of the integration's sync"PO number already exists"
integrationStateIntegrationState?The status of the order's sync to another integrated systemNOT_LINKED
jobJob?The job this order belongs toSee Job docs
modeOrderModeThe mode the order originated inREQUEST_FOR_QUOTE
attachmentsOrderAttachment[]The attachments associated with the orderSee OrderAttachment[]
needByDateDayDateTime?The date the order is needed by"2021-03-24 17:26:46.983Z"
needByWindowNeedByWindowWindow the order should be delivered byPMLate
notesstring?Additional handwritten details attached to this order"Call when arrives"
purchaseOrderNumberstring?User-defined value to identify this order"1234"
purchasingAgentUser❌ Not implemented User at buyer organization responsible for reconciling the orderSee User docs
itemsItem[]The line items in the orderSee Item docs
requisitionIdsID[]?The IDs of any Requisitions that this Order is sourced from["ckmnpybisiy5x08abky4g2d1f"]
shippingCostfloat?The dollar amount of shipping costs to add to the order total1200.30
stateOrderStateThe current state of the orderBID_ACTIVE
taxCodeTaxCode?The default tax code to use for items in this orderSee Tax Code docs
taxExemptbooleanIndicates that the order is exempt from any and all tax rates entered on line itemstrue
typeOrderTypeType of order, either STANDARD or HOLD_FOR_RELEASESTANDARD
updatedAtDateTimeWhen this order was last updated"2021-03-24 17:26:46.983Z"
updatedByUser?❌ Not implemented The user who last edited the orderSee User docs
vendorVendor?The vendor associated with this orderSee Vendor docs
createdByIdIDThe user id who created the order"ckmnpybisiy5x08abky4g2d1f"
updatedByIdIDThe user id who last updated the order"ckmnpybisiy5x08abky4g2d1f"
receivedStateReceivedStateThe Deliveries state"FULLY_RECEIVED"
customColumnValuestring?Value associated with the custom column"438076873"
hasDraftChangeOrderbooleanIndicates if the order has a currently open draft change ordertrue

Enums

IntegrationState

ValueDescription
NOT_LINKEDAll orders start in this un-linked state
LINKINGLinking to the other system is in progress
LINKEDThe order was successfully linked to the other system
OUT_OF_SYNCIf a change is made to an order in Kojo after it is LINKED, Kojo will update the order to this status
ERRORAn error occurred while trying to sync the order 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.

ReceivedState

ValueDescription
NO_DELIVERIESNo deliveries submited yet.
PARTIALLY_RECEIVEDDeliveries were submited but there still items to be received
FULLY_RECEIVEDAll items have been received

NeedByWindow

ValueDescription
ASAPAs soon as possible
AMEarlyEarly morning
AMMorning
PMAfternoon
PMLateLate Afternoon
UNSPECIFIEDUnspecified

OrderMode

ValueDescription
ISSUE_POOrder is issued to a single vendor
PRE_ACKNOWLEDGEDOrder is pre-acknowledged by the vendor outside Kojo
REQUEST_FOR_QUOTEOrder is issued to multiple vendors for quotes

OrderState

ValueDescription
DRAFTAll orders start in draft
BID_ACTIVEIn bid state
BID_CANCELLEDIf an RFQ has been cancelled
FINALIZINGOrder has been sent but not acknowledged
ACTIVEOrder has been acknowledged
CANCELLEDOrder has been cancelled
COMPLETEOrder has been completed

OrderAttachment

NameTypeDescriptionExample
idIDUnique identifier for the attachment"ckmnpybisiy5x08abky4g2d1f"
createdAtDateTimeThe date and time when the attachment was created"2024-09-03T12:00:00Z"
updatedAtDateTimeThe date and time when the attachment was last updated"2024-09-03T12:00:00Z"
identifierstring?Optional unique identifier for the attachment"invoice-1234"
fileFileThe file associated with the attachment. May include details such as URL or metadata.
lastSyncAtDateTimeThe date and time when the attachment was last synced"2024-09-03T12:00:00Z"
syncedBystringA service name which performed the sync"api-sync-order-attachments"

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"

OrderType

ValueDescription
HOLD_FOR_RELEASEA hold for release (HFR) order, also referred to as a buyout
STANDARDA standard order

OrderInput

NameTypeDescriptionExample
fieldContactNamestring?The name of the field person who will receive this order"John Doe"
fieldContactPhonestring?A valid phone number for the field person who will receive this order"800-185-4367"
purchaseOrderNumberstringA unique string to represent this purchase order"PO-1234"
needByDateDayDateTime?When this order is needed by"2021-03-24 17:26:46.983Z"
needByWindowNeedByWindowWindow the order should be delivered by"AMEarly"
deliveryInstructionsstring?Additional instructions for how to deliver the items"Gate code is 1234"
distributorContactNamestring?The name of the distributor this order will be sent to"Jane Distributor"
distributorContactEmailstringA valid email address for the distributor associated with this purchase order"jane@distributor.com"
distributorContactPhonestring?A valid phone number for the distributor associated with this purchase order"800-185-4367"
distributorContactCompanystringThe name of the company for the distributor associated with this purchase order"Electric Supply Co."
isVisibileToFieldboolean?Whether or not field users of Kojo can see this purchase ordertrue
notesstring?Additional handwritten details attached to this order"Expedite please"
discountfloat?The dollar amount of discounts to subtract from the order total125.60
shippingCostfloat?The dollar amount of shipping costs to add to the order total1200.30
taxExemptboolean?Indicates that the order is exempt from any and all tax rates entered on line itemstrue
titlestring?The title for this purchase order in KOJO"Extra Conduit Order"
deliveryLocationIdID?The id of delivery location for this order"ckmnpybisiy5x08abky4g2d1f"
jobIdID?The id of the job for this order"ckmnpybisiy5x08abky4g2d1f"
vendorIdID?The id of the vendor for this order"ckmnpybisiy5x08abky4g2d1f"
createdByIdID?The user id of the procurement representative for this order"ckmnpybisiy5x08abky4g2d1f"
stateOrderStateThe state of the orderACTIVE

ItemInput

NameTypeDescriptionExample
lineNumberintNumber representing the index of the line item within it's order3
quantityfloat?Quantity of this item100
unitsOfMeasurestring?Unit of measurement for this item"BX"
descriptionstring?Description of the item"3/4 in EMT"
manufacturerstring?Name of the manufacturer for this item"Bob's Manufacturing"
manufacturerPartNumberstring?Manufacturer part number for this item (MPN)"3456377"
notesstring?Additional handwritten details attached to this item"Brand/Model subs ok"
universalProductCodestring?Universal product code for this item (UPC)"037000754770"
needByDateDateTime?When this item is needed by"2021-03-24 17:26:46.983Z"
unitDiscountfloat?Discount percent being applied to the item (precision of 13)1.25
unitPricefloat?Unit price of the item1.25
backorderLeadTimeDateTime?Lead time for a backordered item"2021-03-24 17:26:46.983Z"
backorderQuantityfloat?Amount on backorder for a backordered item50
taxCodestring?The tax code for this item"07"
catalogIdstring?The catalog id for this item"clopaavoh000hrdr3yag0soz8"
bomItemIdID?The ID of the BillOfMaterialsItem for this order item"ckmnpybisiy5x08abky4g2d1f"

Queries

order

Reads a single order by ID. Note that orders can only be uniquely identified by this ID, as it is possible to have draft or cancelled orders with duplicated PO#'s.

Parameters

NameDescriptionExample
idThe ID of the order to fetch"ckmnpybisiy5x08abky4g2d1f"

Response

A single Order.

Example Query

query {
order(id: "ckmnpybisiy5x08abky4g2d1f") {
id
purchaseOrderNumber
}
}

Example Response

{
"id": "ckmnpybisiy5x08abky4g2d1f",
"purchaseOrderNumber": "606123",
}

orders

Read all orders, with pagination.

Parameters

Accepts all standard pagination parameters.

Allowed orderBy fields: createdAt, flaggedAt, id, needByDateDay, purchaseOrderNumber, updatedAt.

Allowed filter fields: createdAt, flagged, flaggedAt, id, integrationState_in, mode, needByDateDay, purchaseOrderNumber, state, taxExempt, type, updatedAt.

Response

A list of Order objects.

Example Query

query {
orders(
orderBy: purchaseOrderNumber,
direction: ASC,
filter: {
createdAt_lt: "2024-01-01T15:10:10"
}
) {
id
purchaseOrderNumber
createdAt
}
}

Example Response

[
{
"id": "ckmnpybisiy5x08aasdf13242",
"purchaseOrderNumber": "111444",
"createdAt": "2023-01-26T16:18:35.931Z"
},
{
"id": "ckmnpybisiy5x08abky4g2d1f",
"purchaseOrderNumber": "606123",
"createdAt": "2023-01-26T16:49:04.773Z"
}
]

getOrderTags

See getOrderTags for more information.

Mutations

updateOrderIntegrationState

Update an order's integration status.

Because of the potential complexity involved, an order's integrationState may not be updated via the standard order update endpoint. Instead, use this endpoint to modify the status of the integration link.

See the Integration Status Handling page for more information.

Parameters

NameTypeDescriptionExample
idIDUnique identifier for orders"ckmnpybisiy5x08abky4g2d1f"
integrationMessagestring?A message about the status of the integration's sync"PO number already exists"
integrationStateIntegrationStateThe new status of the order's sync to your integrated systemNOT_LINKED

Example Query

mutation {
updateOrderIntegrationState(
id: "ckmnpybisiy5x08abky4g2d1f",
integrationState: "LINKED",
integrationMessage: ""
) {
id
integrationMessage
integrationState
}
}

Example Response

{
"id": "ckmnpybisiy5x08abky4g2d1f",
"integrationState": "LINKED",
"integrationMessage": ""
}

createOrder

Create an Order

This endpoint is still in trial, so if you're interested in using it, please reach out to us!

Parameters

NameTypeDescription
orderInputOrderInputInput fields for this order
itemInputsItemInput[]Items for this order

Response

The created Order.

Example Query

mutation {
createOrder(
orderInput: {
fieldContactName: "John Doe",
fieldContactPhone: "800-185-4367",
purchaseOrderNumber: "PO-1234",
needByDateDay: "2021-03-24 17:26:46.983Z",
needByWindow: AMEarly,
deliveryInstructions: "Gate code is 1234",
distributorContactName: "Jane Distributor",
distributorContactEmail: "jane@distributor.com",
distributorContactPhone: "800-185-4367",
distributorCompanyName: "Electric Supply Co.",
jobId: "clip0pko60142q9upizqo6cpn",
requisitionId: "clo90qvh9000008mlb89d9r0c",
vendorId: "clkpv7q2v0000q96qk45m84y5",
deliveryLocationId: "clip0pkpl014tq9up1c9voj3v",
title: "Extra Conduit Order",
createdById: "clip0pk82006aq9up7vbr3v72",
state: ACTIVE
}
itemInputs:[
{
lineNumber: 1,
quantity: 20,
unitPrice: 10.00,
unitsOfMeasure: "EA",
description: "EMT Conduit",
taxCode: "07",
manufacturer: "ESC",
},
{
lineNumber: 2,
quantity: 10,
unitPrice: 5.00,
unitsOfMeasure: "FT",
description: "Blue Wire",
notes: "Brand/Model subs ok",
manufacturer: "ESC",
}
]

) {
id
purchaseOrderNumber
vendor {
name
}
deliveryLocation {
addressLine1
state
zipcode
}
items {
description
}
}
}

Example Response

{
"id": "cll2r2kf60004rhyvd0nm7tq2",
"purchaseOrderNumber": "PO-1234",
"state": "ACTIVE",
"vendor": {
"name": "ELECTRIC SUPPLY INC"
},
"deliveryLocation": {
"addressLine1": "780 S Airport Blvd",
"state": "CA",
"zipcode": "94128"
},
"items": [
{
"description": "EMT Conduit"
},
{
"description": "Blue Wire"
}
]
}

cancelOrder

Cancel an Order

This endpoint updates an Order's state to "cancelled".

Parameters

NameTypeDescription
orderIdIDID for the order to cancel
cancelledByUserIdIDID for the user who is cancelling the order

Response

The updated (cancelled) Order.

Example Query

mutation {
cancelOrder(
orderId: "clndjblx4000008mf5m8uekwt",
cancelledByUserId: "clndjbp29000108mfdzfp8vb6"
) {
id
purchaseOrderNumber
state
}
}

Example Response

{
"id": "clndjblx4000008mf5m8uekwt",
"purchaseOrderNumber": "PO-1234",
"state": "CANCELLED"
}

addNewOrExistingTagsToOrder

See addNewOrExistingTagsToOrder for more information.

removeTagFromOrder

See removeTagFromOrder for more information.

syncAttachment

Synchronize an attachment with the order.

Currently, this endpoint is only supported for Spectrum Cloud. This endpoint allows you to sync an attachment to an existing order, ensuring that the attachment is properly associated with the order in the system.

Parameters

NameTypeDescriptionExample
orderIdIDID of the order to which the attachment will be synced"clndjblx4000008mf5m8uekwt"

Response

The updated OrderAttachment with the synced attachment.

Example Query

mutation syncOrderAttachments($orderId: ID!){
syncOrderAttachments(orderId: $orderId){
id
createdAt
updatedAt
identifier
syncedBy
lastSyncAt
}
}

Example Response

{
"data": {
"syncOrderAttachments": [
{
"id": "cm66rsgb40002v7ve0x5tjbbm",
"createdAt": "2025-01-21T17:49:38.320Z",
"updatedAt": "2025-01-21T23:02:35.678Z",
"identifier": "S-0117-P1.pdf",
"lastSyncAt": "2025-01-21T23:02:35.677Z",
"syncedBy": "api-sync-order-attachments"
}
]
}
}