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
writepermission - 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.

Leave a Reply