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.
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.
| Call | What it does, and its answers |
|---|---|
GET /enterprises | The live enterprises this key may act for.
|
POST /{enterpriseId}/invitations | Asks 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.
|
GET /{enterpriseId}/invitations/{id} | Where an invitation stands: pending, accepted (with the link id), declined or expired.
|
GET /{enterpriseId}/links | The enterprise's links, live and ended.
|
GET /{enterpriseId}/links/{linkId} | One link, with the contractor's details and the licences and insurance it shares.
|
DELETE /{enterpriseId}/links/{linkId} | Ends the link: the enterprise no longer uses the contractor. New jobs stop; the jobs already sent stay.
|
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.
|
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.
|
GET /{enterpriseId}/links/{linkId}/work-orders/{ref}/signature | The sign-off signature, as an image, when the job's sign-off says there is one.
|
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.
|
PUT /{enterpriseId}/links/{linkId}/quotes/{number}/decision | Accepts 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.
|
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.
|
PUT /{enterpriseId}/links/{linkId}/invoices/{number}/status | Says 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.
|
GET /changes | The 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.
|
POST /{enterpriseId}/invitations
| Field | Type | Rules |
|---|---|---|
contractorRef (required) | string | Matches ^[A-Za-z0-9._:-]{1,100}$ |
businessName (required) | string | Up to 200 characters |
abn | string | Matches ^[0-9 ]{9,17}$ |
contactName (required) | string | Up to 120 characters |
contactEmail (required) | string | An email address. Up to 254 characters |
consent (required) | boolean | Must be true |
PUT /{enterpriseId}/links/{linkId}/work-orders/{ref}
| Field | Type | Rules |
|---|---|---|
title (required) | string | Up to 200 characters |
description | string | Up to 5000 characters |
priority | string | One of low, normal, high, urgent |
reference | string | Up to 100 characters |
requestedBy | string | Up to 120 characters |
dueAt | string | A date and time with its offset |
site | object | |
site.address | string | Up to 200 characters |
site.suburb | string | Up to 100 characters |
site.postcode | string | Up to 10 characters |
site.name | string | Up to 120 characters |
updatedAt | string | A date and time with its offset |
cancelled | boolean | |
status | string | One of approved, rejected, closed |
order | string | Matches ^[A-Za-z0-9._:-]{1,100}$ |
PUT /{enterpriseId}/links/{linkId}/quotes/{number}/decision
| Field | Type | Rules |
|---|---|---|
decision (required) | string | One of accepted, declined, question |
revision | integer | 1 to 9007199254740991 |
by (required) | string | Up to 120 characters |
note | string | Up to 2000 characters |
order | object | |
order.ref | string | Matches ^[A-Za-z0-9._:-]{1,100}$ |
order.amount | number | 0 to 100000000 |
PUT /{enterpriseId}/links/{linkId}/client-orders/{ref}
| Field | Type | Rules |
|---|---|---|
amount | string | |
status | string | One of open, closed, cancelled |
PUT /{enterpriseId}/links/{linkId}/invoices/{number}/status
| Field | Type | Rules |
|---|---|---|
status (required) | string | One of approved, disputed, paid |
note | string | Up to 2000 characters |
paidOn | string | Matches ^(?:(?:\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])))$ |
amount | number | 0 to 100000000 |
reference | string | Up to 100 characters |
GET /changes
| Field | Type | Rules |
|---|---|---|
after | string | Matches ^\d{1,18}$ |
limit | integer | 1 to 200. 200 when left out |
enterprise | string | An 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.
| Type | When | Data |
|---|---|---|
job.status | The job is accepted, booked, started or completed, or its booked dates change | The status and the booked dates |
time.approved | The office approves a time entry on the job | Who, start, end and break minutes |
time.changed | An approved entry is changed and approved again, or removed | The entry as it is now, or its id with removed |
job.signed_off | The job is completed | When, signed by, the note, whether there is a signature, and the photos as file ids |
purchase.added | A part or other cost goes on the job | Description, quantity, unit and the price charged |
purchase.changed | A part on the job changes | The part as it is now |
purchase.removed | A part comes off the job | Its id |
invoice.sent | An invoice for the job is sent | Number, dates, currency, lines, subtotal, tax and total |
invoice.voided | An invoice for the job is voided | Its number |
supplier.updated | The link starts, or the contractor's details or shared licences change | Business and legal name, ABN or NZBN, GST, address, phone, email, trade, and the shared licences and insurance as file ids. Never bank details |
link.disconnected | The contractor disconnects the link | Nothing |
quote.sent | A quote for the enterprise is sent, or sent again after a change | Number, revision, the job it is for, valid until, lines and totals |
quote.replied | The contractor answers a question on a quote | The quote number and the reply |
quote.expired | A quote passes its date | Its number |
quote.withdrawn | The contractor takes a sent quote back to change it. The next revision follows as quote.sent | The quote number and the revision withdrawn |