GraphQL Mutations (Write)

Create, update and delete records via GraphQL

6 min read

From the Business tier, the GraphQL endpoint supports 9 write mutations: create/update/delete on Work Orders, Assets and Parts. Mutations delegate to the same underlying services as REST, so audit logs, notifications and reference auto-generation (WO-XX, ASS-XX, PART-XX) all work consistently.

Available mutations

  • createWorkOrder(input) โ†’ WorkOrder
  • updateWorkOrder(id, input) โ†’ WorkOrder
  • deleteWorkOrder(id) โ†’ DeleteResult
  • createAsset(input) โ†’ Asset
  • updateAsset(id, input) โ†’ Asset
  • deleteAsset(id, force?) โ†’ DeleteResult
  • createPart(input) โ†’ Part
  • updatePart(id, input) โ†’ Part
  • deletePart(id, force?) โ†’ DeleteResult

Input shape

Each mutation has an InputType with safe fields only โ€” companyId, sequenceNumber, reference and createdById are filled server-side. You only pass title, description, status, priority, assetId, locationId, etc.

Example: create a work order

mutation($i: WorkOrderCreateInput!) { createWorkOrder(input: $i) { id title reference status createdAt } } with variables {"i": {"title": "Pump #3 leak", "priority": "HIGH"}}.

Attribution

Public API requests don't have a logged-in user, so mutations are attributed to the first ADMIN of the company (or any active user as fallback). Audit logs always show a real human, never NULL.

Common errors

  • GRAPHQL_VALIDATION_FAILED โ€” input shape doesn't match (e.g. missing required title)
  • BAD_REQUEST โ€” value validation failed (e.g. title > 500 chars)
  • FORBIDDEN โ€” your tier is below Business
  • NOT_FOUND โ€” id doesn't exist or belongs to another company

Tip

If you get a DateTime serialization error, check your client's DateTime scalar โ€” FreeMaint emits ISO 8601 strings.

Was this page helpful?