---
title: "How to create a GraphQL mutation?"
url: "https://academy.jahia.com/sites/academy/contents/knowledge-base/2025/how-to-create-a-graphql-mutation.html"
last_updated: 2026-10-01
---

# How to create a GraphQL mutation?

Developer Jahia 8.2

## Question

How to create a GraphQL mutation? I try to create one by using GraphQl-java.annotations.
In which file do I have to write this:

```
GraphQLSchema schema = AnnotationsSchemaCreator.newAnnotationsSchema()
.mutation(Mutation.class) // to create your mutation object
.build();
```

## Answer

This code should not be necessary to create a new GraphQL mutation. You need to implement a class implementing DXGraphQLExtensionsProvider, which will return a list of types to add to the schemas. The types are generated from plain Java classes annotated with graphql-java-annotations (cf. [this documentation](https://academy.jahia.com/documentation/jahia-cms/jahia-8.2/developer/working-with-our-apis/graphql-api/using-graphql-to-perform-queries)).

Here are also some examples of source code:

- [https://github.com/Jahia/graphql-core/tree/master/graphql-extension-example](https://github.com/Jahia/graphql-core/tree/master/graphql-extension-example)
- [https://github.com/Jahia/translation-deepl/tree/1_2_0](https://github.com/Jahia/translation-deepl/tree/1_2_0)
