Skip to main content

Vendors

Vendors in Kojo represent the external business entities your business buys goods and services from. They are concepually synonomous with the concept of Vendors in many accounting systems (Spectrum, QuickBooks, etc.). An additional nuance to the concept of Vendors in Kojo are Vendor Contacts, who are specific contacts at the vendor organization.

Vendor Schema​

Vendor​

NameTypeDescriptionExample
idIDUnique identifier for orders"ckmnpybisiy5x08abky4g2d1f"
namestringUser defined name for the vendor"Dunder Mifflin"
codestringVendor Code"ACE123"
locationLocationThe location associated with this vendorSee Location docs
createdAtdateTimeWhen this object was created"2021-03-24 17:26:46.983Z"
deletedAtdateTimeWhen this object was deleted"2021-03-24 17:26:46.983Z"
updatedAtdateTimeWhen this object was last updated"2021-03-24 17:26:46.983Z"

Queries​

vendor​

Read a single vendor. You must specify either the vendor ID or the vendor code.

Parameters​

NameDescriptionExample
idThe ID of the vendor to fetch"ckmnpybisiy5x08abky4g2d1f"
codeThe code of the vendor to fetch"ACE123"

Response​

A single Vendor object.

Example Query​

query {
vendor(code: "ACE123") {
id
name
code
}
}

Example Response​

{
"id": "ckmnpybisiy5x08abky4g2d1f",
"name": "Dunder Mifflin",
"code": "ACE123"
}

vendors​

Get all vendors, with pagination.

Parameters​

Accepts all standard pagination parameters.

Allowed orderBy fields: code (default), createdAt, id, name, updatedAt.

Allowed filter fields: code, createdAt, id, name, updatedAt.

Response​

A list of Vendor objects.

Example Query​

query {
vendors(direction: ASC, orderBy: name) {
id
name
code
}
}

Example Response​

[
{
"id": "ckmnpybisiy5x08abky4g2d1f",
"name": "Dunder Mifflin",
"code": "ACE123"
},
{
"id": "ckmnpybisiy5x234klj3lk4jf",
"name": "Penn Steel",
"code": "858858"
},
]

Mutations​

createVendor​

Creates a new vendor.

Parameters​

NameTypeDescriptionExample
codestringVendor Code"ACE123"
namestringUser defined name for the vendor"Dunder Mifflin"

Response​

The created Vendor.

Example Mutation​

mutation {
createVendor(
code: "ACE123"
name: "Dunder Mifflin"
) {
code
id
name
}
}

Example Response​

{
"code": "ACE123",
"id": "ckmnpybisiy5x08abky4g2d1f",
"name": "Dunder Mifflin"
}

updateVendor​

Update a vendor.

Parameters​

NameTypeDescriptionExample
idIDID of the vendor to update"ckmnpybisiy5x08abky4g2d1f"
codestringCode of the vendor to update. If both id and code are provided, the vendor's code will be updated to this value."ACE123"
namestringUser defined name for the vendor"Dunder Mifflin"

One of id or code is required.

Response​

The updated Vendor.

Example Mutation​

mutation {
updateVendor(
id: "ckmnpybisiy5x08abky4g2d1f"
name: "Dunder Mifflin (edited)"
) {
code
id
name
}
}

Example Response​

{
"code": "ACE123",
"id": "ckmnpybisiy5x08abky4g2d1f",
"name": "Dunder Mifflin (edited)"
}

upsertVendors​

Creates or Updates multiple Vendors at once.

Parameters​

NameTypeDescription
inputsUpsertVendorInput[]A list of vendors
UpsertVendorInput​
NameTypeDescriptionExample
codestringCode of the vendor to update. If both id and code are provided, the vendor's code will be updated to this value."ACE123"
namestringUser defined name for the vendor"Dunder Mifflin"

Response​

A list of Vendors.

Example Mutation​

mutation {
upsertVendors(
inputs: [
{
id: "ckmnpybisiy5x08abky4g2d1f",
name: "Dunder Mifflin (edited)"
}
]
) {
code
id
name
}
}

Example Response​

[
{
"id": "ckmnpybisiy5x08abky4g2d1f",
"code": "ACE123",
"name": "Dunder Mifflin (edited)"
}
]

addLocationToVendor​

Attaches a location to the vendor.

Parameters​

NameTypeDescriptionExample
locationIdID(required) ID of the location to attach to the vendor"ckmnpybisiy5x08abky4g2d1f"
idIDID of the vendor to update"ckmnpybisiy5x08abky4g2d1f"
codestringCode of vendor to update"ACE123"

One of id or code is required.

Response​

The updated Vendor.

Example Mutation​

mutation {
addLocationToVendor(
vendorId: "ckmnpybisiy5x08abky4g2d1f"
locationId: "af35pf4taiygadxafd23g8hga"
) {
code
id
name
}
}

Example Response​

{
"code": "ACE123",
"id": "ckmnpybisiy5x08abky4g2d1f",
"name": "Dunder Mifflin"
}

deleteVendor​

Deletes a vendor.

Parameters​

NameTypeDescriptionExample
idIDID of the vendor to update"ckmnpybisiy5x08abky4g2d1f"
codestringCode of the vendor to update. If both id and code are provided, the vendor's code will be updated to this value."ACE123"

One of id or code is required.

Response​

The deleted Vendor.

Example Mutation​

mutation {
deleteVendor(
id: "ckmnpybisiy5x08abky4g2d1f"
) {
code
id
name
}
}

Example Response​

{
"code": "ACE123",
"id": "ckmnpybisiy5x08abky4g2d1f",
"name": "Dunder Mifflin (edited)",
}