The SMG Tools API
Read and write a business’s clients, jobs, leads and appointments, read its invoices, and subscribe to what happens, from any program the business gives a key.
Get started
The business makes the key, not you. Its owner opens Tools → Webhooks & API → API keys in
SMG Tools, chooses New key, names it after the program it is for and checks the boxes for what it may do.
SMG Tools shows the key once. The owner copies it to you or pastes it into the program. Keys are part of
Solo and the plans above it. A business on Free gets plan_required on every route
except removing a subscription, which is never refused for the plan. Its keys work again once it is on one of
those plans.
A business that wants this without code can use SMG Tools’ own app in Zapier’s directory. Every event in the webhook catalog is a trigger, and every write below is an action. SMG Tools’ Zapier page makes the key that connects it. See Connect SMG Tools to Zapier.
Send the key with every request as a bearer token. The API answers at
https://smg-api.smgtools.com/v1, in JSON:
curl 'https://smg-api.smgtools.com/v1/me' \
-H 'Authorization: Bearer smgk_…' That call works for any key. It says which business the key belongs to, the key’s name and what it may do. It is a good first request, and the one a program makes to show which account it is connected to.
A key sees the whole business, as a manager does, and does only what its scopes allow. What it writes goes through the same rules as the business’s own work, with the same effects, and the record says the key did it. A client added through the API says Zapier (API key) added it. A job the key completes runs the business’s automations for a completed job, the same as when the office completes it. A key never charges, refunds or deletes, and never sends an invoice, a proposal or a message of its own.
What a key may do
Each route needs one scope, and a key has the ones the business checked when it made the key. A request for
anything else is refused with scope_required, naming the scope it needed.
Any key may call GET /v1/me and GET /v1/webhooks/events, whatever scopes it has.
Errors
Every error is application/problem+json in one shape: the HTTP status, a stable
code to branch on, a title a person can read, the scope a key lacked,
and errors — each field’s problems — when a write was refused. A code is never
renamed. New ones may be added, so handle a code you do not know by its status.
{
"status": 422,
"code": "validation_failed",
"title": "On the way and On site are visit statuses now, not job statuses. The crew sets them on each visit from My Day.",
"errors": {
"status": ["On the way and On site are visit statuses now, not job statuses. The crew sets them on each visit from My Day."]
}
} | Code | Status | Means |
|---|---|---|
invalid_key | 401 | No key was sent, or no business issued the one sent. Keys start with smgk_. |
key_revoked | 401 | The business revoked the key. Ask them for a new one. |
scope_required | 403 | The key does not have the scope this route needs. The problem’s scope names the one it lacks. |
plan_required | 403 | The business’s plan does not include the API. The API is on Solo and the plans above it. The business keeps its keys and webhooks, and they work again once it is on one of those plans. The title says where it changes plans. |
not_found | 404 | The business has nothing at this address. Either it does not have the record, or this key may not see it. |
validation_failed | 422 | A rule refused the request. The title says why in a sentence, and errors names each field’s problems, all at once. |
checklist_outstanding | 422 | A job cannot be completed while a required checklist step is unanswered, unless checklistOverrideReason says why. |
idempotency_conflict | 409 | The Idempotency-Key was sent before with a different request, or its first request is still being answered. |
rate_limited | 429 | Too many requests. Wait the seconds in the Retry-After header, then try again. |
invalid_request | 400 | The request could not be read. For example, the body is not JSON, a parameter is the wrong kind, or the Idempotency-Key is over 255 characters. |
method_not_allowed | 405 | The address does not take that method. |
internal_error | 500 | Something went wrong on our side. A create sent with an Idempotency-Key is safe to retry. |
Lists, paging and syncing
A list of records comes back a page at a time, as data with page,
pageSize and total. Ask for a page with page (from 1) and
pageSize (up to 100, or 25 if you leave it out). Each list comes in a set order:
| List | Order |
|---|---|
GET /v1/clients | Oldest first, by when each was added |
GET /v1/jobs | Oldest first, by when each was added |
GET /v1/leads | Oldest first, by when each was added |
GET /v1/appointments | Oldest first, by when each was added |
GET /v1/invoices | Oldest first, by when each was added |
GET /v1/stock | By place, then by part |
GET /v1/purchase-orders | Oldest first, by when each was added |
A list kept oldest first does not shift as records are added. A new record lands on the last page. Stock levels are ordered by place and then by part, each by its id, not its name. So a part newly stocked at a place can land on a page you have already read.
Each of these lists takes updatedSince, an instant. The list then returns only the records
created or changed at or after it. To keep a copy in sync, ask for what changed since your last sync instead
of reading everything again. Times are UTC instants. A date is the business’s own calendar day.
The lists below are short and come back whole, as a plain array. They take no page and no
updatedSince.
| List | Holds |
|---|---|
GET /v1/webhooks/events | Every event in the catalog |
GET /v1/webhooks/events/{name}/examples | Up to 3 of the latest times the event happened, newest first |
GET /v1/webhooks | Every subscription this key made, oldest first |
Retrying a create
Send an Idempotency-Key header with every create. Use any value up to 255 characters, new for
each thing you mean to create. If the answer is lost, send the same request with the same key again within 24
hours. You get the first answer back, not a second record, with the header
Idempotent-Replayed: true. The same key with a different request is refused as
idempotency_conflict.
Limits
Each key may make 120 requests a minute, and a business 600 a minute across all its keys. A request over
either limit is refused with rate_limited and a Retry-After header in seconds. A
business may have 20 working keys.
Checking a webhook came from us
A key with the webhooks:write scope can subscribe an address to events. See
Webhooks below. Each delivery is a POST of JSON with the headers
X-SmgTools-Event, X-SmgTools-Delivery-Id, X-SmgTools-Timestamp and
X-SmgTools-Signature. The signature reads t={timestamp},v1={signature}.
The signature part is an HMAC-SHA256, in lowercase hex, of the timestamp, a period and the raw body. Key it with the
subscription’s secret exactly as it was given to you, whsec_ included.
// Node.js
const [t, v1] = header.split(',').map((part) => part.split('=')[1]);
const expected = crypto.createHmac('sha256', secret).update(`${t}.${rawBody}`).digest('hex');
const genuine = crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(v1)); Compare against the body as it arrived, before you parse it. Refuse a timestamp more than a few minutes old, so a delivery cannot be replayed. The secret is in the answer that created the subscription, and is never shown again.
Versions and the contract
This is version 1. Within it we only add — a new route, a new field, a new error code — so a program should ignore a field it does not know. Anything that would break a program comes in a new version, with notice before the old one is retired.
The API describes itself in OpenAPI 3.1 at https://smg-api.smgtools.com/v1/openapi.json, for any tool that generates a client from it. The reference below is written from the same document.
Connecting an AI app
Claude, ChatGPT and any app that speaks the Model Context Protocol connect at https://smg-api.smgtools.com/mcp — not through /v1, and not with a key. Each person adds the
address in their app and signs in to SMG Tools as themselves. The app then reads what their role can see and
prepares changes for them to confirm on SMG Tools’ own card. The sign-in follows the Model Context
Protocol’s authorization: the app finds it from the address alone, registers itself or names its own
metadata document, and uses PKCE. How a person connects one is on Connect Claude or ChatGPT.
Me
Which business and which key is calling, and what the key may do
GET /v1/me any key
Answers 200 with Me; may refuse 403.
curl -X GET 'https://smg-api.smgtools.com/v1/me' \
-H 'Authorization: Bearer smgk_…' The Me record
| Field | Type | Notes |
|---|---|---|
business | Business | |
key | Key |
The Business record
| Field | Type | Notes |
|---|---|---|
id | string (uuid) | |
name | string |
The Key record
| Field | Type | Notes |
|---|---|---|
id | string (uuid) | |
name | string | |
scopes | array of string |
Clients
The business's clients, a page at a time, oldest first
GET /v1/clients clients:read
Archived clients are left out unless includeArchived is true. updatedSince returns only the clients created or changed at or after that instant, which is what a sync needs. email finds the clients with that address, in any letter case. phone finds the clients with that number by its digits alone, so (970) 555-0142 finds 970-555-0142. A find-or-create step uses these before it creates.
| Parameter | In | Type |
|---|---|---|
page | query | integer |
pageSize | query | integer |
updatedSince | query | string (date-time) |
includeArchived | query | boolean |
email | query | string |
phone | query | string |
Answers 200 with a page of Client; may refuse 403.
curl -X GET 'https://smg-api.smgtools.com/v1/clients' \
-H 'Authorization: Bearer smgk_…' Add a client
POST /v1/clients clients:write
The client's source is Integration, labeled with the key's name, and its history says the key added it. Send an Idempotency-Key to make a retry safe.
| Field | Type | Notes |
|---|---|---|
name (required) | string | |
businessName | string | |
email | string | |
phone | string | |
address | string | |
notes | string |
Answers 201 with Client; may refuse 403, 409, 422.
curl -X POST 'https://smg-api.smgtools.com/v1/clients' \
-H 'Authorization: Bearer smgk_…' \
-H 'Idempotency-Key: 7c1f0d52-first-try' \
-H 'Content-Type: application/json' \
-d '{"name":"Marisol Rivera"}' One client
GET /v1/clients/{id} clients:read
| Parameter | In | Type |
|---|---|---|
id (required) | path | string (uuid) |
Answers 200 with Client; may refuse 403, 404.
curl -X GET 'https://smg-api.smgtools.com/v1/clients/3f2c9a1e-5b7d-4c2a-9e61-0a8d4b2c7f10' \
-H 'Authorization: Bearer smgk_…' Change a client's details
PATCH /v1/clients/{id} clients:write
A field you leave out stays as it is. An empty string clears a field, except the name, which a client always has. You can't change an archived client.
| Parameter | In | Type |
|---|---|---|
id (required) | path | string (uuid) |
| Field | Type | Notes |
|---|---|---|
name | string | |
businessName | string | |
email | string | |
phone | string | |
address | string | |
notes | string |
Answers 200 with Client; may refuse 403, 404, 422.
curl -X PATCH 'https://smg-api.smgtools.com/v1/clients/3f2c9a1e-5b7d-4c2a-9e61-0a8d4b2c7f10' \
-H 'Authorization: Bearer smgk_…' \
-H 'Content-Type: application/json' \
-d '{"name":"Marisol Rivera","businessName":"Marisol Rivera"}' The Client record
| Field | Type | Notes |
|---|---|---|
id | string (uuid) | |
name | string | |
businessName | string, or null | |
email | string, or null | |
phone | string, or null | |
address | string, or null | |
notes | string, or null | |
archived | boolean | Archived clients are hidden from the business's lists. They're listed here only if you ask for them. |
source | string | Where the client came from, such as Integration, PublicPageDirect or Manual. |
sourceLabel | string, or null | |
createdAt | string (date-time) | |
updatedAt | string (date-time), or null |
Jobs
The business's jobs, a page at a time, oldest first
GET /v1/jobs jobs:read
Narrow by status and clientId, or find a job by its job number, in any letter case. Archived jobs are left out unless includeArchived is true. updatedSince returns only the jobs created or changed at or after that instant.
| Parameter | In | Type |
|---|---|---|
page | query | integer |
pageSize | query | integer |
updatedSince | query | string (date-time) |
status | query | string |
clientId | query | string (uuid) |
includeArchived | query | boolean |
number | query | string |
Answers 200 with a page of Job; may refuse 403.
curl -X GET 'https://smg-api.smgtools.com/v1/jobs' \
-H 'Authorization: Bearer smgk_…' Create a job for one of the business's clients
POST /v1/jobs jobs:write
The job's history says the key created it, and it goes on the business's board, calendar and webhooks exactly as one created in the console. Send an Idempotency-Key to make a retry safe.
| Field | Type | Notes |
|---|---|---|
clientId (required) | string (uuid) | |
title (required) | string | |
description | string | |
number | string | If you leave it out, the job gets the business's next number. |
jobTypeId | string (uuid) | If you leave it out, the job gets the business's default job type. |
status | string | Planning if you leave it out. EnRoute and OnSite are refused, because they're a visit's status now. |
startDate | string (date) | |
targetCompletionDate | string (date) | |
agreedPrice | number | |
location | string | |
priority | string | |
notes | string | |
customerReference | string |
Answers 201 with Job; may refuse 403, 409, 422.
curl -X POST 'https://smg-api.smgtools.com/v1/jobs' \
-H 'Authorization: Bearer smgk_…' \
-H 'Idempotency-Key: 7c1f0d52-first-try' \
-H 'Content-Type: application/json' \
-d '{"clientId":"3f2c9a1e-5b7d-4c2a-9e61-0a8d4b2c7f10","title":"Water heater swap"}' One job
GET /v1/jobs/{id} jobs:read
| Parameter | In | Type |
|---|---|---|
id (required) | path | string (uuid) |
Answers 200 with Job; may refuse 403, 404.
curl -X GET 'https://smg-api.smgtools.com/v1/jobs/3f2c9a1e-5b7d-4c2a-9e61-0a8d4b2c7f10' \
-H 'Authorization: Bearer smgk_…' Change a job's details
PATCH /v1/jobs/{id} jobs:write
A field you leave out stays as it is. An empty string clears a text field, except the title, which a job always has. The status changes on its own route.
| Parameter | In | Type |
|---|---|---|
id (required) | path | string (uuid) |
| Field | Type | Notes |
|---|---|---|
clientId | string (uuid) | |
title | string | |
description | string | |
number | string | |
jobTypeId | string (uuid) | |
startDate | string (date) | |
targetCompletionDate | string (date) | |
agreedPrice | number | |
location | string | |
priority | string | |
notes | string | |
customerReference | string |
Answers 200 with Job; may refuse 403, 404, 422.
curl -X PATCH 'https://smg-api.smgtools.com/v1/jobs/3f2c9a1e-5b7d-4c2a-9e61-0a8d4b2c7f10' \
-H 'Authorization: Bearer smgk_…' \
-H 'Content-Type: application/json' \
-d '{"clientId":"3f2c9a1e-5b7d-4c2a-9e61-0a8d4b2c7f10","title":"Water heater swap"}' Move a job to another status, as the office does
POST /v1/jobs/{id}/status jobs:write
The same checks as the console's. A job with a required checklist step unanswered can't be Completed without a checklistOverrideReason (checklist_outstanding). EnRoute and OnSite are refused, because they're a visit's status now.
| Parameter | In | Type |
|---|---|---|
id (required) | path | string (uuid) |
| Field | Type | Notes |
|---|---|---|
status (required) | string | Planning, Approved, InProgress, OnHold, Completed or Closed. |
actualCompletionDate | string (date) | When the job was finished, for Completed. If you leave it out, it's today in the business's time zone. |
checklistOverrideReason | string | Why the job is being finished with its checklist incomplete. Without a reason, the change is refused while any required step is unanswered. |
Answers 200 with Job; may refuse 403, 404, 422.
curl -X POST 'https://smg-api.smgtools.com/v1/jobs/3f2c9a1e-5b7d-4c2a-9e61-0a8d4b2c7f10/status' \
-H 'Authorization: Bearer smgk_…' \
-H 'Content-Type: application/json' \
-d '{"status":"InProgress"}' The Job record
| Field | Type | Notes |
|---|---|---|
id | string (uuid) | |
number | string | The job's number in the business, such as JOB-20261109-001. |
clientId | string (uuid) | |
jobTypeId | string (uuid) | |
title | string | |
description | string, or null | |
status | string | One of Planning, Approved, InProgress, OnHold, Completed, Closed. Where the crew is — on the way, on site — is each visit's status, not the job's. |
startDate | string (date), or null | |
targetCompletionDate | string (date), or null | |
actualCompletionDate | string (date), or null | |
billingBasis | string, or null | AgreedPrice, AsItGoes, or null if the business hasn't set one. |
agreedPrice | number, or null | The job's agreed price, when its billing basis is AgreedPrice. |
location | string, or null | |
priority | string, or null | Low, Medium, High or Urgent. |
notes | string, or null | |
customerReference | string, or null | The customer's own reference for the work, such as a purchase order or work order number. |
archived | boolean | |
createdAt | string (date-time) | |
updatedAt | string (date-time), or null |
Leads
The business's leads, a page at a time, oldest first
GET /v1/leads leads:read
Narrow by status. Archived leads are left out unless includeArchived is true or the status asked for is Archived. updatedSince returns only the leads created, contacted, converted or archived at or after that instant.
| Parameter | In | Type |
|---|---|---|
page | query | integer |
pageSize | query | integer |
updatedSince | query | string (date-time) |
status | query | string |
includeArchived | query | boolean |
Answers 200 with a page of Lead; may refuse 403.
curl -X GET 'https://smg-api.smgtools.com/v1/leads' \
-H 'Authorization: Bearer smgk_…' Add a lead
POST /v1/leads leads:write
It follows the same rules as the business's public form and its inbound lead address, and names every problem at once. Its source is Integration, labeled with the key's name. Send an Idempotency-Key to make a retry safe.
| Field | Type | Notes |
|---|---|---|
name | string | |
email | string | |
phone | string | |
address | string | |
descriptionOfWork | string | |
preferredContactMethod | string | Email, Phone or Text. |
preferredTimeOfDay | string | Morning, Afternoon or Evening. |
preferredDate | string (date) | |
preferredTimeWindow | string |
Answers 201 with Lead; may refuse 403, 409, 422.
curl -X POST 'https://smg-api.smgtools.com/v1/leads' \
-H 'Authorization: Bearer smgk_…' \
-H 'Idempotency-Key: 7c1f0d52-first-try' \
-H 'Content-Type: application/json' \
-d '{"name":"Marisol Rivera","email":"marisol@example.com"}' One lead
GET /v1/leads/{id} leads:read
| Parameter | In | Type |
|---|---|---|
id (required) | path | string (uuid) |
Answers 200 with Lead; may refuse 403, 404.
curl -X GET 'https://smg-api.smgtools.com/v1/leads/3f2c9a1e-5b7d-4c2a-9e61-0a8d4b2c7f10' \
-H 'Authorization: Bearer smgk_…' Move a lead, as the Leads page does
POST /v1/leads/{id}/status leads:write
A lead moves from New to Contacted and back, from any status to Archived, and from Archived back to Contacted. A lead becomes Converted only by becoming a client.
| Parameter | In | Type |
|---|---|---|
id (required) | path | string (uuid) |
| Field | Type | Notes |
|---|---|---|
status (required) | string | New, Contacted or Archived. |
Answers 200 with Lead; may refuse 403, 404, 422.
curl -X POST 'https://smg-api.smgtools.com/v1/leads/3f2c9a1e-5b7d-4c2a-9e61-0a8d4b2c7f10/status' \
-H 'Authorization: Bearer smgk_…' \
-H 'Content-Type: application/json' \
-d '{"status":"InProgress"}' The Lead record
| Field | Type | Notes |
|---|---|---|
id | string (uuid) | |
name | string | |
email | string, or null | |
phone | string, or null | |
address | string, or null | |
descriptionOfWork | string, or null | |
preferredContactMethod | string, or null | |
preferredTimeOfDay | string, or null | |
preferredDate | string (date), or null | |
preferredTimeWindow | string, or null | |
source | string | Where the lead came from, such as Integration, PublicPageDirect, Referral or InboundCall. |
sourceLabel | string, or null | The name of where the lead came from. For a lead a key made, it's the key's name. |
status | string | New, Contacted, Converted or Archived. |
clientId | string (uuid), or null | The client the lead became, or belongs to. |
createdAt | string (date-time) | |
contactedAt | string (date-time), or null | |
convertedAt | string (date-time), or null | |
archivedAt | string (date-time), or null |
Appointments
The business's visits, a page at a time, oldest booked first
GET /v1/appointments appointments:read
Narrow to dates from and to, inclusive, on the business's own calendar. Cancelled visits are left out unless includeCancelled is true. updatedSince returns only the visits booked, changed or cancelled at or after that instant.
| Parameter | In | Type |
|---|---|---|
page | query | integer |
pageSize | query | integer |
updatedSince | query | string (date-time) |
from | query | string (date) |
to | query | string (date) |
includeCancelled | query | boolean |
Answers 200 with a page of Appointment; may refuse 403.
curl -X GET 'https://smg-api.smgtools.com/v1/appointments' \
-H 'Authorization: Bearer smgk_…' Book a visit against one of the business's jobs or clients
POST /v1/appointments appointments:write
It's booked on the business's own clock and calendar, with its reminders, and with its email to the client if you ask for it. Send an Idempotency-Key to make a retry safe.
| Field | Type | Notes |
|---|---|---|
title (required) | string | |
date (required) | string (date) | |
startTime | string (time) | Needed unless allDay is true. |
endTime | string (time) | 1 hour after the start if you leave it out. |
allDay (required) | boolean | |
location | string | |
notes | string | |
jobId | string (uuid) | |
clientId | string (uuid) | |
reminderEnabled | boolean | True if you leave it out. |
notifyClient | boolean | Whether to tell the client the visit is booked. They get an email, plus a text if the business sends booking confirmations by text and the client has agreed to texts. False if you leave it out. |
Answers 201 with Appointment; may refuse 403, 409, 422.
curl -X POST 'https://smg-api.smgtools.com/v1/appointments' \
-H 'Authorization: Bearer smgk_…' \
-H 'Idempotency-Key: 7c1f0d52-first-try' \
-H 'Content-Type: application/json' \
-d '{"title":"Water heater swap","date":"2026-10-01","startTime":"09:00:00","allDay":false}' One visit
GET /v1/appointments/{id} appointments:read
| Parameter | In | Type |
|---|---|---|
id (required) | path | string (uuid) |
Answers 200 with Appointment; may refuse 403, 404.
curl -X GET 'https://smg-api.smgtools.com/v1/appointments/3f2c9a1e-5b7d-4c2a-9e61-0a8d4b2c7f10' \
-H 'Authorization: Bearer smgk_…' Reschedule a visit, or change its details
PATCH /v1/appointments/{id} appointments:write
A field you leave out stays as it is. An empty string clears the location or the notes. allDay true drops the times.
| Parameter | In | Type |
|---|---|---|
id (required) | path | string (uuid) |
| Field | Type | Notes |
|---|---|---|
title | string | |
date | string (date) | |
startTime | string (time) | |
endTime | string (time) | |
allDay | boolean | |
location | string | |
notes | string | |
reminderEnabled | boolean |
Answers 200 with Appointment; may refuse 403, 404, 422.
curl -X PATCH 'https://smg-api.smgtools.com/v1/appointments/3f2c9a1e-5b7d-4c2a-9e61-0a8d4b2c7f10' \
-H 'Authorization: Bearer smgk_…' \
-H 'Content-Type: application/json' \
-d '{"title":"Water heater swap","date":"2026-10-01"}' Cancel a visit
POST /v1/appointments/{id}/cancel appointments:write
It stays on record as cancelled, and nothing is deleted. Cancelling a visit that's already cancelled returns it as it is.
| Parameter | In | Type |
|---|---|---|
id (required) | path | string (uuid) |
Answers 200 with Appointment; may refuse 403, 404.
curl -X POST 'https://smg-api.smgtools.com/v1/appointments/3f2c9a1e-5b7d-4c2a-9e61-0a8d4b2c7f10/cancel' \
-H 'Authorization: Bearer smgk_…' The Appointment record
| Field | Type | Notes |
|---|---|---|
id | string (uuid) | |
title | string | |
date | string (date) | |
startTime | string (time), or null | |
endTime | string (time), or null | |
allDay | boolean | |
start | string (date-time), or null | |
end | string (date-time), or null | |
location | string, or null | |
notes | string, or null | |
jobId | string (uuid), or null | |
clientId | string (uuid), or null | |
reminderEnabled | boolean | Whether the client is sent a reminder before the visit. |
cancelled | boolean | |
createdAt | string (date-time) | |
updatedAt | string (date-time), or null | |
cancelledAt | string (date-time), or null |
Invoices
The business's invoices, with their lines, payments and balance, a page at a time
GET /v1/invoices invoices:read
Narrow by status, clientId and jobId. updatedSince returns only the invoices raised or changed at or after that instant. Nothing on v1 writes an invoice.
| Parameter | In | Type |
|---|---|---|
page | query | integer |
pageSize | query | integer |
updatedSince | query | string (date-time) |
status | query | string |
clientId | query | string (uuid) |
jobId | query | string (uuid) |
Answers 200 with a page of Invoice; may refuse 403.
curl -X GET 'https://smg-api.smgtools.com/v1/invoices' \
-H 'Authorization: Bearer smgk_…' One invoice, with its lines, payments and balance
GET /v1/invoices/{id} invoices:read
| Parameter | In | Type |
|---|---|---|
id (required) | path | string (uuid) |
Answers 200 with Invoice; may refuse 403, 404.
curl -X GET 'https://smg-api.smgtools.com/v1/invoices/3f2c9a1e-5b7d-4c2a-9e61-0a8d4b2c7f10' \
-H 'Authorization: Bearer smgk_…' The Invoice record
| Field | Type | Notes |
|---|---|---|
id | string (uuid) | |
number | string | The invoice's number in the business, such as INV-0042. |
clientId | string (uuid) | |
jobId | string (uuid), or null | |
status | string | Draft, Sent, Viewed, PartiallyPaid, Paid, Overdue or Voided. |
issueDate | string (date) | The date printed on the invoice. |
dueDate | string (date), or null | |
lines | array of InvoiceLine | |
subtotal | number | |
taxRate | number, or null | The tax rate as a percentage, such as 8.25. Null when the invoice isn't taxed. |
tax | number | |
total | number | |
amountPaid | number | Everything paid, tips excluded. |
balance | number | What's still owed, which is the total minus what's been paid. |
payments | array of Payment | |
customerReference | string, or null | |
notes | string, or null | |
sentAt | string (date-time), or null | |
paidAt | string (date-time), or null | |
voidedAt | string (date-time), or null | |
createdAt | string (date-time) | |
updatedAt | string (date-time), or null |
The InvoiceLine record
| Field | Type | Notes |
|---|---|---|
description | string | |
quantity | number, or null | |
unitPrice | number, or null | |
hours | number, or null | |
hourlyRate | number, or null | |
total | number |
The Payment record
| Field | Type | Notes |
|---|---|---|
id | string (uuid) | |
amount | number | |
tip | number | A tip given with the payment, on top of the amount. |
method | string | How it was paid, such as Card, Cash, Check or BankTransfer. |
receivedAt | string (date-time) | |
voided | boolean | A voided payment no longer counts toward what is paid. |
Stock
What each shop and van holds of every part, with its bin and levels, a page at a time
GET /v1/stock inventory:read
Ordered by place and then by part, each by its id. So a part newly stocked at a place can land on a page you've already read. Narrow by placeId and itemId. low=true returns only parts at or below their reorder point. updatedSince returns only the levels changed at or after that instant. Archived places are left out, and nothing on v1 changes stock.
| Parameter | In | Type |
|---|---|---|
page | query | integer |
pageSize | query | integer |
updatedSince | query | string (date-time) |
placeId | query | string (uuid) |
itemId | query | string (uuid) |
low | query | boolean |
Answers 200 with a page of StockLevel; may refuse 403.
curl -X GET 'https://smg-api.smgtools.com/v1/stock' \
-H 'Authorization: Bearer smgk_…' The StockLevel record
| Field | Type | Notes |
|---|---|---|
placeId | string (uuid) | The shop, warehouse or van. |
placeName | string | |
placeKind | string | Shop (a shop or warehouse) or Vehicle. |
itemId | string (uuid) | |
itemName | string | The part's name in the Price Book. |
unit | string | The unit it's counted in, such as each, foot or gallon. |
quantity | number | How many the place holds. Below zero when more was recorded as used than was known to be there. |
bin | string, or null | Where it is kept at the place, such as Drawer 2. |
reorderPoint | number, or null | Its Reorder point, the level it gets restocked at. Null when none is set. |
fillTo | number, or null | Its Fill to level, the level it gets restocked up to. Null when none is set. |
isLow | boolean | At or below its reorder point. |
updatedAt | string (date-time) |
Purchase orders
The business's purchase orders, with their lines and what has come in, a page at a time
GET /v1/purchase-orders purchasing:read
Narrow by status, supplierId and jobId. updatedSince returns only the orders raised or changed at or after that instant. Nothing on v1 sends, approves or receives an order.
| Parameter | In | Type |
|---|---|---|
page | query | integer |
pageSize | query | integer |
updatedSince | query | string (date-time) |
status | query | string |
supplierId | query | string (uuid) |
jobId | query | string (uuid) |
Answers 200 with a page of PurchaseOrder; may refuse 403.
curl -X GET 'https://smg-api.smgtools.com/v1/purchase-orders' \
-H 'Authorization: Bearer smgk_…' One purchase order, with its lines and what has come in
GET /v1/purchase-orders/{id} purchasing:read
| Parameter | In | Type |
|---|---|---|
id (required) | path | string (uuid) |
Answers 200 with PurchaseOrder; may refuse 403, 404.
curl -X GET 'https://smg-api.smgtools.com/v1/purchase-orders/3f2c9a1e-5b7d-4c2a-9e61-0a8d4b2c7f10' \
-H 'Authorization: Bearer smgk_…' The PurchaseOrder record
| Field | Type | Notes |
|---|---|---|
id | string (uuid) | |
number | string | The order's number in the business, such as PO-0042. |
supplierId | string (uuid) | |
supplierName | string | |
for | string | Stock, for one of the business's shops or vans. Or Job, for parts counted against the job when they arrive. |
placeId | string (uuid), or null | The shop or van the stock is for. Null for a job's order. |
jobId | string (uuid), or null | The job the parts are for. Null for a stock order. |
delivery | string | ToPlace, ToSite (the job's site) or PickedUp (at the supplier's counter). |
status | string | Draft, WaitingForApproval, Sent, PartlyReceived, Received or Cancelled. |
expectedOn | string (date), or null | When the supplier said it would arrive. Null if they didn't say. |
lines | array of PurchaseOrderLine | |
total | number | |
atTheCounter | boolean | Bought at the supplier's counter by whoever was there, rather than ordered ahead. |
confirmationNumber | string, or null | The supplier's own number for the order, if it was placed by phone or on the supplier's website. |
sentAt | string (date-time), or null | |
receivedAt | string (date-time), or null | When the last of it came in. Null until it's all in. |
createdAt | string (date-time) | |
updatedAt | string (date-time), or null |
The PurchaseOrderLine record
| Field | Type | Notes |
|---|---|---|
id | string (uuid) | |
itemId | string (uuid), or null | The material in the Price Book. Null for a line typed in by hand. |
description | string | |
partNumber | string, or null | The supplier's own part number. |
purchaseUnit | string, or null | The unit the supplier sells it in, such as box or each. |
packSize | number | How many of the item's own units are in one purchase unit. |
quantity | number | How many purchase units are ordered. |
unitCost | number | The price of one purchase unit. |
amount | number | |
received | number | How many of the item's own units have come in. |
expectedOn | string (date), or null | When the rest of the line is expected. Once some has arrived, the line has its own date. Until then, it's the order's date. |
Webhooks
The events a subscription may be sent, with the fields each carries
GET /v1/webhooks/events any key
Each comes with a sample body, with made-up values and isTest true. A program can show it before the business has an example of its own.
Answers 200 with WebhookEvent; may refuse 403.
curl -X GET 'https://smg-api.smgtools.com/v1/webhooks/events' \
-H 'Authorization: Bearer smgk_…' The latest times an event happened in the business, as a delivery carries them
GET /v1/webhooks/events/{name}/examples webhooks:write
Up to 3, newest first. Each is the body a subscription would have been sent, with event, occurredAt, organizationId, isTest false and the fields under data. There's no delivery id, because it isn't a delivery. Nothing is sent, signed or logged. An event that hasn't happened in the business yet returns an empty list. invoice.sent and invoice.paid carry the invoice as it is now. So they return only the times the invoice hasn't changed since (no payment, refund, void or edit after them). If there are none, they return the event's sample. A program shows these to a person testing a trigger.
| Parameter | In | Type |
|---|---|---|
name (required) | path | string |
Answers 200 with WebhookBody; may refuse 403, 404.
curl -X GET 'https://smg-api.smgtools.com/v1/webhooks/events/{name}/examples' \
-H 'Authorization: Bearer smgk_…' The subscriptions this key made
GET /v1/webhooks webhooks:write
Every subscription this key made, oldest first, in one plain list. Subscriptions a person or another key made aren't listed.
Answers 200 with Webhook; may refuse 403.
curl -X GET 'https://smg-api.smgtools.com/v1/webhooks' \
-H 'Authorization: Bearer smgk_…' Subscribe an address to events
POST /v1/webhooks webhooks:write
The console's rules apply. The address must be https and on the public internet, and the events must be from the catalog. The address is checked again before every delivery. A business's programs can make 50 subscriptions between them. That's apart from the 10 its people can add on its Webhooks & API page. This answer is the only time you see the signing secret. Send an Idempotency-Key to make a retry safe.
| Field | Type | Notes |
|---|---|---|
url (required) | string | |
events (required) | array of string |
Answers 201 with CreatedWebhook; may refuse 403, 409, 422.
curl -X POST 'https://smg-api.smgtools.com/v1/webhooks' \
-H 'Authorization: Bearer smgk_…' \
-H 'Idempotency-Key: 7c1f0d52-first-try' \
-H 'Content-Type: application/json' \
-d '{"url":"https://example.com/hooks/smg","events":["lead.created"]}' Remove a subscription this key made
DELETE /v1/webhooks/{id} webhooks:write
Deliveries already sent aren't recalled. A subscription the key didn't make returns not_found. This works on every plan, so a business on Free can always remove a subscription, as it can always revoke a key.
| Parameter | In | Type |
|---|---|---|
id (required) | path | string (uuid) |
Answers 204; may refuse 403, 404.
curl -X DELETE 'https://smg-api.smgtools.com/v1/webhooks/3f2c9a1e-5b7d-4c2a-9e61-0a8d4b2c7f10' \
-H 'Authorization: Bearer smgk_…' The WebhookEvent record
| Field | Type | Notes |
|---|---|---|
name | string | |
description | string | |
fields | array of string | |
sample | WebhookBody | A body shaped like a delivery of this event, with event, occurredAt, organizationId, isTest and the fields under data. It has made-up values, isTest true and no delivery id. A program can show it before the business has an example of its own. |
The WebhookBody record
| Field | Type | Notes |
|---|---|---|
event | string | The event's name on the catalog, such as invoice.paid. |
occurredAt | string (date-time) | |
organizationId | string (uuid) | The business it happened in. |
isTest | boolean | True for a sample or a test send, false for something that happened. |
data | object | The event's fields, as /v1/webhooks/events lists them. |
The Webhook record
| Field | Type | Notes |
|---|---|---|
id | string (uuid) | |
url | string | |
events | array of string | The events it gets, named as in the catalog at /v1/webhooks/events. |
status | string | Active, Paused or Disabled. Paused means SMG Tools stopped sending after failed deliveries, and the business has to resume it. |
createdAt | string (date-time) |
The CreatedWebhook record
| Field | Type | Notes |
|---|---|---|
webhook | Webhook | |
secret | string | Use it to verify each delivery's X-SmgTools-Signature: t=<timestamp>,v1=<hex>, where v1 is HMAC-SHA256 of <timestamp>.<body> under this secret. |
The help page Connect a program with an API key covers the business’s side: making a key, choosing what it may do, seeing what it has been doing and revoking it. Use of the API is on the Terms of Use, section 8.13.