---
schema_version: "1"
id: 2f4cdeac3cba94b0f709477e279a771779f155c855de6460157bb8406547d37e
title: Get Records With a Request Body Using sObject Collections
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/platform/api-rest/guides/resources/resources-composite-sobjects-collections-retrieve-post.md
canonical_url: https://developer.salesforce.com/docs/platform/api-rest/guide/resources-composite-sobjects-collections-retrieve-post.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 0b95a8011b3b511eea60a109f909e057e91204192a5e49f90919e4f5a295b409
products:
  - REST API Developer Guide
  - Platform Developer Content
---

# Get Records With a Request Body Using sObject Collections

Use a POST request with sObject Collections to get one or more records of the same object type. A list of sObjects that represents the individual records of the specified type is returned. The number of sObjects returned matches the number of IDs passed in the request.

The request retrieves up to 2,000 records of the same object type

-   If you specify an invalid field name or a field name that you don’t have permission to read, `HTTP 400 Bad Request` is returned.
-   If you don’t have access to an object, or if a passed ID is invalid, the array returns null for that object.

**note:** The [sObject Blob Retrieve](https://developer.salesforce.com/docs/platform/api-rest/guide/resources-sobject-blob-retrieve.md) resource isn’t compatible with Composite API requests, because it returns binary data instead of data in JSON or XML formats. Instead, make individual sObject Blob Retrieve requests to retrieve blob data.

## Syntax

**URI:** `/services/data/vXX.X/composite/sobjects/sObject`

**Formats:** JSON, XML

**HTTP Method:** POST

**Authentication:** `Authorization: Bearer token`

**Request Body**

```nolang
{
   "ids" : ["recordIds"],
   "fields" : ["fieldName"]
}

```

**Parameters**

|Parameter|Description|
|---------|-----------|
|`recordIds`|Required. A list of one or more IDs of the objects to return. All IDs must belong to the same object type.|
|`fieldNames`|Required. A list of fields to include in the response. The field names you specify must be valid, and you must have read-level permissions to each field.|

## Example

**Example Request**

```nolang
curl -X POST https://MyDomainName.my.salesforce.com/services/data/v68.0/composite/sobjects/Account -H "Authorization: Bearer token" -H "Content-Type: application/json" -d "@exampleRequestBody.json"
```

**Example Request Body**

```nolang
{
   "ids" : ["001xx000003DGb1AAG", "001xx000003DGb0AAG", "001xx000003DGb9AAG"],
   "fields" : ["id", "name"]
}

```

**Example Response Body**

```nolang
[
   {
      "attributes" : {
         "type" : "Account",
         "url" : "/services/data/v68.0/sobjects/Account/001xx000003DGb1AAG"
      },
      "Id" : "001xx000003DGb1AAG",
      "Name" : "Acme"
   },
   {
      "attributes" : {
         "type" : "Account",
         "url" : "/services/data/v68.0/sobjects/Account/001xx000003DGb0AAG"
      },
      "Id" : "001xx000003DGb0AAG",
      "Name" : "Global Media"
   },
   null
]

```

