> ## 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.

# Extract a section

> Slice a source interval into an inactive take.

This slices the selected source track. It does not separate instruments or render your current mixed arrangement.

[Extract and separate](/dev/guides/edit/extract-separate).

## Headers and parameters

<ParamField header="Authorization" type="string" required>
  `Bearer $SESSION_TOKEN`. Use the complete token from your active [Rawchunks session](/dev/guides/payments).
</ParamField>

<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>

<ParamField header="x-network-id" type="string">
  Session network in CAIP-2 form, for example eip155:8453.
</ParamField>

## JSON body

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

<ParamField body="stemId" type="string" />

<ParamField body="start" type="number" required>
  Minimum: `0`.
</ParamField>

<ParamField body="end" type="number" required>
  Must exceed start and fit the source. Minimum: `0`.
</ParamField>

## Response (201)

Success.

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

<ResponseField name="take" type="object" required>
  <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>

Budget headers use six-decimal USDC atomic units. See [session payments](/dev/guides/payments#track-or-end-a-session).

## 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. |
| `401` | Invalid or expired session token. |
| `402` | Payment required or insufficient session budget. |
| `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/extract" \
    -H "Authorization: Bearer $SESSION_TOKEN" \
    -H "x-network-id: $NETWORK" \
    -H "x-session-user-address: $USER_ADDRESS" \
    -H "Content-Type: application/json" \
    --data "$(jq -nc --arg song "$SONG_ID" '{
    "songId": $song,
    "start": 15,
    "end": 30
  }')"
  ```
</RequestExample>

<ResponseExample>
  ```json 201 theme={null}
  {
    "success": true,
    "take": {
      "id": "take-example",
      "song_id": "sng-example",
      "url": "https://example.com/extracted.wav",
      "is_active": false
    }
  }
  ```
</ResponseExample>


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