Salesforce Composite API

The Composite API executes a series of REST API requests in a single POST request, or retrieves a list of other composite resources with a GET request. There are three types of Composite requests sometime referred to as APIs: - [Composite](https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_composite_composite.htm) (the original) - [Composite Batch](https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_composite_batch.htm) - [Composite Graph](https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_composite_graph.htm) (the most recent)

Documentation

Specifications

Schemas & Data

OpenAPI Specification

salesforce-composite-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Salesforce Bulk API 2.0 Abort Composite API
  description: 'Salesforce Bulk API 2.0 is a simplified, REST-based interface for bulk data operations that improves on the original Bulk API. It uses a straightforward job model and supports CSV format for ingest and query jobs, enabling processing of millions of records asynchronously.

    '
  version: v63.0
  contact:
    name: Salesforce Developers
    url: https://developer.salesforce.com/
  license:
    name: Salesforce Developer Terms
    url: https://www.salesforce.com/company/legal/agreements/
servers:
- url: https://{instance}.salesforce.com/services/data/v{version}/jobs
  description: Salesforce Bulk API 2.0 jobs endpoint
  variables:
    instance:
      default: yourInstance
      description: 'The Salesforce instance identifier (e.g., na1, eu3, or a My Domain subdomain like mycompany).

        '
    version:
      default: '63.0'
      description: 'The Salesforce API version number (e.g., 63.0). Use the latest supported version for new integrations.

        '
security:
- BearerAuth: []
tags:
- name: Composite
  description: 'The Composite API executes a series of REST API requests in a single POST request, or retrieves a list of other composite resources with a GET request.


    There are three types of Composite requests sometime referred to as APIs:

    - [Composite](https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_composite_composite.htm) (the original)

    - [Composite Batch](https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_composite_batch.htm)

    - [Composite Graph](https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_composite_graph.htm) (the most recent)'
paths:
  /data/v64.0/composite:
    parameters: []
    post:
      tags:
      - Composite
      summary: Salesforce Composite
      description: 'Executes a series of REST API requests in a single call. You can use the output of one request as the input to a subsequent request. The response bodies and HTTP statuses of the requests are returned in a single response body. The entire request counts as a single call toward your API limits.

        The requests in a composite call are called subrequests. All subrequests are executed in the context of the same user. In a subrequest’s body, you specify a reference ID that maps to the subrequest’s response. You can then refer to the ID in the url or body fields of later subrequests by using a JavaScript-like reference notation.


        https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_composite_composite.htm'
      operationId: Composite
      parameters:
      - name: Authorization
        in: header
        description: Only used for Postman Notebooks. Auth is defined at collection-level and inherited down.
        required: true
        schema:
          type: string
        example: example_value
      requestBody:
        description: ''
        content:
          application/json:
            schema:
              allOf:
              - $ref: '#/components/schemas/CompositeRequest'
              - examples:
                - compositeRequest:
                  - method: POST
                    url: /services/data/v64.0/sobjects/Account
                    referenceId: refAccount
                    body:
                      Name: Sample Account
                  - method: POST
                    url: /services/data/v64.0/sobjects/Contact
                    referenceId: refContact
                    body:
                      LastName: Sample Contact
                      AccountId: '@{refAccount.id}'
              contentMediaType: application/json
            example:
              compositeRequest:
              - method: POST
                url: /services/data/v64.0/sobjects/Account
                referenceId: refAccount
                body:
                  Name: Sample Account
              - method: POST
                url: /services/data/v64.0/sobjects/Contact
                referenceId: refContact
                body:
                  LastName: Sample Contact
                  AccountId: '@{refAccount.id}'
        required: true
      responses:
        '200':
          description: OK
          headers:
            Date:
              content:
                text/plain:
                  schema:
                    type: string
                    contentMediaType: text/plain
                  example: Mon, 20 Nov 2023 15:18:26 GMT
            Strict-Transport-Security:
              content:
                text/plain:
                  schema:
                    type: string
                    contentMediaType: text/plain
                  example: max-age=63072000; includeSubDomains
            X-Content-Type-Options:
              content:
                text/plain:
                  schema:
                    type: string
                    contentMediaType: text/plain
                  example: nosniff
            X-XSS-Protection:
              content:
                text/plain:
                  schema:
                    type: string
                    contentMediaType: text/plain
                  example: 1; mode=block
            X-Robots-Tag:
              content:
                text/plain:
                  schema:
                    type: string
                    contentMediaType: text/plain
                  example: none
            Cache-Control:
              content:
                text/plain:
                  schema:
                    type: string
                    contentMediaType: text/plain
                  example: no-cache,must-revalidate,max-age=0,no-store,private
            Sforce-Limit-Info:
              content:
                text/plain:
                  schema:
                    type: string
                    contentMediaType: text/plain
                  example: api-usage=33/15000
            Vary:
              content:
                text/plain:
                  schema:
                    type: string
                    contentMediaType: text/plain
                  example: Accept-Encoding
            Content-Encoding:
              content:
                text/plain:
                  schema:
                    type: string
                    contentMediaType: text/plain
                  example: gzip
            Transfer-Encoding:
              content:
                text/plain:
                  schema:
                    type: string
                    contentMediaType: text/plain
                  example: chunked
          content:
            application/json;charset=UTF-8:
              schema:
                allOf:
                - $ref: '#/components/schemas/SuccessfulComposite'
                - examples:
                  - compositeResponse:
                    - body:
                        id: 001...
                        success: true
                        errors: []
                      httpHeaders:
                        Location: /services/data/v53.0/sobjects/Account/001...
                      httpStatusCode: 201
                      referenceId: refAccount
                    - body:
                        id: 0032o00003WauzJAAR
                        success: true
                        errors: []
                      httpHeaders:
                        Location: /services/data/v53.0/sobjects/Contact/003...
                      httpStatusCode: 201
                      referenceId: refContact
                contentMediaType: application/json;charset=UTF-8
              example:
                compositeResponse:
                - body:
                    id: 001...
                    success: true
                    errors: []
                  httpHeaders:
                    Location: /services/data/v53.0/sobjects/Account/001...
                  httpStatusCode: 201
                  referenceId: refAccount
                - body:
                    id: 0032o00003WauzJAAR
                    success: true
                    errors: []
                  httpHeaders:
                    Location: /services/data/v53.0/sobjects/Contact/003...
                  httpStatusCode: 201
                  referenceId: refContact
      deprecated: false
      security: []
      servers:
      - url: https://services
        variables: {}
      x-api-evangelist-processing:
        PascalCaseOperationSummaries: true
        ChooseTags: true
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
  /data/v64.0/composite/graph:
    parameters: []
    post:
      tags:
      - Composite
      summary: Salesforce Composite Graph
      description: 'Composite graphs provide an enhanced way to perform composite requests, which execute a series of REST API requests in a single call.

        Regular composite requests allow you to execute a series of REST API requests in a single call. And you can use the output of one request as the input to a subsequent request.


        Composite graphs extend this by allowing you to assemble a more complicated and complete series of related objects and records.


        Composite graphs also enable you to ensure that the steps in a given set of operations are either all completed or all not completed. This avoids requiring you to check for a mix of successful and unsuccessful results.


        Regular composite requests have a limit of 25 subrequests. Composite graphs increase this limit to 500. This gives a single API call much greater power.


        https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_composite_graph_introduction.htm'
      operationId: CompositeGraph
      parameters: []
      requestBody:
        description: ''
        content:
          application/json:
            schema:
              allOf:
              - $ref: '#/components/schemas/CompositeGraphRequest'
              - examples:
                - graphs:
                  - graphId: graph1
                    compositeRequest:
                    - method: POST
                      url: /services/data/v64.0/sobjects/Account/
                      referenceId: newAccount
                      body:
                        Name: ACME Inc.
                        Custom__c: Hello world
                    - method: GET
                      url: /services/data/v64.0/sobjects/Account/@{newAccount.id}
                      referenceId: newAccountInfo
              contentMediaType: application/json
            example:
              graphs:
              - graphId: graph1
                compositeRequest:
                - method: POST
                  url: /services/data/v64.0/sobjects/Account/
                  referenceId: newAccount
                  body:
                    Name: ACME Inc.
                    Custom__c: Hello world
                - method: GET
                  url: /services/data/v64.0/sobjects/Account/@{newAccount.id}
                  referenceId: newAccountInfo
        required: true
      responses:
        '200':
          description: OK
          headers:
            cache-control:
              content:
                text/plain:
                  schema:
                    type: string
                    contentMediaType: text/plain
                  example: no-cache,must-revalidate,max-age=0,no-store,private
            content-type:
              content:
                text/plain:
                  schema:
                    type: string
                    contentMediaType: text/plain
                  example: application/json;charset=UTF-8
          content:
            application/json:
              schema:
                allOf:
                - $ref: '#/components/schemas/SuccessfulCompositeGraph'
                - examples:
                  - graphs:
                    - graphId: graph1
                      graphResponse:
                        compositeResponse:
                        - body:
                            id: 0014H00002x6HUhQAM
                            success: true
                            errors: []
                          httpHeaders:
                            Location: /services/data/v50.0/sobjects/Account/0014H00002x6HUhQAM
                          httpStatusCode: 201
                          referenceId: newAccount
                        - body:
                            id: 0034H00002JsInQQAV
                            success: true
                            errors: []
                          httpHeaders:
                            Location: /services/data/v50.0/sobjects/Contact/0034H00002JsInQQAV
                          httpStatusCode: 201
                          referenceId: newContact
                      isSuccessful: true
                contentMediaType: application/json
              example:
                graphs:
                - graphId: graph1
                  graphResponse:
                    compositeResponse:
                    - body:
                        id: 0014H00002x6HUhQAM
                        success: true
                        errors: []
                      httpHeaders:
                        Location: /services/data/v50.0/sobjects/Account/0014H00002x6HUhQAM
                      httpStatusCode: 201
                      referenceId: newAccount
                    - body:
                        id: 0034H00002JsInQQAV
                        success: true
                        errors: []
                      httpHeaders:
                        Location: /services/data/v50.0/sobjects/Contact/0034H00002JsInQQAV
                      httpStatusCode: 201
                      referenceId: newContact
                  isSuccessful: true
      deprecated: false
      servers:
      - url: https://services
        variables: {}
      x-api-evangelist-processing:
        PascalCaseOperationSummaries: true
        ChooseTags: true
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
  /data/v64.0/composite/batch:
    parameters: []
    post:
      tags:
      - Composite
      summary: Salesforce Composite Batch
      description: 'Executes up to 25 subrequests in a single request. The response bodies and HTTP statuses of the subrequests in the batch are returned in a single response body. Each subrequest counts against rate limits.

        The requests in a batch are called subrequests. All subrequests are executed in the context of the same user. Subrequests are independent, and you can’t pass information between them. Subrequests execute serially in their order in the request body. When a subrequest executes successfully, it commits its data. Commits are reflected in the output of later subrequests. If a subrequest fails, commits made by previous subrequests are not rolled back. If a batch request doesn’t complete within 10 minutes, the batch times out and the remaining subrequests aren’t executed.


        https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_composite_batch.htm'
      operationId: CompositeBatch
      parameters: []
      requestBody:
        description: ''
        content:
          application/json:
            schema:
              allOf:
              - $ref: '#/components/schemas/CompositeBatchRequest'
              - examples:
                - haltOnError: true
                  batchRequests:
                  - method: GET
                    url: v64.0/query/?q=SELECT+Id,+Name+FROM+Account LIMIT 2
                  - method: GET
                    url: v64.0/query/?q=SELECT+Id,+Name+FROM+Opportunity LIMIT 2
              contentMediaType: application/json
            example:
              haltOnError: true
              batchRequests:
              - method: GET
                url: v64.0/query/?q=SELECT+Id,+Name+FROM+Account LIMIT 2
              - method: GET
                url: v64.0/query/?q=SELECT+Id,+Name+FROM+Opportunity LIMIT 2
        required: true
      responses:
        '200':
          description: OK
          headers:
            Date:
              content:
                text/plain:
                  schema:
                    type: string
                    contentMediaType: text/plain
                  example: Mon, 20 Nov 2023 15:19:46 GMT
            Strict-Transport-Security:
              content:
                text/plain:
                  schema:
                    type: string
                    contentMediaType: text/plain
                  example: max-age=63072000; includeSubDomains
            X-Content-Type-Options:
              content:
                text/plain:
                  schema:
                    type: string
                    contentMediaType: text/plain
                  example: nosniff
            X-XSS-Protection:
              content:
                text/plain:
                  schema:
                    type: string
                    contentMediaType: text/plain
                  example: 1; mode=block
            X-Robots-Tag:
              content:
                text/plain:
                  schema:
                    type: string
                    contentMediaType: text/plain
                  example: none
            Cache-Control:
              content:
                text/plain:
                  schema:
                    type: string
                    contentMediaType: text/plain
                  example: no-cache,must-revalidate,max-age=0,no-store,private
            Sforce-Limit-Info:
              content:
                text/plain:
                  schema:
                    type: string
                    contentMediaType: text/plain
                  example: api-usage=34/15000
            Vary:
              content:
                text/plain:
                  schema:
                    type: string
                    contentMediaType: text/plain
                  example: Accept-Encoding
            Content-Encoding:
              content:
                text/plain:
                  schema:
                    type: string
                    contentMediaType: text/plain
                  example: gzip
            Transfer-Encoding:
              content:
                text/plain:
                  schema:
                    type: string
                    contentMediaType: text/plain
                  example: chunked
          content:
            application/json;charset=UTF-8:
              schema:
                type: string
                examples:
                - "{\n    \"hasErrors\": false,\n    \"results\": [\n        {\n            \"statusCode\": 200,\n            \"result\": {\n                \"totalSize\": 2,\n                \"done\": true,\n                \"records\": [\n                    {\n                        \"attributes\": {\n                            \"type\": \"Account\",\n                            \"url\": \"/services/data/v58.0/sobjects/Account/001...\"\n                        },\n                        \"Id\": \"001...\",\n                        \"Name\": \"Sample Account\"\n                    },\n                    ...\n                ]\n            }\n        },\n        {\n            \"statusCode\": 200,\n            \"result\": {\n                \"totalSize\": 2,\n                \"done\": true,\n                \"records\": [\n                    {\n                        \"attributes\": {\n                            \"type\": \"Opportunity\",\n                            \"url\": \"/services/data/v58.0/sobjects/Opportunity/006...\"\n                        },\n                        \"Id\": \"006...\",\n                        \"Name\": \"Edge Emergency Generator\"\n                    },\n                    ...\n                ]\n            }\n        }\n    ]\n}"
                contentMediaType: application/json;charset=UTF-8
              example: "{\n    \"hasErrors\": false,\n    \"results\": [\n        {\n            \"statusCode\": 200,\n            \"result\": {\n                \"totalSize\": 2,\n                \"done\": true,\n                \"records\": [\n                    {\n                        \"attributes\": {\n                            \"type\": \"Account\",\n                            \"url\": \"/services/data/v58.0/sobjects/Account/001...\"\n                        },\n                        \"Id\": \"001...\",\n                        \"Name\": \"Sample Account\"\n                    },\n                    ...\n                ]\n            }\n        },\n        {\n            \"statusCode\": 200,\n            \"result\": {\n                \"totalSize\": 2,\n                \"done\": true,\n                \"records\": [\n                    {\n                        \"attributes\": {\n                            \"type\": \"Opportunity\",\n                            \"url\": \"/services/data/v58.0/sobjects/Opportunity/006...\"\n                        },\n                        \"Id\": \"006...\",\n                        \"Name\": \"Edge Emergency Generator\"\n                    },\n                    ...\n                ]\n            }\n        }\n    ]\n}"
      deprecated: false
      servers:
      - url: https://services
        variables: {}
      x-api-evangelist-processing:
        PascalCaseOperationSummaries: true
        ChooseTags: true
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
  /composite/batch:
    post:
      operationId: executeBatchRequest
      summary: Salesforce Execute a Batch of Requests
      description: 'Executes up to 25 independent REST API subrequests in a single HTTP call. All requests are processed independently; failure of one does not affect others. Returns an array of results in the same order as the subrequests. Use this to reduce the number of round trips when making multiple unrelated requests.

        '
      tags:
      - Composite
      requestBody:
        required: true
        description: 'An array of up to 25 independent subrequests to execute as a batch.

          '
        content:
          application/json:
            schema:
              type: object
              required:
              - batchRequests
              properties:
                batchRequests:
                  type: array
                  description: 'Array of subrequests to execute. Each subrequest is independent of the others.

                    '
                  maxItems: 25
                  items:
                    type: object
                    required:
                    - method
                    - url
                    properties:
                      method:
                        type: string
                        enum:
                        - GET
                        - POST
                        - PATCH
                        - DELETE
                        description: HTTP method for the subrequest.
                      url:
                        type: string
                        description: 'Relative URL for the subrequest (e.g., /services/data/v63.0/sobjects/Account/001...).

                          '
                      richInput:
                        type: object
                        description: 'Request body for POST and PATCH subrequests.

                          '
                haltOnError:
                  type: boolean
                  default: false
                  description: 'If true, stop processing subsequent subrequests after the first error occurs.

                    '
            examples:
              ExecutebatchrequestRequestExample:
                summary: Default executeBatchRequest request
                x-microcks-default: true
                value:
                  batchRequests:
                  - method: GET
                    url: https://www.example.com
                    richInput: example_value
                  haltOnError: true
      responses:
        '200':
          description: Results for each subrequest in the batch, in the same order.
          content:
            application/json:
              schema:
                type: object
                properties:
                  hasErrors:
                    type: boolean
                    description: Whether any subrequest returned an error response.
                  results:
                    type: array
                    description: 'Array of subrequest results in the same order as the input batchRequests.

                      '
                    items:
                      type: object
                      properties:
                        statusCode:
                          type: integer
                          description: HTTP status code of the subrequest.
                        result:
                          description: Response body of the subrequest.
              examples:
                Executebatchrequest200Example:
                  summary: Default executeBatchRequest 200 response
                  x-microcks-default: true
                  value:
                    hasErrors: true
                    results:
                    - statusCode: 10
                      result: example_value
        '401':
          description: Unauthorized. Invalid or expired OAuth token.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                Executebatchrequest401Example:
                  summary: Default executeBatchRequest 401 response
                  x-microcks-default: true
                  value:
                    message: example_value
                    errorCode: example_value
                    fields:
                    - example_value
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
  /composite:
    post:
      operationId: executeCompositeRequest
      summary: Salesforce Execute a Composite Request With Dependent Subrequests
      description: 'Executes a series of REST API requests where later requests can reference the results of earlier requests using reference IDs. Supports up to 25 subrequests. If any subrequest fails and allOrNone is true, all changes are rolled back. Use this for complex multi-step operations where later steps depend on earlier results.

        '
      tags:
      - Composite
      requestBody:
        required: true
        description: 'A composite request containing ordered subrequests that may reference each other''s results.

          '
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CompositeRequest_2'
            examples:
              ExecutecompositerequestRequestExample:
                summary: Default executeCompositeRequest request
                x-microcks-default: true
                value:
                  allOrNone: true
                  collateSubrequests: true
                  compositeRequest:
                  - method: GET
                    url: https://www.example.com
                    referenceId: '500123'
                    body: example_value
      responses:
        '200':
          description: 'Results for each subrequest, including reference IDs, status codes, and response bodies.

            '
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CompositeResponse_2'
              examples:
                Executecompositerequest200Example:
                  summary: Default executeCompositeRequest 200 response
                  x-microcks-default: true
                  value:
                    compositeResponse:
                    - body: example_value
                      httpHeaders: example_value
                      httpStatusCode: 10
                      referenceId: '500123'
        '400':
          description: 'Bad request. Invalid subrequest structure or circular reference detected.

            '
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                Executecompositerequest400Example:
                  summary: Default executeCompositeRequest 400 response
                  x-microcks-default: true
                  value:
                    message: example_value
                    errorCode: example_value
                    fields:
                    - example_value
        '401':
          description: Unauthorized. Invalid or expired OAuth token.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                Executecompositerequest401Example:
                  summary: Default executeCompositeRequest 401 response
                  x-microcks-default: true
                  value:
                    message: example_value
                    errorCode: example_value
                    fields:
                    - example_value
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
  /composite/sobjects:
    post:
      operationId: collectionsCreate
      summary: Salesforce Sobject Collections Create
      description: 'Creates up to 200 records in a single API call using SObject Collections. All records must be of the same or different SObject types. If allOrNone is true, all records must succeed or none are committed. Returns an array of save results with IDs or errors for each record.

        '
      tags:
      - Composite
      requestBody:
        required: true
        description: Array of up to 200 SObject records to create.
        content:
          application/json:
            schema:
              type: object
              required:
              - allOrNone
              - records
              properties:
                allOrNone:
                  type: boolean
                  description: 'If true, all records must be created successfully or none are committed. If false, partial success is allowed.

                    '
                records:
                  type: array
                  description: Array of SObject records to create. Maximum 200 records.
                  maxItems: 200
                  items:
                    $ref: '#/components/schemas/SObjectRecord'
            examples:
              CollectionscreateRequestExample:
                summary: Default collectionsCreate request
                x-microcks-default: true
                value:
                  allOrNone: true
                  records:
                  - attributes:
                      type: example_value
                      url: https://www.example.com
                    Id: abc123
      responses:
        '200':
          description: Array of save results with IDs or errors for each record.
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  properties:
                    id:
                      type: string
                      description: The ID of the newly created record on success.
                    success:
                      type: boolean
                      description: Whether this record was created successfully.
                    errors:
                      type: array
                      description: List of errors if the record creation failed.
                      items:
                        $ref: '#/components/schemas/Error'
              examples:
                Collectionscreate200Example:
                  summary: Default collectionsCreate 200 response
                  x-microcks-default: true
                  value:
                  - id: abc123
                    success: true
                    errors:
                    - message: example_value
                      errorCode: example_value
                      fields: {}
        '401':
          description: Unauthorized. Invalid or expired OAuth token.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                Collectionscreate401Example:
                  summary: Default collectionsCreate 401 response
                  x-microcks-default: true
                  value:
                    message: example_value
                    errorCode: example_value
                    fields:
   

# --- truncated at 32 KB (55 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/salesforce/refs/heads/main/openapi/salesforce-composite-api-openapi.yml