How to Use GraphQL Mutations for CRUD in Perfex CRM

How to Use GraphQL Mutations for CRUD in Perfex CRM

Write Operations in GraphQL

GraphQL mutations let you create, update, and delete records in Perfex CRM through the same POST /graphql endpoint used for queries. Data Builder auto-generates mutation types for every whitelisted table.

Create Records

mutation {
  createClient(input: {
    company: "New Company Ltd"
    phonenumber: "+84 123 456 789"
    city: "Ho Chi Minh City"
    country: "243"
    default_language: "vietnamese"
  }) {
    userid company city
  }
}

The response returns only the fields you requested. Input types are auto-generated from the table schema.

Update Records

mutation {
  updateProject(id: 42, input: {
    name: "Updated Project Name"
    deadline_date: "2026-06-30"
    status: 2
  }) {
    id name deadline_date status
  }
}

Delete Records

mutation {
  deleteExpense(id: 15) {
    success
    message
  }
}

Security Controls

  • Write scope required – Token must have write permission
  • Per-table CRUDConfigure which tables allow create/update/delete
  • Column exclusions – Security columns (passwords, tokens, salts, API keys) are automatically excluded from input types
  • Primary key detection – Auto-detects table primary key for update/delete operations

Mutations vs REST Write

OperationRESTGraphQL
CreatePOST /clientsmutation { createClient(input: {...}) }
UpdatePUT /clients/42mutation { updateClient(id: 42, input: {...}) }
DeleteDELETE /clients/42mutation { deleteClient(id: 42) }
ResponseFull recordOnly requested fields

For read operations, see the complete GraphQL querying guide. For an overview of both approaches, see REST vs GraphQL comparison.

Test Mutations

Use the API Explorer GraphQL sandbox to test mutations live. You can also import the Postman Collection which includes pre-built mutation examples.


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *