Definition

Input types are used to define structured data that can be passed as arguments, primarily in mutations.


Core Concept

Instead of passing multiple individual arguments, input types group related fields into a single object.


Basic Example

input BookAppointmentInput {
  userId: ID!
  doctorId: ID!
  date: String!
}

Usage in Mutation

type Mutation {
  bookAppointment(input: BookAppointmentInput!): Appointment
}

Mutation Example

mutation BookAppointment($input: BookAppointmentInput!) {
  bookAppointment(input: $input) {
    id
    date
  }
}

Variables

{
  "input": {
    "userId": "1",
    "doctorId": "10",
    "date": "2026-05-05"
  }
}