Skip to main content
GraphQL is a query language for APIs that allows you to request exactly the data you need. Unlike REST APIs, GraphQL gives you the flexibility to fetch multiple resources in a single request.

What is GraphQL?

GraphQL is a query language and runtime for executing queries against your data. It provides:
  • Single endpoint - All queries and mutations go through one endpoint
  • Flexible queries - Request only the fields you need
  • Strong typing - Schema defines all available data and operations
  • Introspection - Explore the API schema directly

Basic concepts

Queries

Queries are used to fetch data. They are read-only operations:
query GetDeal {
  deal(id: "123") {
    id
    status
    borrowers {
      firstName
      lastName
    }
  }
}

Mutations

Mutations are used to modify data (create, update, delete):
mutation CreateBorrower {
  createBorrower(input: { firstName: "John", lastName: "Doe" }) {
    id
    firstName
    lastName
  }
}

Fields

Fields represent the data you want to retrieve. You can request nested fields:
query {
  deal(id: "123") {
    id
    borrowers {
      firstName
      lastName
      incomes {
        statedMonthlyAmount
      }
    }
  }
}

GraphQL vs REST

FeatureRESTGraphQL
EndpointsMultiple endpointsSingle endpoint
Data fetchingFixed structureFlexible queries
Over-fetchingCommonAvoided
Under-fetchingCommonAvoided
VersioningURL-basedSchema-based

Next steps