Developers

Enterprise API reference

Crewzy issues one key to each ERP provider once it has accepted the API Terms. It works for each enterprise that has signed with Crewzy and named that ERP, while its agreement is live. Every call names the enterprise and the link; a link that is not that enterprise's answers 404, even one the key serves.

The OpenAPI file

Calling it

Every call goes to the API address Crewzy gives you with the key, followed by /api/v1/enterprise, with the key as a bearer token: Authorization: Bearer crewzy_ent_.... Requests and answers are JSON.

CallWhat it does, and its answers
GET /enterprisesThe live enterprises this key may act for.

200 Their ids and names.

POST /{enterpriseId}/invitationsAsks Crewzy to invite a contractor. Crewzy emails them in its own name, with one reminder after 7 days; the invitation lapses after 30. The answer is the same whether or not the business is on Crewzy.

201 The invitation, pending.

404 Nothing with that id this key may see. Another business or enterprise answers the same.

429 The enterprise has sent 50 invitations in the last day.

GET /{enterpriseId}/invitations/{id}Where an invitation stands: pending, accepted (with the link id), declined or expired.

200 The invitation.

404 Nothing with that id this key may see. Another business or enterprise answers the same.

GET /{enterpriseId}/linksThe enterprise's links, live and ended.

200 The links.

404 Nothing with that id this key may see. Another business or enterprise answers the same.

GET /{enterpriseId}/links/{linkId}One link, with the contractor's details and the licences and insurance it shares.

200 The link.

404 Nothing with that id this key may see. Another business or enterprise answers the same.

DELETE /{enterpriseId}/links/{linkId}Ends the link: the enterprise no longer uses the contractor. New jobs stop; the jobs already sent stay.

204 Ended.

404 Nothing with that id this key may see. Another business or enterprise answers the same.

PUT /{enterpriseId}/links/{linkId}/work-orders/{ref}Sends a new job, or changes one, under your own reference for it. References are unique within a link. Naming an order puts the job under that purchase order.

200 The job was there and is updated; the answer is the job as it stands.

201 The job is new.

404 Nothing with that id this key may see. Another business or enterprise answers the same.

409 The link has ended.

GET /{enterpriseId}/links/{linkId}/work-orders/{ref}The whole job as it stands: status, booked dates, approved time, parts, sign-off, its invoices, and the invoices against a purchase order that bill it, with this job's lines. Rebuild from this after losing changes.

200 The job.

404 Nothing with that id this key may see. Another business or enterprise answers the same.

GET /{enterpriseId}/links/{linkId}/work-orders/{ref}/signatureThe sign-off signature, as an image, when the job's sign-off says there is one.

200 The image.

404 Nothing with that id this key may see. Another business or enterprise answers the same.

GET /{enterpriseId}/links/{linkId}/files/{id}A photo or form on one of the link's jobs, or a licence or insurance the contractor shares.

200 The file.

404 Nothing with that id this key may see. Another business or enterprise answers the same.

PUT /{enterpriseId}/links/{linkId}/quotes/{number}/decisionAccepts a quote with your purchase order (its number, and what it authorises before tax, the quote's total when left out), declines it, or asks a question about it.

200 The quote as it now stands.

404 Nothing with that id this key may see. Another business or enterprise answers the same.

409 The quote has already been answered, or has lapsed.

PUT /{enterpriseId}/links/{linkId}/client-orders/{ref}Sends a purchase order on its own: one with no quote, a raised amount, or closing or cancelling it. Jobs join it by naming it.

200 The order as it now stands.

404 Nothing with that id this key may see. Another business or enterprise answers the same.

409 The link has ended.

PUT /{enterpriseId}/links/{linkId}/invoices/{number}/statusSays what you did with an invoice: approved, disputed with the reason, or paid with the date, amount and reference. Paid is advice: the contractor records the payment.

200 Recorded.

404 Nothing with that id this key may see. Another business or enterprise answers the same.

GET /changesThe change feed, oldest first, for every enterprise the key serves or one of them. Pass the answer's next as after in the following read. Changes are kept 90 days. Read about once a minute.

200 The changes and the next cursor.

404 Nothing with that id this key may see. Another business or enterprise answers the same.

410 The cursor is older than the changes kept. Read each job again, then start from the newest.

POST /{enterpriseId}/invitations

FieldTypeRules
contractorRef (required)stringMatches ^[A-Za-z0-9._:-]{1,100}$
businessName (required)stringUp to 200 characters
abnstringMatches ^[0-9 ]{9,17}$
contactName (required)stringUp to 120 characters
contactEmail (required)stringAn email address. Up to 254 characters
consent (required)booleanMust be true

PUT /{enterpriseId}/links/{linkId}/work-orders/{ref}

FieldTypeRules
title (required)stringUp to 200 characters
descriptionstringUp to 5000 characters
prioritystringOne of low, normal, high, urgent
referencestringUp to 100 characters
requestedBystringUp to 120 characters
dueAtstringA date and time with its offset
siteobject
site.addressstringUp to 200 characters
site.suburbstringUp to 100 characters
site.postcodestringUp to 10 characters
site.namestringUp to 120 characters
updatedAtstringA date and time with its offset
cancelledboolean
statusstringOne of approved, rejected, closed
orderstringMatches ^[A-Za-z0-9._:-]{1,100}$

PUT /{enterpriseId}/links/{linkId}/quotes/{number}/decision

FieldTypeRules
decision (required)stringOne of accepted, declined, question
revisioninteger1 to 9007199254740991
by (required)stringUp to 120 characters
notestringUp to 2000 characters
orderobject
order.refstringMatches ^[A-Za-z0-9._:-]{1,100}$
order.amountnumber0 to 100000000

PUT /{enterpriseId}/links/{linkId}/client-orders/{ref}

FieldTypeRules
amountstring
statusstringOne of open, closed, cancelled

PUT /{enterpriseId}/links/{linkId}/invoices/{number}/status

FieldTypeRules
status (required)stringOne of approved, disputed, paid
notestringUp to 2000 characters
paidOnstringMatches ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))$
amountnumber0 to 100000000
referencestringUp to 100 characters

GET /changes

FieldTypeRules
afterstringMatches ^\d{1,18}$
limitinteger1 to 200. 200 when left out
enterprisestringAn id

The change feed

Each change carries its cursor id, its type, the enterpriseId and linkId, the job's ref where it is about a job, when it happened, and its data.

TypeWhenData
job.statusThe job is accepted, booked, started or completed, or its booked dates changeThe status and the booked dates
time.approvedThe office approves a time entry on the jobWho, start, end and break minutes
time.changedAn approved entry is changed and approved again, or removedThe entry as it is now, or its id with removed
job.signed_offThe job is completedWhen, signed by, the note, whether there is a signature, and the photos as file ids
purchase.addedA part or other cost goes on the jobDescription, quantity, unit and the price charged
purchase.changedA part on the job changesThe part as it is now
purchase.removedA part comes off the jobIts id
invoice.sentAn invoice for the job is sentNumber, dates, currency, lines, subtotal, tax and total
invoice.voidedAn invoice for the job is voidedIts number
supplier.updatedThe link starts, or the contractor's details or shared licences changeBusiness and legal name, ABN or NZBN, GST, address, phone, email, trade, and the shared licences and insurance as file ids. Never bank details
link.disconnectedThe contractor disconnects the linkNothing
quote.sentA quote for the enterprise is sent, or sent again after a changeNumber, revision, the job it is for, valid until, lines and totals
quote.repliedThe contractor answers a question on a quoteThe quote number and the reply
quote.expiredA quote passes its dateIts number
quote.withdrawnThe contractor takes a sent quote back to change it. The next revision follows as quote.sentThe quote number and the revision withdrawn

All of the developer section