Documentation Index
Fetch the complete documentation index at: https://mintlify.com/OpsMill/infrahub/llms.txt
Use this file to discover all available pages before exploring further.
Mutations allow you to modify data in Infrahub. Each node type supports Create, Update, Delete, and Upsert operations.
Mutation Types
Infrahub provides four standard mutation types for most node kinds:
- Create - Create a new node
- Update - Update an existing node
- Delete - Delete a node
- Upsert - Create or update a node based on whether it exists
Branch Mutations
Create Branch
Create a new branch in Infrahub.
mutation {
BranchCreate(
data: {
name: "feature-branch"
description: "Working on new features"
sync_with_git: true
}
wait_until_completion: true
) {
ok
object {
id
name
description
created_at
}
task {
id
}
}
}
data
BranchCreateInput
required
Branch configuration data
Description of the branch
Whether to sync this branch with Git repositories
Wait for the branch creation to complete (default: true)
Merge Branch
Merge a branch into the default branch.
mutation {
BranchMerge(
data: { name: "feature-branch" }
wait_until_completion: true
) {
ok
object {
id
name
status
}
task {
id
}
}
}
Rebase Branch
Rebase a branch to align with the default branch.
mutation {
BranchRebase(
data: { name: "feature-branch" }
wait_until_completion: true
) {
ok
object {
id
name
}
}
}
Delete Branch
Delete a branch.
mutation {
BranchDelete(
data: { name: "feature-branch" }
) {
ok
task {
id
}
}
}
Validate Branch
Trigger validation checks on a branch.
mutation {
BranchValidate(
data: { name: "feature-branch" }
wait_until_completion: false
) {
ok
task {
id
}
}
}
Node CRUD Operations
Create Node
Create a new node instance.
mutation {
BuiltinTagCreate(
data: {
name: { value: "production" }
description: { value: "Production environment resources" }
}
) {
ok
object {
id
name {
value
}
description {
value
}
}
}
}
Optional context to override account information
Node data including all attributes and relationships
Each attribute accepts an object with:
Mark the attribute as protected from changes
ID of the source node for lineage tracking
ID of the owner node for lineage tracking
Update Node
Update an existing node.
mutation {
BuiltinTagUpdate(
data: {
id: "17e19fa3-ad6c-a26c-0dae-c698251ba1d1"
description: { value: "Updated description" }
}
) {
ok
object {
id
name {
value
}
description {
value
updated_at
}
}
}
}
You can also use hfid (Human Friendly ID) instead of id:
Human-friendly identifier array for the node
Delete Node
Delete a node by ID.
mutation {
BuiltinTagDelete(
data: { id: "17e19fa3-ad6c-a26c-0dae-c698251ba1d1" }
) {
ok
}
}
Upsert Node
Create a node if it doesn’t exist, or update it if it does.
mutation {
BuiltinTagUpsert(
data: {
name: { value: "production" }
description: { value: "Production environment" }
}
) {
ok
object {
id
name {
value
}
}
}
}
Account Management
Create Account
mutation {
CoreAccountCreate(
data: {
name: { value: "john.doe" }
account_type: { value: "User" }
password: { value: "secure_password_here" }
status: { value: "active" }
}
) {
ok
object {
id
name {
value
}
account_type {
value
}
}
}
}
Create Account Group
mutation {
CoreAccountGroupCreate(
data: {
name: { value: "Engineering" }
label: { value: "eng" }
description: { value: "Engineering team" }
group_type: { value: "default" }
}
) {
ok
object {
id
name {
value
}
}
}
}
Create Account Role
mutation {
CoreAccountRoleCreate(
data: {
name: { value: "Administrator" }
permissions: [
{ id: "permission-id-1" }
{ id: "permission-id-2" }
]
}
) {
ok
object {
id
name {
value
}
}
}
}
IP Address Management
Update IP Address
mutation {
BuiltinIPAddressUpdate(
data: {
id: "abc-123-def"
description: { value: "Gateway address" }
address: { value: "192.168.1.1/24" }
}
) {
ok
object {
id
address {
value
}
description {
value
}
}
}
}
Update IP Prefix
mutation {
BuiltinIPPrefixUpdate(
data: {
id: "prefix-id"
is_pool: { value: true }
member_type: { value: "address" }
description: { value: "DHCP pool" }
}
) {
ok
object {
id
prefix {
value
}
is_pool {
value
}
}
}
}
Relationships
When creating or updating nodes with relationships, use the relationship input format:
mutation {
CoreArtifactDefinitionCreate(
data: {
name: { value: "device-config" }
targets: [
{ id: "group-id-1" }
{ id: "group-id-2" }
]
transformation: { id: "transform-id" }
repository: { id: "repo-id" }
}
) {
ok
object {
id
name {
value
}
}
}
}
Human-friendly identifier of the related node
Context Override
You can override the account context for mutations:
mutation {
CoreAccountCreate(
context: {
account: { id: "admin-account-id" }
}
data: {
name: { value: "new.user" }
account_type: { value: "User" }
}
) {
ok
object {
id
}
}
}
Response Structure
All mutations return a consistent response:
Whether the mutation succeeded
The created or updated node (not present for Delete mutations)
Background task information for long-running operations
Example: Complex Create
mutation CreateTransformation {
CoreTransformJinja2Create(
data: {
name: { value: "device-configuration" }
description: { value: "Generate device configs" }
template_path: { value: "templates/device-config.j2" }
query: { id: "query-id" }
repository: { id: "repo-id" }
tags: [
{ id: "tag-1" }
{ id: "tag-2" }
]
timeout: { value: 300 }
}
) {
ok
object {
id
name {
value
}
template_path {
value
}
query {
node {
name {
value
}
}
}
}
}
}
See Also