What is GraphQL API?

GraphQL addresses many pain points for application developers. All GraphQL servers adhere to a specification, which features patterns that make it easier to build complex experiences across a wide variety of platforms and devices.

Salesforce GraphQL API is available in Enterprise, Performance, Unlimited, and Developer Editions. It adheres to the June 2018 version of the spec.

These patterns are available for Salesforce developers.

  • Field selection
  • Resource aggregation
  • Schema introspection

Field selection requires the client generating the GraphQL query to explicitly declare which fields to receive in the response. This technique reduces the size of the payload, as the client receives only fields that the query includes.

Aggregation allows the client to specify a traversal across the fields in the GraphQL schema. Aggregations reduce round trips between the client and server, returning a set of related resources within a single response.

Introspection sends a query to the GraphQL server to ask questions about the types, fields, and their relationships within the schema. Combining all these patterns results in more responsive, higher-quality applications.

GraphQL API includes:

  • Concrete representations of your UI API Enabled sObjects, honoring the object-level security and field-Level security of the context user. Therefore, two different users can have two different views of the GraphQL schema based on their access permissions.

    Starting in API version 68.0, admins can control unauthenticated guest user access to GraphQL API from Setup. In the Quick Find box, enter API Access Controls and select it, and then update guest user access. GraphQL API honors object-level and field-level security for guest user context users.

  • Adherence to the Relay Connection Specification if working with paged resources.

For more information about getting started with GraphQL API, we recommend these resources.