---
schema_version: "1"
id: 1f62b7a7a74c6ff347096b90586f9791eac886d188cd2a39b9c93abe7c224b42
title: Get a Batch of Records
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/uiapi/ui_api_resources_records_batch.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.uiapi.meta/uiapi/ui_api_resources_records_batch.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: 455c3c48d526e91b3b40e52e628af18197ec560e4189cf5dd3e2c8566977734d
description: Get data for a batch of records.
---
# Get a Batch of Records

Get data for a batch of records.

Resource

GET /ui-api/records/batch/{recordIds}

recordIds—A comma-delimited list of custom object and [supported object](https://developer.salesforce.com/docs/atlas.en-us.uiapi.meta/uiapi/ui_api_get_started_supported_objects.htm#ui_api_get_started_supported_objects "User Interface API supports all custom objects and external objects and many standard objects.") records.

Available Version

41.0

Example for GET

This example gets the Account.Name field and Account.Contacts child records for two accounts.

GET /ui-api/records/batch/001R0000003I6CeIAK,001R0000003I6CgIAK?
  fields=Account.Name&childRelationships=Account.Contacts

Request Parameters

<table class="featureTable sort_table" summary="">





              <thead class="thead sorted" align="left">
                <tr>
                  <th class="featureTableHeader vertical-align-top " id="d76682e105">Parameter Name</th>

                  <th class="featureTableHeader vertical-align-top " id="d76682e108">Type</th>

                  <th class="featureTableHeader vertical-align-top " id="d76682e111">Description</th>

                  <th class="featureTableHeader vertical-align-top " id="d76682e114">Required or Optional</th>

                  <th class="featureTableHeader vertical-align-top " id="d76682e117">Available Version</th>

                </tr>

              </thead>

              <tbody class="tbody">
                <tr>
                  <td class="entry" headers="d76682e105" data-title="Parameter Name"><samp class="codeph nolang">childRelationships</samp></td>

                  <td class="entry" headers="d76682e108" data-title="Type">String[]</td>

                  <td class="entry" headers="d76682e111" data-title="Description">A collection of child relationship names. The records with those child
                    relationship names are included in the response. Specify names in the format
                    <samp class="codeph nolang"><var class="keyword varname">ObjectApiName</var>.<var class="keyword varname">ChildRelationshipName</var></samp>
                    or <samp class="codeph nolang"><var class="keyword varname">ObjectApiName</var>.<var class="keyword varname">ChildRelationshipName</var>.<var class="keyword varname">FieldApiName</var></samp>.
                    For example, to specify the Contacts relationship on an Account, use <samp class="codeph nolang">Account.Contacts</samp>. You can get child
                    relationships one level deep.<p class="p">To get a relationship name, look in the <a class="xref" href="https://developer.salesforce.com/docs/atlas.en-us.uiapi.meta/uiapi/ui_api_responses_object_info.htm#ui_api_responses_object_info" title="The metadata for an object.">Object Info</a> response body.</p>
                  </td>

                  <td class="entry" headers="d76682e114" data-title="Required or Optional">Optional</td>

                  <td class="entry" headers="d76682e117" data-title="Available Version">41.0</td>

                </tr>

                <tr>
                  <td class="entry" headers="d76682e105" data-title="Parameter Name"><samp class="codeph nolang">includeFieldsInBody</samp></td>

                  <td class="entry" headers="d76682e108" data-title="Type">Boolean</td>

                  <td class="entry" headers="d76682e111" data-title="Description">Specifies whether to return a field that’s defined in the request body
                    but not in the layout. The default value is <samp class="codeph nolang">false</samp>. When set to <samp class="codeph nolang">true</samp>,
                    fields that are not in the layout are also included in the response
                    body.</td>

                  <td class="entry" headers="d76682e114" data-title="Required or Optional">Optional</td>

                  <td class="entry" headers="d76682e117" data-title="Available Version">59.0</td>

                </tr>

                <tr>
                  <td class="entry" headers="d76682e105" data-title="Parameter Name"><samp class="codeph nolang">fields</samp></td>

                  <td class="entry" headers="d76682e108" data-title="Type">String[]</td>

                  <td class="entry" headers="d76682e111" data-title="Description">Specifies the fields to return. If this property is specified, the
                    response is a union of <samp class="codeph nolang">fields</samp> and <samp class="codeph nolang">optionalFields</samp>. <p class="p">If the context user doesn’t
                      have access to a field, or if the field doesn’t exist, an error is returned.
                    </p>
                    <p class="p">If you’re not sure whether the context user has access to a field and
                      you don’t want the request to fail if they don’t, use the <samp class="codeph nolang">optionalFields</samp> parameter.</p>
                    <p class="p">Specify
                      names in the format <samp class="codeph nolang"><var class="keyword varname">ObjectApiName</var>.<var class="keyword varname">FieldName</var></samp>.
                      You can get any field that has a named relationship to this record.
                      There’s no limit to the number of fields you can specify.</p>
                    <p class="p">Child
                      relationship records don’t have layouts. To get more fields for these
                      records, specify them in the <samp class="codeph nolang">fields</samp>
                      parameter.</p>
                    <p class="p">To return a field whose type is <samp class="codeph nolang">base64</samp>, specify the field in the <samp class="codeph nolang">optionalFields</samp> parameter.</p>
                    <p class="p"><a class="xref" href="https://developer.salesforce.com/docs/atlas.en-us.264.0.soql_sosl.meta/soql_sosl/sforce_api_calls_soql_relationships_and_polymorph_keys.htm" target="_blank">Polymorphic fields</a> aren't supported.
                      Including a polymorphic field in <samp class="codeph javascript">fields</samp> can result in an invalid field error.</p>
                  </td>

                  <td class="entry" headers="d76682e114" data-title="Required or Optional">In API versions 45.0 and later, either <samp class="codeph nolang">fields</samp>, <samp class="codeph nolang">optionalFields</samp>, or
                    <samp class="codeph nolang">layoutTypes</samp> is required.<p class="p">In earlier
                      API versions, either <samp class="codeph nolang">fields</samp> or <samp class="codeph nolang">layoutTypes</samp> is required.</p>
                    In all API
                    versions, to specify both <samp class="codeph nolang">fields</samp> and
                    <samp class="codeph nolang">layoutTypes</samp>, you must specify <samp class="codeph nolang">childRelationships</samp>.
                  </td>

                  <td class="entry" headers="d76682e117" data-title="Available Version">41.0</td>

                </tr>

                <tr>
                  <td class="entry" headers="d76682e105" data-title="Parameter Name"><samp class="codeph nolang">layoutTypes</samp></td>

                  <td class="entry" headers="d76682e108" data-title="Type">String[]</td>

                  <td class="entry" headers="d76682e111" data-title="Description">Specifies the fields to return. If this property is specified, the
                    response is a union of <samp class="codeph nolang">layoutTypes</samp>,
                    <samp class="codeph nolang">modes</samp>, and <samp class="codeph nolang">optionalFields</samp>.<p class="p">A collection containing any of these values:</p>
                    <ul class="ul bulletList">
                      <li class="li">
                        <samp class="codeph nolang">Compact</samp>—Use this value to get a
                        layout that contains a record’s key fields.
                      </li>

                      <li class="li">
                        <samp class="codeph nolang">Full</samp>—(Default) Use this value to
                        get a full layout.
                      </li>

                    </ul>
                  </td>

                  <td class="entry" headers="d76682e114" data-title="Required or Optional">In API versions 45.0 and later, either <samp class="codeph nolang">fields</samp>, <samp class="codeph nolang">optionalFields</samp>, or
                    <samp class="codeph nolang">layoutTypes</samp> is required.<p class="p">In earlier
                      API versions, either <samp class="codeph nolang">fields</samp> or <samp class="codeph nolang">layoutTypes</samp> is required.</p>
                    In all API
                    versions, to specify both <samp class="codeph nolang">fields</samp> and
                    <samp class="codeph nolang">layoutTypes</samp>, you must specify <samp class="codeph nolang">childRelationships</samp>.
                  </td>

                  <td class="entry" headers="d76682e117" data-title="Available Version">41.0</td>

                </tr>

                <tr>
                  <td class="entry" headers="d76682e105" data-title="Parameter Name"><samp class="codeph nolang">modes</samp></td>

                  <td class="entry" headers="d76682e108" data-title="Type">String[]</td>

                  <td class="entry" headers="d76682e111" data-title="Description">The access mode for the record. This value determines which fields to get
                    from a layout. Layouts have different fields for create, edit, and view modes.
                    For example, formula fields are rendered in view mode, but not in create mode
                    because they’re calculated at run time, like formulas in a spreadsheet. A
                    collection containing any of these values:<ul class="ul bulletList">
                      <li class="li">
                        <samp class="codeph nolang">Create</samp>—Use this mode if you intend
                        to build UI that lets a user create a record. This mode is used by the
                        <samp class="codeph nolang">/ui-api/record-defaults/create/{apiName}</samp> resource.
                      </li>

                      <li class="li">
                        <samp class="codeph nolang">Edit</samp>—Use this mode if you intend to
                        build UI that lets a user edit a record. This mode is used by the <samp class="codeph nolang">/ui-api/record-defaults/clone/{recordId}</samp>
                        resource.
                      </li>

                      <li class="li">
                        <samp class="codeph nolang">View</samp>—(Default) Use this mode to
                        build UI that displays a record.
                      </li>

                    </ul>
                  </td>

                  <td class="entry" headers="d76682e114" data-title="Required or Optional">Optional if <samp class="codeph nolang">layoutTypes</samp> is
                    specified. If <samp class="codeph nolang">layoutTypes</samp> is not
                    specified, this parameter is ignored.</td>

                  <td class="entry" headers="d76682e117" data-title="Available Version">41.0</td>

                </tr>

                <tr>
                  <td class="entry" headers="d76682e105" data-title="Parameter Name"><samp class="codeph nolang">optionalFields</samp></td>

                  <td class="entry" headers="d76682e108" data-title="Type">String[]</td>

                  <td class="entry" headers="d76682e111" data-title="Description">A collection of optional field names. If a field is accessible to the
                    context user, it’s included in the response. If a field isn’t accessible to
                    the context user, it isn’t included in the response, but it doesn’t cause an
                    error. <p class="p">Specify names in the format <samp class="codeph nolang"><var class="keyword varname">ObjectApiName</var>.<var class="keyword varname">FieldName</var></samp>.
                      You can get any field that has a named relationship to this record. There’s
                      no limit to the number of fields you can specify.</p>
                    <p class="p">To return a field
                      whose type is <samp class="codeph nolang">base64</samp>, specify the field
                      in the <samp class="codeph nolang">optionalFields</samp>
                      parameter.</p>
                  </td>

                  <td class="entry" headers="d76682e114" data-title="Required or Optional">In API versions 45.0 and later, either <samp class="codeph nolang">fields</samp>, <samp class="codeph nolang">optionalFields</samp>, or
                    <samp class="codeph nolang">layoutTypes</samp> is required.<p class="p">In earlier
                      API versions, <samp class="codeph nolang">optionalFields</samp> is
                      optional.</p>
                  </td>

                  <td class="entry" headers="d76682e117" data-title="Available Version">41.0</td>

                </tr>

                <tr>
                  <td class="entry" headers="d76682e105" data-title="Parameter Name"><samp class="codeph nolang">pageSize</samp></td>

                  <td class="entry" headers="d76682e108" data-title="Type">Integer</td>

                  <td class="entry" headers="d76682e111" data-title="Description"> The maximum number of child records to return on a page. </td>

                  <td class="entry" headers="d76682e114" data-title="Required or Optional">Optional</td>

                  <td class="entry" headers="d76682e117" data-title="Available Version">41.0</td>

                </tr>

                <tr>
                  <td class="entry" headers="d76682e105" data-title="Parameter Name"><samp class="codeph nolang">updateMru</samp></td>

                  <td class="entry" headers="d76682e108" data-title="Type">Boolean</td>

                  <td class="entry" headers="d76682e111" data-title="Description">To add to the most recently used (MRU) list view, set to <samp class="codeph nolang">true</samp>. The default value is <samp class="codeph nolang">false</samp>.</td>

                  <td class="entry" headers="d76682e114" data-title="Required or Optional">Optional</td>

                  <td class="entry" headers="d76682e117" data-title="Available Version">47.0</td>

                </tr>

              </tbody>

            </table>

Response Body

[Batch Results](https://developer.salesforce.com/docs/atlas.en-us.uiapi.meta/uiapi/ui_api_responses_batch_results.htm#ui_api_responses_batch_results "The results from a request to a batch resource. Results include information for each subrequest in the batch.")

#### See Also

- [Get Default Values to Clone a Record](https://developer.salesforce.com/docs/atlas.en-us.uiapi.meta/uiapi/ui_api_resources_record_defaults_clone.htm "Get the default layout information, object information, and data for cloning a record. After getting the default values, make a request to POST /ui-api/records to create the record.")
- [Get Default Values to Create a Record](https://developer.salesforce.com/docs/atlas.en-us.uiapi.meta/uiapi/ui_api_resources_record_defaults_create.htm "Get the default values for fields for a new record of a specified object and optional record type. After getting the default values, make a request to POST /ui-api/records to create the record.")
- [Get Child Records](https://developer.salesforce.com/docs/atlas.en-us.uiapi.meta/uiapi/ui_api_features_records_child_relationships.htm "User Interface API has several resources that include child records in their responses. If a record has many child relationships, a response can be huge and have a negative effect on performance. To get only the records you need, request records for specific child relationships and set the page size of the results.")
- [User Interface API Quick Start](https://developer.salesforce.com/docs/atlas.en-us.uiapi.meta/uiapi/ui_api_quick_start_postman.htm "Use the Postman desktop app or web-based UI to easily explore and test the UI API and other Salesforce APIs against your orgs.")
- [Batch Results](https://developer.salesforce.com/docs/atlas.en-us.uiapi.meta/uiapi/ui_api_responses_batch_results.htm "The results from a request to a batch resource. Results include information for each subrequest in the batch.")