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
    friendlyId
    borrowers {
      edges {
        node {
          id
          personalInformation {
            firstName
            lastName
          }
        }
      }
    }
  }
}

Mutations

Mutations are used to modify data (create, update, delete):
mutation CreateBorrower {
  borrower {
    create(
      input: {
        dealId: "123"
        personalInformation: {
          firstName: "John"
          lastName: "Doe"
          email: "john.doe@example.com"
        }
      }
    ) {
      id
    }
  }
}

Fields

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

GraphQL vs REST

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

Next steps