> ## Documentation Index
> Fetch the complete documentation index at: https://cantonfoundation-splice-openapi-manual-pages-preview.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Settlement factory

<div class="x2mdx-ref-page x2mdx-ref-page--operation x2mdx-ref-page--manual-api" />

<div class="x2mdx-ref-hero">
  <p class="x2mdx-ref-eyebrow">Allocation V2 API</p>

  <h1 class="x2mdx-ref-title">Settlement factory</h1>

  <div class="x2mdx-ref-badges">
    <span class="x2mdx-ref-badge x2mdx-ref-badge--protocol">OpenAPI</span>

    <span class="x2mdx-ref-badge x2mdx-ref-badge--added">Since 0.6.11</span>
  </div>
</div>

Get the factory and choice context for settling allocations using the `SettlementFactory_SettleBatch` choice. Registries MAY limit the size of the settlement requests that they support. To ensure wide compatibility with apps, registries MUST support all settlement requests that involve at most 25 transfer legs.

## Protocol Details

<div class="x2mdx-ref-meta-grid">
  <div class="x2mdx-ref-meta-item">
    <span class="x2mdx-ref-meta-label">Operation ID</span>
    <span class="x2mdx-ref-meta-value">getSettlementFactory</span>
  </div>

  <div class="x2mdx-ref-meta-item">
    <span class="x2mdx-ref-meta-label">Published</span>
    <span class="x2mdx-ref-meta-value">0.7.4</span>
  </div>

  <div class="x2mdx-ref-meta-item">
    <span class="x2mdx-ref-meta-label">Specification</span>
    <span class="x2mdx-ref-meta-value"><a href="/openapi/splice/token-standard/allocation-v2.yaml">Download OpenAPI</a></span>
  </div>
</div>

## Inputs

### Request body

<div class="x2mdx-ref-badges">
  <span class="x2mdx-ref-badge x2mdx-ref-badge--neutral">application/json</span>
</div>

<ParamField body="choiceArguments" type="object" required>
  The arguments that are intended to be passed to the choice provided by the factory. To avoid repeating the Daml type definitions, they are specified as JSON objects. However the concrete format is given by how the choice arguments are encoded using the Daml JSON API (with the `extraArgs.context` and `extraArgs.meta` fields set to the empty object). The choice arguments are provided so that the registry can also provide choice-argument specific contracts, e.g., the configuration for a specific instrument-id.
</ParamField>

<ParamField body="excludeDebugFields" type="boolean" default="False">
  If set to true, the response will not include fields prefixed with 'debug'. Useful to save bandwidth.
</ParamField>

## Outputs

### 200

<div class="x2mdx-ref-badges">
  <span class="x2mdx-ref-badge x2mdx-ref-badge--neutral">application/json</span>
</div>

<ResponseField name="factoryId" type="string" required>
  The contract ID of the contract implementing the factory interface.
</ResponseField>

<ResponseField name="choiceContext" type="ChoiceContext" required>
  The context required to exercise a choice on a contract via an interface. Used to retrieve additional reference data that is passed in via disclosed contracts, which are in turn referred to via their contract ID in the `choiceContextData`. Asset implementations SHOULD avoid that this value depends on contract-ids passed in the choice arguments, so that clients can prefetch choice contexts when chaining multiple token standard actions together in a single Daml transaction.
</ResponseField>

### 400

<div class="x2mdx-ref-badges">
  <span class="x2mdx-ref-badge x2mdx-ref-badge--neutral">application/json</span>
</div>

<ResponseField name="error" type="string" required />

### 404

<div class="x2mdx-ref-badges">
  <span class="x2mdx-ref-badge x2mdx-ref-badge--neutral">application/json</span>
</div>

<ResponseField name="error" type="string" required />

### 409

<div class="x2mdx-ref-badges">
  <span class="x2mdx-ref-badge x2mdx-ref-badge--neutral">application/json</span>
</div>

<ResponseField name="error" type="string" required />

## History

<div class="x2mdx-ref-history" aria-label="Reference history">
  <div class="x2mdx-ref-history-event x2mdx-ref-history-event--introduced">
    <div class="x2mdx-ref-history-event-head">
      <span class="x2mdx-ref-history-event-label">Introduced</span>
      <code class="x2mdx-ref-history-event-version">0.6.11</code>
    </div>
  </div>
</div>

<RequestExample>
  ```bash Request theme={null}
  curl --request POST \
    --url 'https://example.com/registry/allocation/v2/settlement-factory' \
    --header 'Content-Type: application/json' \
    --data '{"choiceArguments":{},"excludeDebugFields":false}'
  ```
</RequestExample>

<ResponseExample>
  ```json 200 response theme={null}
  {
    "factoryId": "string",
    "choiceContext": {
      "choiceContextData": {},
      "disclosedContracts": [
        {}
      ]
    }
  }
  ```
</ResponseExample>
