{"id":14976049,"url":"https://github.com/kevinadhiguna/strapi-graphql-documentation","last_synced_at":"2025-10-27T17:30:41.941Z","repository":{"id":49598279,"uuid":"338402295","full_name":"kevinadhiguna/strapi-graphql-documentation","owner":"kevinadhiguna","description":"Collections of queries and mutations that hopefully help you in a Strapi project powered by GraphQL API 🚀","archived":false,"fork":false,"pushed_at":"2022-09-08T02:10:42.000Z","size":1454,"stargazers_count":48,"open_issues_count":0,"forks_count":12,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-09-28T21:23:30.374Z","etag":null,"topics":["documentation","graphql","graphql-api","mutation","query","strapi","strapi-graphql","strapi-graphql-documentation"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kevinadhiguna.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-02-12T18:38:23.000Z","updated_at":"2024-08-23T08:35:57.000Z","dependencies_parsed_at":"2022-08-31T20:51:41.540Z","dependency_job_id":null,"html_url":"https://github.com/kevinadhiguna/strapi-graphql-documentation","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kevinadhiguna%2Fstrapi-graphql-documentation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kevinadhiguna%2Fstrapi-graphql-documentation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kevinadhiguna%2Fstrapi-graphql-documentation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kevinadhiguna%2Fstrapi-graphql-documentation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kevinadhiguna","download_url":"https://codeload.github.com/kevinadhiguna/strapi-graphql-documentation/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":219860931,"owners_count":16556009,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["documentation","graphql","graphql-api","mutation","query","strapi","strapi-graphql","strapi-graphql-documentation"],"created_at":"2024-09-24T13:53:13.191Z","updated_at":"2025-10-27T17:30:36.572Z","avatar_url":"https://github.com/kevinadhiguna.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"https://raw.githubusercontent.com/kevinadhiguna/strapi-graphql-documentation/master/assets/images/strapql.png\" /\u003e\n  \u003ch3 align=\"center\"\u003eStrapi GraphQL API Documentation\u003c/h3\u003e\n\n  \u003cp align=\"center\"\u003e\n    Collections of GraphQL queries and mutations that power your Strapi app!\n    \u003cbr /\u003e\n    \u003ca href=\"https://github.com/kevinadhiguna/strapi-graphql-documentation#-table-of-contents\"\u003e\u003cstrong\u003eExplore the docs »\u003c/strong\u003e\u003c/a\u003e\n    \u003cbr /\u003e\n    \u003cbr /\u003e\n    \u003ca href=\"https://github.com/kevinadhiguna/strapi-graphql-documentation/issues\"\u003eReport Bug\u003c/a\u003e\n    ·\n    \u003ca href=\"https://github.com/kevinadhiguna/strapi-graphql-documentation/issues\"\u003eRequest Feature\u003c/a\u003e\n  \u003c/p\u003e\n\u003c/div\u003e\n\u003cbr\u003e\n\n\u003c!-- TABLE OF CONTENTS --\u003e\n## 📚 Table of Contents\n\n1. [About Strapql](#-about-strapql)\n2. [Queries and Mutations](#-queries-and-mutations)\n    - [Register](#%EF%B8%8F-register)\n    - [Login](#-login)\n    - [Me Query](#-me-query)\n      - [How to attach JWT in headers](#-how-to-attach-jwt-in-headers-)\n    - [Create a user in Users](#-create-a-user-in-users-a-collection-type-that-comes-default-in-strapi-app)\n      - [How to get Superadmin's JWT](#-how-to-get-superadmins-jwt)\n    - [Retrieve/Fetch a single User](#-retrievefetch-a-single-user)\n    - [Retrieve/Fetch all Users](#-retrievefetch-all-users)\n    - [Update a User](#-update-a-user)\n    - [Delete/Remove a User](#-deleteremove-a-user)\n    - [Create an Entry in a Collection Type](#-create-an-entry-in-a-collection-type)\n    - [Fetch/Retrieve a single entry in collection type](#-fetchretrieve-a-single-entry-in-collection-type)\n    - [Fetch/Retrieve all entries in collection type](#-fetchretrieve-all-entries-in-collection-type)\n    - [Update an entry in collection type](#-update-an-entry-in-collection-type)\n    - [Delete/Remove an entry in collection type](#-deleteremove-an-entry-in-collection-type)\n    - [Upload a single image](#-%EF%B8%8F-upload-a-single-image)\n    - [Upload multiple images in a single field](#-%EF%B8%8F-upload-multiple-images-in-a-single-field)\n    - [Upload a single image in separate fields](#-%EF%B8%8F-upload-a-single-image-in-separate-fields)\n      - [How does `UploadSingleImageToSeveralFields` mutation work ?](#-how-does-uploadsingleimagetoseveralfields-mutation-work-)\n    - [Get all files](#-get-all-files)\n    - [Fetch a single role](#-fetch-a-single-role)\n    - [Fetch all roles](#---fetch-all-roles)\n3. [Contributing](#-contributing)\n4. [Contact](#-contact)\n5. [Acknowledgements](#-acknowledgements)\n\n\u003c!--\n\u003col\u003e\n  \u003cli\u003e\n    \u003ca href=\"#-about-strapql\"\u003eAbout Strapql\u003c/a\u003e\n  \u003c/li\u003e\n  \u003cli\u003e\n    \u003ca href=\"#-queries-and-mutations\"\u003eQueries and Mutations\u003c/a\u003e\n  \u003c/li\u003e\n  \u003cli\u003e\u003ca href=\"#-contributing\"\u003eContributing\u003c/a\u003e\u003c/li\u003e\n  \u003cli\u003e\u003ca href=\"#-contact\"\u003eContact\u003c/a\u003e\u003c/li\u003e\n  \u003cli\u003e\u003ca href=\"#-acknowledgements\"\u003eAcknowledgements\u003c/a\u003e\u003c/li\u003e\n\u003c/ol\u003e\n--\u003e\n\n## 🌟 About Strapql\n\nHello there, welcome to Strapi GraphQL API documentation! This contains some of queries and mutations that hopefully helps you if you are using GraphQL API in your Strapi project :)\n\n## 🌈 Queries and Mutations\n\n- Queries are used to read or fetch values (`READ`/`RETRIEVE`).\n- Mutations modify data in the data store and returns a value. It can be used to insert, update, or delete data (`CREATE`, `UPDATE`, and `DELETE`).\n\u003cbr\u003e (Source : [TutorialsPoint](https://www.tutorialspoint.com/graphql/index.htm))\n\n## ®️ Register\nJust like any other applications that requires you to create an account, you have to sign up first to create a user in `users` collection type that comes default in Strapi. Here is how to register an account :\n```graphql\nmutation Register($input: UsersPermissionsRegisterInput!) {\n  register(input: $input) {\n    jwt\n    user {\n      username\n      email\n    }\n  }\n}\n```\n\nNext, put your `username`, `email`, and `password` as variables :\n```json\n{\n  \"input\": {\n    \"username\": \"YOUR_USERNAME\",\n    \"email\": \"YOUR_EMAIL\",\n    \"password\": \"YOUR_PASSWORD\"\n  }\n}\n```\nFinally, a JWT shows in response.\n\n\u003cbr /\u003e **[⬆ back to top](#-table-of-contents)** \u003cbr /\u003e\u003cbr /\u003e\n\n## 🔒 Login\n```graphql\nmutation Login($input: UsersPermissionsLoginInput!) {\n  login(input: $input) {\n    jwt\n    user {\n      username\n      email\n      confirmed\n      blocked\n      role {\n        id\n        name\n        description\n        type\n      }\n    }\n  }\n}\n```\n\nThen enter your `identifier` and `password` as variables :\n```json\n{\n  \"input\": {\n    \"identifier\": \"YOUR_USERNAME OR YOUR EMAIL\",\n    \"password\": \"YOUR_PASSWORD\"\n  }\n}\n```\nEventually, you will get JWT in response.\n\n\u003cbr /\u003e **[⬆ back to top](#-table-of-contents)** \u003cbr /\u003e\u003cbr /\u003e\n\n## 🙋 Me Query\n\nTo identify current user, you can use `me` query, like this :\n```graphql\nquery MeQuery {\n  me {\n    id\n    username\n    email\n    confirmed\n    blocked\n    role {\n      id\n      name\n      description\n      type\n    }\n  }\n}\n```\n\u003cb\u003eNote : `me` query requires JWT attached in headers!\u003c/b\u003e\n\n### 📎 How to attach JWT in headers :\n`authorization : Bearer YOUR_TOKEN`\n\n\u003cbr /\u003e **[⬆ back to top](#-table-of-contents)** \u003cbr /\u003e\u003cbr /\u003e\n\n## 🆕 Create a User in Users (a collection type that comes default in Strapi app)\n\u003eWhat? Create a User? Did I just create a User using `Registration` mutation above?\n\nSure, here is some notable points :\n|                                            |                `Create User` mutation                |                                   `Registration` mutation                                   |\n|:------------------------------------------:|:----------------------------------------------------:|:-------------------------------------------------------------------------------------------:|\n|       Needs JWT attached in Headers?       | Yes, usually you must be `superadmin` role in Strapi |                                              No                                             |\n| Is created user `authenticated` initially? |                          No                          | Yes, users that are created with `Registration` mutation is already authenticated initially |\n\n```graphql\nmutation CreateUser($input: createUserInput) {\n  createUser(input: $input) {\n    user {\n      id\n      createdAt\n      updatedAt\n      username\n      email\n      provider\n      confirmed\n      blocked\n      role {\n        id\n        name\n        description\n        type\n        permissions {\n          type\n          controller\n          action\n          enabled\n          policy\n          role {\n            name\n          }\n        }\n        users {\n          username\n        }\n      }\n    }\n  }\n}\n```\n\nPass these variables :\n```json\n{\n  \"input\": {\n    \"data\": {\n      \"username\": \"YOUR_USERNAME\",\n      \"email\": \"YOUR_EMAIL\",\n      \"password\": \"YOUR_PASSWORD\"\n    }\n  }\n}\n```\n\u003cb\u003eNote : Please attach a JWT in Headers, usually Superadmin's JWT.\u003c/b\u003e\n\n\u003cbr /\u003e **[⬆ back to top](#-table-of-contents)** \u003cbr /\u003e\u003cbr /\u003e\n\n### 🔑 How to get Superadmin's JWT\n\nGo to `Documentation` in the menu on the left side -\u003e Copy the token in `Retrieve your jwt token`.\n\n\u003cbr /\u003e **[⬆ back to top](#-table-of-contents)** \u003cbr /\u003e\u003cbr /\u003e\n\n## 🧑 Retrieve/Fetch a single User\n\nPreviously, we created a new user. To retrieve a specific user inside User collection type, you can make use of this query :\n```graphql\nquery FetchSingleUser($id: ID!) {\n  user(id: $id) {\n    id\n    createdAt\n    updatedAt\n    username\n    email\n    provider\n    confirmed\n    blocked\n    role {\n      name\n    }\n  }\n}\n```\n\nVariables :\n```json\n{\n  \"id\": \"YOUR_USER_ID\"\n}\n```\n\n\u003cbr /\u003e **[⬆ back to top](#-table-of-contents)** \u003cbr /\u003e\u003cbr /\u003e\n\n## 👥 Retrieve/Fetch all Users\n\nIf you want to get all users in your Strapi app, this is the query you are looking for : \n```graphql\nquery FetchUsers {\n  users {\n    id\n    createdAt\n    updatedAt\n    username\n    email\n    provider\n    confirmed\n    blocked\n    role {\n      name\n    }\n  }\n}\n```\n\nYou do not have to pass any variables but you may need to attach JWT in your headers (depends on your Strapi app's roles \u0026 permissions).\n\n\u003cbr /\u003e **[⬆ back to top](#-table-of-contents)** \u003cbr /\u003e\u003cbr /\u003e\n\n## 🔄 Update a User\n\nImagine you want to change a user's email. To do such things, you should use a mutation which updates the user's data. Here is an example to change a user's email :\n```graphql\nmutation UpdateUser($input: updateUserInput) {\n  updateUser(input: $input) {\n    user {\n      id\n      createdAt\n      updatedAt\n      username\n      email\n      provider\n      confirmed\n      blocked\n      role {\n        name\n      }\n    }\n  }\n}\n```\n\nThen pass some variables that you would like to change (in this case, `email` field) :\n```json\n{\n  \"input\": {\n    \"where\": {\n      \"id\": \"YOUR_USER_ID\"\n    },\n    \"data\": {\n      \"email\": \"YOUR_USER_EMAIL\"\n    } \n  }\n}\n```\n\nIf you want to change fields other than `email`, just replace the `email` variable.\n\n\u003cbr /\u003e **[⬆ back to top](#-table-of-contents)** \u003cbr /\u003e\u003cbr /\u003e\n\n## ❌ Delete/Remove a User\n\n\u003eA user decided to no longer use my app. How do I remove him/her?\n\nHere is a mutation that might do the task :\n```graphql\nmutation deleteUser($input: deleteUserInput) {\n  deleteUser(input: $input) {\n    user {\n      id\n      createdAt\n      updatedAt\n      username\n      email\n      provider\n      confirmed\n      blocked\n      role {\n        name\n      }\n    }\n  }\n}\n```\n\nPlace the user ID of the user you want to remove as a variable :\n```json\n{\n  \"input\": {\n    \"where\": {\n      \"id\": \"YOUR_USER_ID\"\n    }\n  }\n}\n```\n\n\u003cb\u003eNote : Please carefully control which roles are able to conduct `delete` operation as it is sensitive.\u003c/b\u003e\n\n\u003cbr /\u003e **[⬆ back to top](#-table-of-contents)** \u003cbr /\u003e\u003cbr /\u003e\n\n\u003chr /\u003e\n\n## 👨‍💻 Let's practice CRUD operations using GraphQL !\n\nYou can think collection-type as an API generated by Strapi. Let's imagine Juventus FC, an Italian football club, as a `Juventus` collection-type. This is how it looks :\u003cbr/\u003e\n\n\u003cimg src=\"https://s6.gifyu.com/images/juventus.png\" alt=\"Collection-Type\" border=\"0\" /\u003e\u003cbr/\u003e\n\n📁 The Strapi app with the `Juventus` content-type above that can be used within this docs is here : [Strapi Dockerize](https://github.com/kevinadhiguna/strapi-dockerize).\u003cbr/\u003e\nFeel free to clone or fork it !\n\nThe `position` has enumeration data type but this is how the auto-generated GraphQL schema (only for the `Juventus` content-type data) looks :\n```graphql\nenum ENUM_JUVENTUS_POSITION {\n  GK\n  DF\n  MF\n  FW\n}\n\ntype Juventus {\n  id: ID!\n  _id: ID!\n  createdAt: DateTime!\n  updatedAt: DateTime!\n  name: String\n  number: Int\n  age: Int\n  country: String\n  appearences: Int\n  goals: Int\n  minutesPlayed: Int\n  position: ENUM_JUVENTUS_POSITION\n  profpic: UploadFile\n  published_at: DateTime\n}\n```\n\nNow, it is clear that available options for `position` are : `GK`. `DF`, `MF`, `FW`.\n\n## 🆕 Create an Entry in a Collection Type\n\nFor example, Juventus FC buys a new player. Here is how you can add a new record inside it :\n```graphql\nmutation AddSingleJuventusPlayer($input: createJuventusInput) {\n  createJuventus(input: $input) {\n    juventus {\n      id\n      _id\n      createdAt\n      updatedAt\n      name\n      number\n      age\n      country\n      appearences\n      goals\n      minutesPlayed\n      position\n      published_at\n    }\n  }\n}\n```\n\nHere are variables you should pass :\n```json\n{\n  \"input\": {\n    \"data\": {\n      \"name\": \"\",\n      \"number\": ,\n      \"age\": ,\n      \"country\": \"\",\n      \"appearences\": ,\n      \"goals\": ,\n      \"minutesPlayed\": ,\n      \"position\": \"\"\n    }\n  }\n}\n```\n\nFor instance :\n```json\n{\n  \"input\": {\n    \"data\": {\n      \"name\": \"Radu Dragusin\",\n      \"number\": 37,\n      \"age\": 19,\n      \"country\": \"Romania\",\n      \"appearences\": 14,\n      \"goals\": 1,\n      \"minutesPlayed\": 1111,\n      \"position\": \"DF\"\n    }\n  }\n}\n```\n\nYou will see a response like this if successful:\n```json\n{\n  \"data\": {\n    \"createJuventus\": {\n      \"juventus\": {\n        \"id\": \"60df54f39bc9f96f94bd7db5\",\n        \"_id\": \"60df54f39bc9f96f94bd7db5\",\n        \"createdAt\": \"2021-02-02T18:03:31.447Z\",\n        \"updatedAt\": \"2021-02-02T18:03:31.447Z\",\n        \"name\": \"Radu Dragusin\",\n        \"number\": 37,\n        \"age\": 19,\n        \"country\": \"Romania\",\n        \"appearences\": 14,\n        \"goals\": 1,\n        \"minutesPlayed\": 1111,\n        \"position\": \"DF\",\n        \"published_at\": \"2021-02-02T18:03:31.427Z\"\n      }\n    }\n  }\n}\n```\n\n\u003cbr /\u003e **[⬆ back to top](#-table-of-contents)** \u003cbr /\u003e\u003cbr /\u003e\n\n## 📮 Fetch/Retrieve a single entry in collection type\n\nTo fetch an entry in your collection type, this query is probably able help you :\n```graphql\nquery FetchSingleJuventusPlayer($id: ID!) {\n  juventus(id: $id) {\n    id\n    _id\n    createdAt\n    updatedAt\n    name\n    number\n    age\n    country\n    appearences\n    goals\n    minutesPlayed\n    position\n    profpic {\n      name\n      url\n      provider\n    }\n    published_at\n  }\n}\n\n```\n\nPass the ID of the record/entry you want to fetch :\n```json\n{\n  \"id\": \"ID_OF_ENTRY\"\n}\n```\n\nTo illustrate :\n```json\n{\n  \"id\": \"60df54f39bc9f96f94bd7db5\"\n}\n```\n\nThe response would be like :\n```json\n{\n  \"data\": {\n    \"juventus\": {\n      \"id\": \"60df54f39bc9f96f94bd7db5\",\n      \"_id\": \"60df54f39bc9f96f94bd7db5\",\n      \"createdAt\": \"2021-02-02T18:03:31.447Z\",\n      \"updatedAt\": \"2021-02-02T18:26:53.923Z\",\n      \"name\": \"Radu Dragusin\",\n      \"number\": 37,\n      \"age\": 19,\n      \"country\": \"Romania\",\n      \"appearences\": 14,\n      \"goals\": 1,\n      \"minutesPlayed\": 1111,\n      \"position\": \"DF\",\n      \"profpic\": {\n        \"name\": \"dragusin.png\",\n        \"url\": \"https://res.cloudinary.com/djmhwsmks/image/upload/v1625250418/dragusin_c28d444a3b.jpg\",\n        \"provider\": \"cloudinary\"\n      },\n      \"published_at\": \"2021-02-02T18:03:31.427Z\"\n    }\n  }\n}\n```\n\n📝 Note: To be able to see `profpic` in response, you should [upload a picture](#-%EF%B8%8F-upload-a-single-image) to the field. Otherwise it is null. Here, Cloudinary is the upload provider but you can use other options such as AWS S3 too.\n\n\u003cbr /\u003e **[⬆ back to top](#-table-of-contents)** \u003cbr /\u003e\u003cbr /\u003e\n\n## 📒 Fetch/Retrieve all entries in collection type\n\nThis may get you all the entries in your collection type :\n```graphql\nquery FetchAllJuventusPlayers {\n  juventuses {\n    id\n    _id\n    createdAt\n    updatedAt\n    name\n    number\n    age\n    country\n    appearences\n    goals\n    minutesPlayed\n    position\n    profpic {\n      name\n      url\n      provider\n    }\n    published_at\n  }\n}\n```\n\nYou do not pass any variables.\n\n\u003cbr /\u003e **[⬆ back to top](#-table-of-contents)** \u003cbr /\u003e\u003cbr /\u003e\n\n## 🔄 Update an entry in collection type\n\n```graphql\nmutation UpdateSingleJuventusPlayer($input: updateJuventusInput) {\n  updateJuventus(input: $input) {\n    juventus {\n      id\n      _id\n      createdAt\n      updatedAt\n      name\n      number\n      age\n      country\n      appearences\n      goals\n      minutesPlayed\n      position\n      profpic {\n        name\n        url\n        provider\n      }\n      published_at\n    }\n  }\n}\n```\n\nYou may change the variable like this :\n```json\n{\n  \"input\": {\n    \"where\": {\n      \"id\": \"ID_OF_ENTRY\"\n    },\n    \"data\": {\n      \"FIELD_1_TO_CHANGE\": \"NEW_VALUE_OF_FIELD_1\",\n      \"FIELD_2_TO_CHANGE\": \"NEW_VALUE_OF_FIELD_2\",\n      \"FIELD_3_TO_CHANGE\": \"NEW_VALUE_OF_FIELD_3\"\n    }\n  }\n}\n```\n\nIn the example above, you are changing three fields. However, you can change only one field as well.  \n\nPretend that a player scored 3 goals in 17 appearences throughout a season. With that being said, minutes the player has played raised to 1381 minutes. You may want to do :\n```json\n{\n  \"input\": {\n    \"where\": {\n      \"id\": \"60df54f39bc9f96f94bd7db5\"\n    },\n    \"data\": {\n      \"appearences\": 17,\n      \"goals\": 3,\n      \"minutesPlayed\": 1381\n    }\n  }\n}\n```\n\nThe response should include the fields with the updated value :\n```json\n{\n  \"data\": {\n    \"updateJuventus\": {\n      \"juventus\": {\n        \"id\": \"60df54f39bc9f96f94bd7db5\",\n        \"_id\": \"60df54f39bc9f96f94bd7db5\",\n        \"createdAt\": \"2021-02-02T18:03:31.447Z\",\n        \"updatedAt\": \"2021-02-02T18:08:19.204Z\",\n        \"name\": \"Radu Dragusin\",\n        \"number\": 37,\n        \"age\": 19,\n        \"country\": \"Romania\",\n        \"appearences\": 17,\n        \"goals\": 3,\n        \"minutesPlayed\": 1381,\n        \"position\": \"DF\",\n        \"profpic\": {\n          \"name\": \"dragusin.png\",\n          \"url\": \"https://res.cloudinary.com/djmhwsmks/image/upload/v1625250418/dragusin_c28d444a3b.jpg\",\n          \"provider\": \"cloudinary\"\n        },\n        \"published_at\": \"2021-02-02T18:03:31.427Z\"\n      }\n    }\n  }\n}\n```\n\n\u003cbr /\u003e **[⬆ back to top](#-table-of-contents)** \u003cbr /\u003e\u003cbr /\u003e\n\n## ❌ Delete/Remove an entry in collection type\n\n```graphql\nmutation removeSingleJuventusPlayer($input: deleteJuventusInput) {\n  deleteJuventus(input: $input) {\n    juventus {\n      id\n      _id\n      createdAt\n      updatedAt\n      name\n      number\n      age\n      country\n      appearences\n      goals\n      minutesPlayed\n      minutesPlayed\n      position\n      profpic {\n        name\n        url\n        provider\n      }\n      published_at\n    }\n  }\n}\n```\n\nVariables :\n```json\n{\n  \"input\": {\n    \"where\": {\n      \"id\": \"ID_OF_ENTRY\"\n    }\n  }\n}\n```\n\nTo give you an idea, let's say a player is transferred to another football club. We pass the player's id as a variable this :\n```json\n{\n  \"input\": {\n    \"where\": {\n      \"id\": \"60df54f39bc9f96f94bd7db5\"\n    }\n  }\n}\n```\n\nAfter removed the player successfully, Strapi will send a response like this: \n```json\n{\n  \"data\": {\n    \"deleteJuventus\": {\n      \"juventus\": {\n        \"id\": \"60df54f39bc9f96f94bd7db5\",\n        \"_id\": \"60df54f39bc9f96f94bd7db5\",\n        \"createdAt\": \"2021-02-02T18:03:31.447Z\",\n        \"updatedAt\": \"2021-02-02T18:26:53.923Z\",\n        \"name\": \"Radu Dragusin\",\n        \"number\": 37,\n        \"age\": 19,\n        \"country\": \"Romania\",\n        \"appearences\": 17,\n        \"goals\": 3,\n        \"minutesPlayed\": 1381,\n        \"position\": \"DF\",\n        \"profpic\": {\n          \"name\": \"dragusin.png\",\n          \"url\": \"https://res.cloudinary.com/djmhwsmks/image/upload/v1625250418/dragusin_c28d444a3b.jpg\",\n          \"provider\": \"cloudinary\"\n        },\n        \"published_at\": \"2021-02-02T18:03:31.427Z\"\n      }\n    }\n  }\n}\n```\n\n\u003cbr /\u003e **[⬆ back to top](#-table-of-contents)** \u003cbr /\u003e\u003cbr /\u003e\n\n\u003chr /\u003e\n\n## 📤 🖼️ Upload a single image\n\n### ⚠️ Warning : Currently Strapi's GraphQL Playground does not support file/image upload. You can use other GraphQL client to test your GraphQL upload mutation.\nOne of the GraphQL clients alternaive is Altair. You can download it here : https://altair.sirmuel.design/#download\n\nPlease create a new entry in your collection type API first ! Otherwise this will not be attached to your entry.\nNote : the `refId` is the ID of the entry you create in your collection type API.\n```graphql\nmutation SingleImageUpload($refId: ID, $ref: String, $field: String, $file: Upload!) {\n  upload(refId: $refId, ref: $ref, field: $field, file: $file) {\n    id\n    createdAt\n    updatedAt\n    name\n    alternativeText\n    caption\n    width\n    height\n    formats\n    hash\n    ext\n    mime\n    size\n    url\n  }\n}\n```\n\nVariables :\n```json\n{\n  \"refId\": \"ID_OF_YOUR_ENTRY_IN_YOUR_COLLECTION_TYPE\",\n  \"ref\": \"YOUR_COLLECTION_TYPE_NAME\",\n  \"field\": \"FIELD_NAME\"\n}\n```\n\nHere is an example :\u003cbr/\u003e\n\u003cimg src=\"https://raw.githubusercontent.com/kevinadhiguna/strapi-graphql-documentation/master/assets/gif/singleImageUpload.gif\" /\u003e\n\n\u003cbr /\u003e **[⬆ back to top](#-table-of-contents)** \u003cbr /\u003e\u003cbr /\u003e\n\n## 📤 🖼️ Upload multiple images in a single field\n```graphql\nmutation MultipleImageUpload(\n  $refId: ID\n  $ref: String\n  $field: String\n  $files: [Upload]!\n) {\n  multipleUpload(refId: $refId, ref: $ref, field: $field, files: $files) {\n    id\n    createdAt\n    updatedAt\n    name\n    alternativeText\n    caption\n    width\n    height\n    formats\n    hash\n    ext\n    mime\n    size\n    url\n  }\n}\n```\n\nVariables :\n```json\n{\n  \"refId\": \"ID_OF_YOUR_ENTRY_IN_YOUR_COLLECTION_TYPE\",\n  \"ref\": \"YOUR_COLLECTION_TYPE_NAME\",\n  \"field\": \"FIELD_NAME\"\n}\n```\n\n\u003cb\u003eNote : In this case, I attached images with name `files.0`, `files.1`, ... , `files.n` as variables' names until the number of image you want to upload (n).\u003c/b\u003e\n\nHere is an example :\u003cbr/\u003e\n\u003cimg src=\"https://raw.githubusercontent.com/kevinadhiguna/strapi-graphql-documentation/master/assets/gif/multipleImageUpload.gif\" /\u003e\n\n\u003cbr /\u003e **[⬆ back to top](#-table-of-contents)** \u003cbr /\u003e\u003cbr /\u003e\n\n## 📤 🖼️ Upload a single image in separate fields\n\u003eHmm... but how do I upload a single image to several fields in a single request?\n\nAll right, imagine you created a collection type which has several fields, including `cardImage`, `facePhoto`, and `personWithCardPhoto`. Otherwise, just replace those fields with yours. Ok, here we go :\n```graphql\nmutation UploadSingleImageToSeveralFields(\n  $ref: String\n  $refId: ID\n  $cardImage: Upload!\n  $facePhoto: Upload!\n  $personWithCardPhoto: Upload!\n) {\n  cardImage: upload(\n    ref: $ref\n    refId: $refId\n    field: \"cardImage\"\n    file: $cardImage\n  ) {\n    id\n    createdAt\n    updatedAt\n    name\n    alternativeText\n    caption\n    width\n    height\n    formats\n    hash\n    ext\n    mime\n    size\n    url\n  }\n  facePhoto: upload(\n    ref: $ref\n    refId: $refId\n    field: \"facePhoto\"\n    file: $facePhoto\n  ) {\n    id\n    createdAt\n    updatedAt\n    name\n    alternativeText\n    caption\n    width\n    height\n    formats\n    hash\n    ext\n    mime\n    size\n    url\n  }\n  personWithCardPhoto: upload(\n    ref: $ref\n    refId: $refId\n    field: \"personWithCardPhoto\"\n    file: $personWithCardPhoto\n  ) {\n    id\n    createdAt\n    updatedAt\n    name\n    alternativeText\n    caption\n    width\n    height\n    formats\n    hash\n    ext\n    mime\n    size\n    url\n  }\n}\n```\n\nVariables :\n```json\n{\n  \"ref\": \"YOUR_COLLECTION_TYPE_NAME\",\n  \"refId\": \"ID_OF_YOUR_ENTRY_IN_YOUR_COLLECTION_TYPE\"\n}\n```\n\n\u003cb\u003ePlease do not forget to attach your files with variables' names.\u003c/b\u003e\u003cbr\u003e\nNote: In this case, the variables' names are `cardImage`, `facePhoto`, and `personWithCardPhoto`.\n\nHere is an example :\u003cbr/\u003e\n\u003cimg src=\"https://raw.githubusercontent.com/kevinadhiguna/strapi-graphql-documentation/master/assets/gif/uploadSingleImageToSeveralFields.gif\" /\u003e\n\n\u003cbr /\u003e **[⬆ back to top](#-table-of-contents)** \u003cbr /\u003e\u003cbr /\u003e\n\n### 🚀 How does `UploadSingleImageToSeveralFields` mutation work ?\n\nIn the `UploadSingleImageToSeveralFields` mutation above, you still need `ref`, `refId`, and field name. However you are sending a request to a collection type and are trying to attach images in a single record inside the collection type. So, you are able to set `ref` and `refId` as variables. The field name ? You should name it statically as you want to upload an image in different fields. Hopefully this approach helps :)\n\n\u003cbr /\u003e **[⬆ back to top](#-table-of-contents)** \u003cbr /\u003e\u003cbr /\u003e\n\n## 📂 Get all files\n\u003eAll right, I got images and files uploaded to my Strapi app but how do I know what files did I upload ?  \n\nTo get all the files uploaded to database within your Strapi app, here is the query :\n```graphql\nquery FetchFiles {\n  files {\n    id\n    createdAt\n    updatedAt\n    name\n    alternativeText\n    caption\n    width\n    height\n    formats\n    hash\n    ext\n    mime\n    size\n    url\n  }\n}\n```\n\nUnfortunately, currently Strapi does not provide a query to fetch a single file.\n\n\u003cbr /\u003e **[⬆ back to top](#-table-of-contents)** \u003cbr /\u003e\u003cbr /\u003e\n\n## 👨‍💻 Fetch a single role\n\nHere is the query to display a single role :\n```graphql\nquery fetchSingleRole($id: ID!) {\n  role(id: $id) {\n    id\n    name\n    description\n    type\n    permissions {\n      id\n      type\n      controller\n      action\n      enabled\n      policy\n      role {\n        name\n      }\n    }\n    users {\n      id\n      createdAt\n      updatedAt\n      username\n      email\n      provider\n      confirmed\n      blocked\n      role {\n        name\n      }\n    }\n  }\n}\n```\n\nVariable :\n```json\n{\n  \"id\": \"ROLE_ID\"\n}\n```\n\n\u003cbr /\u003e **[⬆ back to top](#-table-of-contents)** \u003cbr /\u003e\u003cbr /\u003e\n\n## 👨‍💻 👨‍💼 🧑‍🔧 Fetch all roles\n\nBelow is the query to get all roles :\n```graphql\nquery FetchRoles {\n  roles {\n    id\n    name\n    description\n    type\n    permissions {\n      id\n      type\n      controller\n      action\n      enabled\n      policy\n      role {\n        name\n      }\n    }\n    users {\n      id\n      createdAt\n      updatedAt\n      username\n      email\n      provider\n      confirmed\n      blocked\n      role {\n        name\n      }\n    }\n  }\n}\n```\n\n\u003cbr /\u003e **[⬆ back to top](#-table-of-contents)** \u003cbr /\u003e\u003cbr /\u003e\n\n## 🖊 Contributing\n\nContributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are **greatly appreciated**.\n\n1. Fork the Project\n2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)\n3. Commit your Changes (`git commit -m 'Add some Amazing Queries or Mutations'`)\n4. Push to the Branch (`git push origin feature/AmazingFeature`)\n5. Open a Pull Request\n\n\u003cbr /\u003e **[⬆ back to top](#-table-of-contents)** \u003cbr /\u003e\u003cbr /\u003e\n\u003c!--\n## 🌐 Contact\nAuthor : Kevin Adhiguna - [@kevinadhiguna](https://linkedin.com/in/kevinadhiguna) - hi.kevinadhiguna@gmail.com\n\nRead more on Blog : [https://about.lovia.life/docs/engineering/graphql/strapi-graphql-documentation/](https://about.lovia.life/docs/engineering/graphql/strapi-graphql-documentation/)\n\nSee on Github Gist : [https://gist.github.com/kevinadhiguna/623af7a87a629f672ca5bf7fe60a1d58](https://gist.github.com/kevinadhiguna/623af7a87a629f672ca5bf7fe60a1d58)\n\nProject Link: [https://github.com/kevinadhiguna/strapi-graphql-documentation](https://github.com/kevinadhiguna/strapi-graphql-documentation)\n\n\u003cbr /\u003e **[⬆ back to top](#-table-of-contents)** \u003cbr /\u003e\u003cbr /\u003e\n--\u003e\n## 🎉 Acknowledgements\n* [Strapi](https://github.com/strapi/strapi)\n* [Best-README-Template](https://github.com/othneildrew/Best-README-Template)\n\n\u003cbr /\u003e **[⬆ back to top](#-table-of-contents)** \u003cbr /\u003e\u003cbr /\u003e\n\n\n![Hello !](https://api.visitorbadge.io/api/VisitorHit?user=kevinadhiguna\u0026repo=strapi-graphql-documentation\u0026label=thanks%20for%20dropping%20in%20!\u0026labelColor=%23000000\u0026countColor=%23FFFFFF)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkevinadhiguna%2Fstrapi-graphql-documentation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkevinadhiguna%2Fstrapi-graphql-documentation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkevinadhiguna%2Fstrapi-graphql-documentation/lists"}