GraphQL API

See what’s new with GraphQL API.

Control unauthenticated guest user access to GraphQL API for your org
When: This feature is available on a rolling basis, starting in late October 2026.
Guest user access is off by default in new orgs and in orgs that haven’t had guest user GraphQL access since May 2026. For existing orgs with guest user GraphQL access since May 2026, guest user access is enabled so that there aren’t any changes to current behavior. Admins can change guest user access to GraphQL from Setup. In the Quick Find box, enter API Access Controls and select it, and then update guest user access.

In orgs with guest user access turned off, guest users can’t access the GraphQL API endpoint and receive an error when making requests. In orgs with guest user access turned on, GraphQL API honors the same object-level and field-level permissions that guest users have in the org.

Get lookup values
The lookupValues field provides lookup search for Salesforce lookup and relationship fields. This feature supports type-ahead search, most recently used (mru) lookups, and full search capabilities.

This schema is for lookupValues.

type UIAPI {
   lookupValues(
      objectApiName: String!
      fieldApiName: String!
      q: String
      searchType: LookupSearchType
      targetApiName: String
      sourceRecord: RecordSnapshotInput
   ): [LookupValues!]
}

This example gets the most recently used account record lookup values for the opportunity object.

{
  uiapi {
    lookupValues(
      objectApiName: "Opportunity"
      fieldApiName: "AccountId"
      searchType: RECENT
    ) {
      targetApiName
      records {
        edges {
          node {
            Record {
              Id
              DisplayValue
            }
          }
        }
        pageInfo {
          hasNextPage
          endCursor
        }
      }
    }
  }
}

The response looks like this.

{
  "data": {
    "uiapi": {
      "lookupValues": [
        {
          "targetApiName": "Account",
          "records": {
            "edges": [
              {
                "node": {
                  "Record": {
                    "Id": "001LT00000DzUzQYAV",
                    "DisplayValue": "fong",
                    "ApiName": "Account"
                  }
                }
              },
              {
                "node": {
                  "Record": {
                    "Id": "001LT00000DzUzOYAV",
                    "DisplayValue": "Acme12",
                    "ApiName": "Account"
                  }
                }
              }
            ],
            "pageInfo": {
              "hasNextPage": false,
              "endCursor": "djE6MTE="
            }
          }
        }
      ]
    }
  },
  "errors": [],
  "extensions": {}
}
Get record create default values
The recordCreateDefaults field provides the default field values for a new record of a given object type. The response includes the pre-populated field values that a user sees when opening a blank record create form in the Salesforce user interface. If you need object info or layout structure, you can chain separate calls to objectInfos and recordLayouts to get everything you need to render a pre-populated create form.

This schema is for recordCreateDefaults.

type UIAPI {
   recordCreateDefaults(
      objectApiName: String!
      recordTypeIds: [ID!]
      formFactor = "LARGE: FormFactor
      mode = "LAYOUT": CreateDefaultsMode
      configs: [CreateDefaultsConfig!]
      optionalFields: [String!]
      first: Int
      after: String
   ): CreateDefaultsConnection
}

input CreateDefaultsConfig {
   recordTypeId: ID!
   formFactor = "LARGE": FormFactor
}

This example gets the default field values for creating a new account record. Use rawValue for scalar fields. Use a single fragment for reference fields.

{
  uiapi {
    recordCreateDefaults(objectApiName: "Account") {
      edges {
        node {
          recordTypeId
          formFactor
          fields {
            apiName
            rawValue
            value {
              __typename
              ... on FieldDefaultReferenceValue {
                id
                displayValue
                objectApiName
              }
            }
          }
        }
      }
      pageInfo {
        hasNextPage
        endCursor
      }
    }
  }
}

The partial response looks like this.

{
  "edges": [
    {
      "node": {
        "recordTypeId": "012000000000000AAA",
        "formFactor": "LARGE",
        "fields": [
          {
            "apiName": "OwnerId",
            "rawValue": "005xx000001X7oXAAS",
            "value": { "__typename": "IDValue" }
          },
          {
            "apiName": "Owner",
            "rawValue": null,
            "value": {
              "__typename": "FieldDefaultReferenceValue",
              "id": "005xx000001X7oXAAS",
              "displayValue": "Admin User",
              "objectApiName": "User"
            }
          },
          {
            "apiName": "Name",
            "rawValue": null,
            "value": { "__typename": "StringValue" }
          },
          {
            "apiName": "Industry",
            "rawValue": null,
            "value": { "__typename": "PicklistValue" }
          }
        ]
      }
    }
  ]
}