| AVAILABLE API VERSION |
|---|
| API v67.0 and later |
The platform field on the UIAPI type provides capabilities to complement the RecordQuery type. Use platform capabilities to:
- Check specific permissions for the current user
- Resolve authenticated file-asset URLs for Salesforce content assets in batch
- Resolve canonical URLs for static resources
- Get the current user’s internationalization properties
- Resolve custom and standard label values in the current user’s locale
Platform Schema
Access platform in the uiapi field.
type UIAPI {
platform: Platform!
}
type Platform {
userPermissions(names: [String!]!): [UserPermission]!
customPermissions(names: [String!]!): [CustomPermission]!
contentAssetUrls(names: [String!]!): [ContentAssetUrl]!
resourceUrls(names: [String!]!): [ResourceUrl]!
i18n: I18nData
labels(
namespace: String = "c"
names: [String!]!
locale: String
fallback: LabelFallback
): [LabelResult]!
}
userPermissions and customPermissions Fields
The userPermissions and customPermissions fields return permission grants for the calling user. Use these fields to determine whether the current user has specific permissions without querying the User object or making more API calls. This functionality mirrors the LWC @salesforce/userPermission and @salesforce/customPermission imports.
Pass permission names as a list in the names argument to return the grant status for each named permission in a single request. You can pass up to 25 permission names per call. A failure on one name doesn’t cause the operation to fail. Partial successes show failed names in the returned errors object.
{
uiapi {
platform {
userPermissions(names: ["ManageUsers", "ViewSetup"]) {
name
hasAccess
}
customPermissions(names: ["My_Custom_Permission"]) {
name
hasAccess
}
}
}
}
Permissions Schema
type Platform {
userPermissions(names: [String!]!): [UserPermission]!
customPermissions(names: [String!]!): [CustomPermission]!
}
type UserPermission {
name: String!
hasAccess: Boolean!
}
type CustomPermission {
name: String!
hasAccess: Boolean!
}
UserPermissions Field
The userPermissions field returns a list of UserPermission types, one per name in the names argument.
names- A list of user permission API names to check for the calling user. This argument is required.
The UserPermission type contains these fields.
name- The API name of the user permission.hasAccess- Indicates whether the calling user has the permission.
CustomPermissions Field
The customPermissions field returns a list of CustomPermission types, one per name in the names argument.
names- A list of custom permission API names to check for the calling user. This argument is required.
The CustomPermission type contains these fields.
name- The API name of the custom permission.hasAccess- Indicates whether the calling user has the permission.
Example: Check User and Custom Permissions
This example checks whether the current user has two user permissions and one custom permission.
{
uiapi {
platform {
userPermissions(names: ["ManageUsers", "ViewSetup"]) {
name
hasAccess
}
customPermissions(names: ["My_Custom_Permission"]) {
name
hasAccess
}
}
}
}
The response includes a result for each named permission.
{
"data": {
"uiapi": {
"platform": {
"userPermissions": [
{
"name": "ManageUsers",
"hasAccess": false
},
{
"name": "ViewSetup",
"hasAccess": true
}
],
"customPermissions": [
{
"name": "My_Custom_Permission",
"hasAccess": true
}
]
}
}
},
"errors": []
}
contentAssetUrls Field
The contentAssetUrls field returns resolved URLs for content assets in the calling org. Use this field to retrieve the URL for one or more content assets by name without constructing URLs manually. This functionality mirrors the LWC @salesforce/contentAssetUrl import.
Pass asset names as a list in the names argument to return the URL for each asset in a single request. A failure on one name doesn’t cause the operation to fail. Partial successes show failed names in the returned errors object.
{
uiapi {
platform {
contentAssetUrls(names: ["companyLogo", "acme__heroBanner"]) {
name
url
}
}
}
}
contentAssetUrls Schema
type Platform {
contentAssetUrls(names: [String!]!): [ContentAssetUrl]!
}
type ContentAssetUrl {
name: String!
url: String!
}
The contentAssetUrls field returns a list of ContentAssetUrl types, one per name in the names argument.
names- A list of up to 25 content asset names to resolve. Use the same canonical form as the LWC import. Unmanaged assets use the developer name. Managed package assets include the namespace prefix, such as<namespace>__<developerName>. This argument is required.
The ContentAssetUrl type contains these fields.
name- The name of the content asset.url- The authenticated file-asset servlet URL for the content asset.
Example: Get Content Asset URLs
This example retrieves the URLs for two content assets.
{
uiapi {
platform {
contentAssetUrls(names: ["companyLogo", "acme__heroBanner"]) {
name
url
}
}
}
}
The response includes the resolved URL for each named asset.
{
"data": {
"uiapi": {
"platform": {
"contentAssetUrls": [
{
"name": "companyLogo",
"url": "https://example.my.salesforce.com/file-asset/companyLogo?v=1"
},
{
"name": "acme__heroBanner",
"url": "https://example.my.salesforce.com/file-asset/acme__heroBanner?v=3"
}
]
}
}
},
"errors": []
}
resourceUrls Field
The resourceUrls field returns resolved URLs for static resources in the calling org. Use this field to retrieve the URL for one or more static resources by name without constructing URLs manually. This functionality mirrors the LWC @salesforce/resourceUrl import.
Pass resource names as a list in the names argument to return the URL for each resource in a single request. A failure on one name doesn’t cause the operation to fail. Partial successes show failed names in the returned errors object.
{
uiapi {
platform {
resourceUrls(names: ["myResource", "acme__logo"]) {
name
url
}
}
}
}
resourceUrls Schema
type Platform {
resourceUrls(names: [String!]!): [ResourceUrl]!
}
type ResourceUrl {
name: String!
url: String!
}
The resourceUrls field returns a list of ResourceUrl types, one per name in the names argument.
names- A list of up to 25 static resource names to resolve. Use the same canonical form as the LWC import. Unmanaged assets use the developer name. Managed package assets include the namespace prefix, such as<namespace>__<developerName>. This argument is required.
The ResourceUrl type contains these fields.
name- The name of the static resource.url- The resolved URL for the static resource.
Example: Get Static Resource URLs
This example retrieves the URLs for two static resources.
{
uiapi {
platform {
resourceUrls(names: ["myResource", "acme__logo"]) {
name
url
}
}
}
}
The response includes the resolved URL for each named resource.
{
"data": {
"uiapi": {
"platform": {
"resourceUrls": [
{
"name": "myResource",
"url": "/resource/1234567890000/myResource"
},
{
"name": "acme__logo",
"url": "/resource/1234567890001/acme__logo"
}
]
}
}
},
"errors": []
}
i18n Field
The i18n field returns internationalization (i18n) data for the current user, mirroring the values available through LWC @salesforce/i18n imports. Use this field to get locale, currency, time zone, and date and number format data for the calling user in a single request.
{
uiapi {
platform {
i18n {
lang
locale
currency
timeZone
dateTime {
shortDateFormat
longDateTimeFormat
}
number {
currencySymbol
decimalSeparator
groupingSeparator
}
}
}
}
}
i18n Schema
type Platform {
i18n: I18nData
}
type I18nData {
lang: String
dir: String
locale: String
currency: String
timeZone: String
firstDayOfWeek: Int
showJapaneseCalendar: Boolean
isEasternNameStyle: Boolean
defaultCalendar: String
defaultNumberingSystem: String
calendarData: JSON
dateTime: I18nDateTimeData
number: I18nNumberData
common: I18nCommonData
}
type I18nDateTimeData {
shortDateFormat: String
mediumDateFormat: String
longDateFormat: String
shortDateTimeFormat: String
mediumDateTimeFormat: String
longDateTimeFormat: String
shortTimeFormat: String
longTimeFormat: String
}
type I18nNumberData {
currencyFormat: String
currencySymbol: String
decimalSeparator: String
exponentialSign: String
groupingSeparator: String
infinity: String
minusSign: String
nan: String
numberFormat: String
perMilleSign: String
percentFormat: String
percentSign: String
plusSign: String
superscriptExponentSign: String
}
type I18nCommonData {
calendarData: JSON
digits: JSON
}
The I18nData type contains top-level locale and user preferences.
lang- The language code for the current user’s language, for example,en.dir- The text direction for the current user’s language, eitherltr(left-to-right) orrtl(right-to-left).locale- The locale code for the current user, for example,en_US.currency- The ISO 4217 currency code for the current user, for example,USD.timeZone- The IANA time zone name for the current user, for example,America/Los_Angeles.firstDayOfWeek- The first day of the week for the user’s locale, where0is Sunday and1is Monday.showJapaneseCalendar- Indicates whether the Japanese calendar is used for this user’s locale.isEasternNameStyle- Indicates whether the user’s locale uses eastern name style (family name before given name).defaultCalendar- The default calendar system for the user’s locale, for example,gregorian.defaultNumberingSystem- The default numbering system for the user’s locale, for example,latn.calendarData- More calendar data for the user’s locale as a JSON object.dateTime- Date and time format strings for the current user’s locale. See I18nDateTimeData.number- Number format strings and symbols for the current user’s locale. See I18nNumberData.common- Supplementary calendar and digit data for the user’s locale. See I18nCommonData.
I18nDateTimeData Type
The I18nDateTimeData type contains date and time format strings for the current user’s locale.
shortDateFormat- Short date format pattern, for example,M/d/yyyy.mediumDateFormat- Medium date format pattern, for example,MMM d, yyyy.longDateFormat- Long date format pattern.shortDateTimeFormat- Short date and time format pattern.mediumDateTimeFormat- Medium date and time format pattern.longDateTimeFormat- Long date and time format pattern.shortTimeFormat- Short time format pattern, for example,h:mm a.longTimeFormat- Long time format pattern.
I18nNumberData Type
The I18nNumberData type contains number format strings and symbols for the current user’s locale.
currencyFormat- Currency format pattern, for example,¤#,##0.00.currencySymbol- The currency symbol, for example,$.decimalSeparator- The character used as the decimal separator, for example,..exponentialSign- The character used to denote exponential notation.groupingSeparator- The character used as the grouping (thousands) separator, for example,,.infinity- The string representing infinity.minusSign- The character used as the minus sign.nan- The string representing not-a-number.numberFormat- General number format pattern.perMilleSign- The character used for parts-per-thousand notation.percentFormat- Percent format pattern.percentSign- The character used as the percent sign.plusSign- The character used as the plus sign.superscriptExponentSign- The character used as the superscript exponent sign.
I18nCommonData Type
The I18nCommonData type contains supplementary calendar and digit data.
calendarData- Supplementary calendar data as a JSON object.digits- Locale-specific digit characters as a JSON object.
Example: Get Locale and Date Format Data
This example fetches the current user’s locale, time zone, and date format patterns.
{
uiapi {
platform {
i18n {
lang
locale
timeZone
firstDayOfWeek
dateTime {
shortDateFormat
mediumDateFormat
longDateFormat
shortTimeFormat
}
number {
currencySymbol
decimalSeparator
groupingSeparator
}
}
}
}
}
The response includes the i18n data for the current user.
{
"data": {
"uiapi": {
"platform": {
"i18n": {
"lang": "en",
"locale": "en_US",
"timeZone": "America/Los_Angeles",
"firstDayOfWeek": 0,
"dateTime": {
"shortDateFormat": "M/d/yyyy",
"mediumDateFormat": "MMM d, yyyy",
"longDateFormat": "MMMM d, yyyy",
"shortTimeFormat": "h:mm a"
},
"number": {
"currencySymbol": "$",
"decimalSeparator": ".",
"groupingSeparator": ","
}
}
}
}
},
"errors": []
}
labels Field
The labels field returns resolved custom label values for the calling user. Use this field to get one or more custom labels by name, optionally specifying a locale and a fallback strategy if a translation isn’t available. This functionality mirrors the LWC @salesforce/label import.
{
uiapi {
platform {
labels(names: ["greeting", "submit_button"]) {
namespace
name
value
resolvedLocale
wasFallback
}
}
}
}
Labels Schema
type Platform {
labels(
namespace: String = "c"
names: [String!]!
locale: String
fallback: LabelFallback
): [LabelResult]!
}
type LabelResult {
namespace: String!
name: String!
value: String
resolvedLocale: String
wasFallback: Boolean!
}
enum LabelFallback {
USER_DEFAULT
BASE_VALUE
NONE
}
The labels field has these arguments.
namespace- The namespace for custom labels or framework section name, such asLightningForm, for standard labels. Defaults tocto resolve unmanaged custom labels.names- A list of up to 100 custom label API names to retrieve. This argument is required.locale- The locale to use when resolving label translations, for example,fr. Defaults to the calling user’s locale.fallback- The fallback behavior when a translation isn’t available for the requested locale. Defaults toUSER_DEFAULT. See LabelFallback.
LabelResult Type
The LabelResult type represents a resolved custom label value.
namespace- The namespace of the custom label.name- The API name of the custom label.value- The resolved label value for the requested locale, ornullif the label doesn’t exist andfallbackisNONE.resolvedLocale- The locale that was used to resolve the label value. This locale can differ from the requested locale if a fallback occurred.wasFallback- Indicates whether a fallback resolved thevaluerather than a direct translation match.
LabelFallback Enum
The LabelFallback enumeration controls how the API handles missing translations.
enum LabelFallback {
USER_DEFAULT
BASE_VALUE
NONE
}
USER_DEFAULT- Falls back first to the user’s default language translation, then to the base label value if no language-level translation is available. This value is the default.BASE_VALUE- Falls back directly to the base label value, skipping the user’s language.NONE- Doesn’t fall back. If a translation for the requested locale is missing,valueisnulland the response includes a GraphQL error.
Example: Get Labels in a Specific Locale
This example fetches two custom labels in French.
{
uiapi {
platform {
labels(names: ["greeting", "submit_button"], locale: "fr", fallback: USER_DEFAULT) {
namespace
name
value
resolvedLocale
wasFallback
}
}
}
}
The response includes the resolved label value and the locale.
{
"data": {
"uiapi": {
"platform": {
"labels": [
{
"namespace": "c",
"name": "greeting",
"value": "Bonjour",
"resolvedLocale": "fr",
"wasFallback": false
},
{
"namespace": "c",
"name": "submit_button",
"value": "Submit",
"resolvedLocale": "en",
"wasFallback": true
}
]
}
}
},
"errors": []
}
Example: Get Standard Framework Labels
This example fetches labels from the LightningForm framework namespace.
{
uiapi {
platform {
labels(namespace: "LightningForm", names: ["edit", "save"]) {
name
value
resolvedLocale
}
}
}
}