> For the complete documentation index, see [llms.txt](https://docs.bunny.com/developer/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.bunny.com/developer/using-the-graphql-api/mutations.md).

# Mutations

Mutations are used to create, update or delete objects in Bunny.

Building the mutation request is similar to building a query in the sense that you will construct a query and supply a set of input attributes. However, with mutations you can also control the type and fields that are returned once the mutation has completed.

For example, to [create an account](https://github.com/bunnyapp/docs-developer/blob/main/using-the-graphql-api/broken-reference/README.md) and then return the id and name of the new account your mutation will look like this.

{% code overflow="wrap" %}

```graphql
mutation accountCreate ($attributes: AccountAttributes!) {
  accountCreate (attributes: $attributes) {
      account {
        id
        name
      }
      errors
  }
}
```

{% endcode %}

You will also need to supply [valid attributes for creating an account](/developer/api-reference/types/accountattributes.md) like this

```json
{
  "accountTypeId": "456123",
  "industryId": "456123",
  "employees": 123,
  "annualRevenue": 123,
  "name": "",
  "billingStreet": "",
  "billingCity": "",
  "billingState": "",
  "billingZip": "",
  "billingCountry": "",
  "billingEmail": "",
  "shippingStreet": "",
  "shippingCity": "",
  "shippingState": "",
  "shippingZip": "",
  "shippingCountry": "",
  "description": "",
  "phone": "",
  "fax": "",
  "website": "",
  "currencyId": "456123",
  "groupId": "456123",
  "netPaymentDays": 123,
  "duns": "",
  "ownerUserId": "456123"
}
```

To make the request simply combine the mutation query and attributes.

{% tabs %}
{% tab title="Curl" %}

```bash
curl -XPOST 'https://<subdomain>.bunny.com/graphql' \
--header 'Authorization: Bearer <access_token>' \
--header 'Content-Type: application/json' \
--data-raw '{"query":"mutation accountCreate ($attributes: AccountAttributes!) {\n    accountCreate (attributes: $attributes) {\n        account {\n            id\n            name\n        }\n        errors\n    }\n}","variables":{"attributes":{"accountTypeId":0,"industryId":0,"employees":0,"annualRevenue":0,"name":"","billingStreet":"","billingCity":"","billingState":"","billingZip":"","billingCountry":"","billingEmail":"","shippingStreet":"","shippingCity":"","shippingState":"","shippingZip":"","shippingCountry":"","description":"","phone":"","fax":"","website":"","currencyId":0,"groupId":0,"netPaymentDays":0,"duns":"","ownerUserId":0}}}'
```

{% endtab %}

{% tab title="Ruby" %}

```ruby
query = <<~'GRAPHQL'
mutation accountCreate ($attributes: AccountAttributes!) {
  accountCreate (attributes: $attributes) {
      account {
        id
        name
      }
      errors
  }
}
GRAPHQL

variables = {
  "accountTypeId": "456123",
  "industryId": "456123",
  "employees": 123,
  "annualRevenue": 123,
  "name": "",
  "billingStreet": "",
  "billingCity": "",
  "billingState": "",
  "billingZip": "",
  "billingCountry": "",
  "billingEmail": "",
  "shippingStreet": "",
  "shippingCity": "",
  "shippingState": "",
  "shippingZip": "",
  "shippingCountry": "",
  "description": "",
  "phone": "",
  "fax": "",
  "website": "",
  "currencyId": "456123",
  "groupId": "456123",
  "netPaymentDays": 123,
  "duns": "",
  "ownerUserId": "456123"
}

response = BunnyApp.query(query, variables)
```

{% endtab %}

{% tab title="Javascript" %}

```javascript
const query = `mutation accountCreate ($attributes: AccountAttributes!) {
  accountCreate (attributes: $attributes) {
      account {
        id
        name
      }
      errors
  }
}`;

const variables = {
  "accountTypeId": "456123",
  "industryId": "456123",
  "employees": 123,
  "annualRevenue": 123,
  "name": "",
  "billingStreet": "",
  "billingCity": "",
  "billingState": "",
  "billingZip": "",
  "billingCountry": "",
  "billingEmail": "",
  "shippingStreet": "",
  "shippingCity": "",
  "shippingState": "",
  "shippingZip": "",
  "shippingCountry": "",
  "description": "",
  "phone": "",
  "fax": "",
  "website": "",
  "currencyId": "456123",
  "groupId": "456123",
  "netPaymentDays": 123,
  "duns": "",
  "ownerUserId": "456123"
};

const response = await bunny.query(query, variables);
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.bunny.com/developer/using-the-graphql-api/mutations.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
