---
schema_version: "1"
id: c3e6c394b4c486f53690de2a7ab4b8ec86d2b27c54daac3505966606d6b11671
title: Composite Request Body
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/api_tooling/tooling_requests_composite_composite.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.api_tooling.meta/api_tooling/tooling_requests_composite_composite.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: 83c840a41c9f886a6058d05dc18cae96f06f7324c0e102003b13acd0a5cb9b2f
description: Describes a collection of subrequests to execute with the /composite resource.
---
# Composite Request Body

Describes a collection of subrequests to execute with the /composite resource.

## Composite Collection Input

The request body contains an allOrNone flag that specifies how to roll back errors and a compositeRequest collection that includes subrequests to execute.

### allOrNone

- **Type**: Boolean
- **Description**: Specifies what to do when an error occurs while processing a subrequest. If the value is true, the entire composite request is rolled back.
    
    If the value is false, the remaining subrequests that don’t depend on the failed subrequest are executed. Dependent subrequests aren’t executed.
    
    In either case, the top-level request returns HTTP 200 and includes responses for each subrequest.
- **Required or Optional**: Optional

### compositeRequest

- **Type**: [Composite Subrequest](#reference_hdd_43v_rkc)\[\]
- **Description**: Collection of subrequests to execute.
- **Required or Optional**: Required

### JSON Example

{
   "allOrNone" : true,
   "compositeRequest" : \[{
      Composite Subrequest
      },{
      Composite Subrequest
      },{
      Composite Subrequest
   }\]
}

## Composite Subrequest

Contains the resource, method, headers, body, and reference ID for the subrequest.

### body

- **Type**: The type depends on the request specified in the url property.
- **Description**: The input body for the subrequest.
- **Required or Optional**: Optional

### httpHeaders

- **Type**: Map<String, String>
- **Description**: Request headers and their values to include with the subrequest. You can include any header supported by the requested resource, except for the following headers because the subrequests inherit their values from the top-level request.
    - Accept
    - Authorization
    - Content-TypeIf you specify these headers in a subrequest, the top-level request fails and returns an HTTP 400 response.
- **Required or Optional**: Optional

### method

- **Type**: String
- **Description**: The method to use with the requested resource. Possible values are POST, PUT, PATCH, GET, and DELETE (case sensitive). For a list of valid methods, see the documentation for the requested resource.
- **Required or Optional**: Required

### referenceId

- **Type**: String
- **Description**: Reference ID that maps to the subrequest’s response and can be used to reference the response in later subrequests.
    
    You can include the referenceId in either the body or URL of a subrequest. Use this syntax to include a reference: @{referenceId.FieldName}.
    
    The referenceId is case sensitive.
    
    You can use two operators with the reference ID.
    
    The . operator references a field on a JSON object in the response. The \[\] operator indexes a JSON collection in the response. You can use each operator recursively as long as it makes sense in the context of the response.
- **Required or Optional**: Required

### url

- **Type**: String
- **Description**: The resource to request.
    - The URL can include any query string parameters that the subrequest supports. The query string must be URL-encoded.
    - The URL must start with /services/data/vXX.X/tooling.
    - You can use parameters to filter response bodies.
- **Required or Optional**: Required

## Usage

Because referenceId is case sensitive, make sure that the case of the field that you’re referring to is correct. The same field can use different cases in different contexts.

![Note](https://developer.salesforce.com/docs/atlas.en-us.api_tooling.meta/api_tooling/images/icon_note.png)

#### Note

You can have up to 25 subrequests in a single call. Up to five of these subrequests can be query operations.