Back to Main Site

How to Use GraphQL Mutations for CRUD in Perfex CRM

Last updated on Aug 24, 2026 12:18 PM 12:18 PM 1,529.34 ms

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 CRUD - Configure 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

Operation REST GraphQL
Create POST /clients mutation { createClient(input: {...}) }
Update PUT /clients/42 mutation { updateClient(id: 42, input: {...}) }
Delete DELETE /clients/42 mutation { deleteClient(id: 42) }
Response Full record Only 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.

Data Builder — Visual Reporting, REST API & GraphQL for Perfex CRM

Create powerful cross-module reports in Perfex CRM — no SQL, just a visual builder for datasets, filters, and charts.

Transform Perfex CRM into an API-first platform with unified GraphQL and REST APIs for core Perfex CRM tables, custom datasets, reports, and third-party module data.
Secure and scale your data workflows with granular permissions, tokenized access control, and reusable API-driven data assets.