---
schema_version: "1"
id: 20301a5478accbcb5da40f450b720eb548ded56fdbaa5c8a2b35de12541c30c2
title: Get Child Records
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/uiapi/ui_api_resources_child_relationships.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.uiapi.meta/uiapi/ui_api_resources_child_relationships.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: 0c50065c4f26bb883955ce176f6ba81048946daf69c4ebd03363c4a7d0baf9e4
description: Get child records for a specified record and child relationship name. Relationships are connections between records. On a record detail page, each record in a related list has a child relationship to the parent record.
---
# Get Child Records

Get child records for a specified record and child relationship name. Relationships are connections between records. On a record detail page, each record in a related list has a child relationship to the parent record.

Resource

/ui-api/records/${recordId}/child-relationships/${relationshipName}

recordId—The ID of the record for which you want to get child relationships.

relationshipName—The name of the child relationship. This value is returned in the [Object Info](https://developer.salesforce.com/docs/atlas.en-us.uiapi.meta/uiapi/ui_api_responses_object_info.htm#ui_api_responses_object_info "The metadata for an object.") response body and is usually the plural form of the object name.

Available Version

41.0

HTTP Method

GET

Example

This example returns all the Contacts related to the Account record 001R0000003I6CoIAK.

/ui-api/records/001R0000003I6CoIAK/child-relationships/Contacts

The response is paginated. Use the pageSize parameter to specify the number of records per page. The default is 5.

{   
    "count" : 5,
    "currentPageUrl" :
    "/services/data/v41.0/ui-api/records/001R0000003I6CoIAK/child-relationships/Contacts?page=1&pageSize=5",
    "nextPageUrl" :
    "/services/data/v41.0/ui-api/records/001R0000003I6CoIAK/child-relationships/Contacts?page=2&pageSize=5",
    "previousPageUrl" : null,
    "records" : \[ {
        "apiName" : "Contact",
        "childRelationships" : { },
        "fields" : {
            "AccountId" : {
                "displayValue" : null,
                "value" : "001R0000003I6CoIAK"
            },
            "Id" : { 
                "displayValue" : null,
                "value" : "003R0000007qXwQIAU"
            },
            "Name" : { 
                "displayValue" : null,
                "value" : "John Smith"
            }
        },
        "id" : "003R0000007qXwQIAU",
        "recordTypeId" : "012000000000000000",
        "recordTypeInfo" : null
    },
    ...
}

Request Parameters

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





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

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

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

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

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

                </tr>

              </thead>

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

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

                  <td class="entry" headers="d41498e136" 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>
                  </td>

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

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

                </tr>

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

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

                  <td class="entry" headers="d41498e136" 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>
                  </td>

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

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

                </tr>

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

                  <td class="entry" headers="d41498e133" data-title="Type">Int</td>

                  <td class="entry" headers="d41498e136" data-title="Description">The page offset from which to begin returning records. The default value
                    is 0, which returns records from the first page. For example, for <samp class="codeph nolang">page=2</samp> and <samp class="codeph nolang">pageSize=10</samp>, the first record returned is the 21st record in the
                    list. </td>

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

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

                </tr>

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

                  <td class="entry" headers="d41498e133" data-title="Type">Int</td>

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

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

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

                </tr>

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

                  <td class="entry" headers="d41498e133" data-title="Type">String</td>

                  <td class="entry" headers="d41498e136" data-title="Description">A token that represents the page offset.</td>

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

                  <td class="entry" headers="d41498e142" data-title="Available Version">44.0</td>

                </tr>

              </tbody>

            </table>

Response Body

[Record Collection](https://developer.salesforce.com/docs/atlas.en-us.uiapi.meta/uiapi/ui_api_responses_record_collection.htm#ui_api_responses_record_collection "A paginated collection of Record response bodies.")

#### See Also

- [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.")