> ## Documentation Index
> Fetch the complete documentation index at: https://docs.rawchunks.space/llms.txt
> Use this file to discover all available pages before exploring further.

# Activate or merge a take

> Select a take as the base or merge a candidate composition.

`base` selects the take. A Layer candidate becomes a new unmuted stem. `merge` without `composition` merges the take’s recorded region. With `composition`, upload your rendered WAV and supply the latest history `commitId`.

[Takes](/dev/guides/edit/takes) · [Client-rendered merge](/dev/guides/edit/merge).

## Headers and parameters

<ParamField header="x-session-user-address" type="string" required>
  Selected account address. Required for owner-scoped reads and writes. It identifies the account; your product must authenticate its own users.
</ParamField>

## JSON body

<ParamField body="songId" type="string" required>
  Opaque ID returned by the API. Minimum length: `1`.
</ParamField>

<ParamField body="stemId" type="string">
  Optional. Must match the take if supplied.
</ParamField>

<ParamField body="takeId" type="string" required>
  Opaque ID returned by the API. Minimum length: `1`.
</ParamField>

<ParamField body="userAddress" type="string">
  Wallet address for the selected account. Use the same address as the session owner. Minimum length: `10`.
</ParamField>

<ParamField body="action" type="string" default={"base"}>
  Values: `base`, `merge`.
</ParamField>

<ParamField body="composition" type="object">
  <Expandable title="Properties">
    <ResponseField name="takeIds" type="string[]" required />

    <ResponseField name="placements" type="object[]">
      <Expandable title="Properties">
        <ResponseField name="takeId" type="string" required>
          Opaque ID returned by the API. Minimum length: `1`.
        </ResponseField>

        <ResponseField name="shift" type="number" required>
          Timeline shift in seconds.
        </ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="region" type="object" required>
      <Expandable title="Properties">
        <ResponseField name="start" type="number" required>
          Start on the song timeline, in seconds. Minimum: `0`.
        </ResponseField>

        <ResponseField name="end" type="number" required>
          End on the song timeline, in seconds. Must exceed start. Minimum: `0`.
        </ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="original" type="boolean" required>
      Whether the client render includes original audio.
    </ResponseField>

    <ResponseField name="commitId" type="string | null" required>
      Latest commit from history, or null when no commit exists.
    </ResponseField>

    <ResponseField name="srcAudioUrl" type="string" required>
      Uploaded client-rendered WAV for this composition.
    </ResponseField>
  </Expandable>
</ParamField>

## Response (200)

Success.

<ResponseField name="success" type="boolean" required />

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

<ResponseField name="take" type="object">
  <Expandable title="Properties">
    <ResponseField name="id" type="string" required />

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

    <ResponseField name="stem_id" type="string | null" />

    <ResponseField name="take_number" type="integer" />

    <ResponseField name="model" type="string" />

    <ResponseField name="task" type="string" />

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

    <ResponseField name="is_active" type="boolean" required />

    <ResponseField name="prompt" type="string | null" />

    <ResponseField name="lyrics" type="string | null" />

    <ResponseField name="repainting_start" type="number | null" />

    <ResponseField name="repainting_end" type="number | null" />

    <ResponseField name="seed" type="integer | null" />

    <ResponseField name="provenance" type="object | null">
      <Expandable title="Properties">
        <ResponseField name="target" type="string">
          Values: `master`, `stem`, `layer`.
        </ResponseField>

        <ResponseField name="targetStemId" type="string | null" />

        <ResponseField name="region" type="object | null">
          <Expandable title="Properties">
            <ResponseField name="start" type="number" required>
              Start on the song timeline, in seconds. Minimum: `0`.
            </ResponseField>

            <ResponseField name="end" type="number" required>
              End on the song timeline, in seconds. Must exceed start. Minimum: `0`.
            </ResponseField>
          </Expandable>
        </ResponseField>

        <ResponseField name="regions" type="object[]">
          <Expandable title="Properties">
            <ResponseField name="start" type="number" required>
              Start on the song timeline, in seconds. Minimum: `0`.
            </ResponseField>

            <ResponseField name="end" type="number" required>
              End on the song timeline, in seconds. Must exceed start. Minimum: `0`.
            </ResponseField>
          </Expandable>
        </ResponseField>

        <ResponseField name="audioOffset" type="number">
          Source-buffer offset for the eligible section, in seconds.
        </ResponseField>

        <ResponseField name="outputDuration" type="number | null" />

        <ResponseField name="mergedInto" type="string" />

        <ResponseField name="layerName" type="string" />
      </Expandable>
    </ResponseField>

    <ResponseField name="created_at" type="string" />
  </Expandable>
</ResponseField>

<ResponseField name="commit" type="object">
  <Expandable title="Properties">
    <ResponseField name="id" type="string" required />

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

    <ResponseField name="user_address" type="string" />

    <ResponseField name="parent_commit_id" type="string | null" />

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

    <ResponseField name="timeline_snapshot" type="object" required />

    <ResponseField name="created_at" type="string" />
  </Expandable>
</ResponseField>

<ResponseField name="versionState" type="string">
  Values: `active`, `merged`.
</ResponseField>

## Errors

Failed JSON responses contain an `error` string. Check the HTTP status before reading a successful result. See [job handling](/dev/guides/jobs) for interrupted or uncertain submissions.

| Status | Meaning |
| - | - |
| `400` | Invalid request. |
| `403` | Account does not match resource. |
| `404` | Resource not found. |
| `409` | Resource conflict; reload state or open an editable version. |
| `500` | Request failed. |

<RequestExample>
  ```bash cURL theme={null}
  curl --fail-with-body -X POST "$RAWCHUNKS_API/api/editing/activate" \
    -H "x-session-user-address: $USER_ADDRESS" \
    -H "Content-Type: application/json" \
    --data "$(jq -nc --arg user "$USER_ADDRESS" --arg song "$SONG_ID" --arg take "$TAKE_ID" '{
    "songId": $song,
    "userAddress": $user,
    "takeId": $take,
    "action": "base"
  }')"
  ```
</RequestExample>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.