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

# Rework a section

> Submit rework a section.

For seed, tempo, key or language controls, use `/apply` with `task: "repaint"`; those controls are not forwarded by this shortcut.

Poll with the returned task kind `repaint`. Completed edits remain pending until [activation or merge](/dev/guides/edit/takes).

## 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">
  Optional target stem in this song. Omit to use the master.
</ParamField>

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

<ParamField body="srcAudioUrl" type="string">
  Optional source override, for example the url from Upload source. Use an HTTP(S) URL.
</ParamField>

<ParamField body="modelQuality" type="string">
  Select a mode listed for this task by GET /api/options. Defaults to base. Layer and Accompany require base. Values: `turbo`, `sft`, `base`.
</ParamField>

<ParamField body="modelVariant" type="string">
  Alternative to modelQuality. If both are sent they must match. Values: `turbo`, `sft`, `base`.
</ParamField>

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

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

<ParamField body="repaintMode" type="string">
  Values: `conservative`, `balanced`, `aggressive`.
</ParamField>

<ParamField body="repaintStrength" type="number">
  Range: `0` to `1`.
</ParamField>

<ParamField body="repaintLatentCrossfadeFrames" type="integer">
  Transition control in latent frames. Minimum: `0`.
</ParamField>

<ParamField body="repaintWavCrossfadeSec" type="number">
  Requested transition length in seconds. Minimum: `0`.
</ParamField>

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

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

<ParamField body="repaint_mode" type="string">
  Alias of repaintMode. Prefer repaintMode. Values: `conservative`, `balanced`, `aggressive`.
</ParamField>

<ParamField body="repaint_strength" type="number">
  Alias of repaintStrength. Prefer repaintStrength. Range: `0` to `1`.
</ParamField>

## Response (202)

Accepted; follow the returned task.

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

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

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

<ResponseField name="task" type="string" required>
  Values: `repaint`, `lego`, `complete`, `extend`, `cover`, `extract`.
</ResponseField>

<ResponseField name="status" type="string" required>
  Values: `pending`, `processing`, `ready`, `error`.
</ResponseField>

<ResponseField name="stems" type="object[]">
  <Expandable title="Properties">
    <ResponseField name="id" type="string" required />

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

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

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

    <ResponseField name="volume" type="number">
      Linear gain, 1 is unity. Minimum: `0`.
    </ResponseField>

    <ResponseField name="pan" type="number">
      Range: `-1` to `1`.
    </ResponseField>

    <ResponseField name="is_muted" type="boolean" />

    <ResponseField name="is_solo" type="boolean" />

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

    <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/repaint" \
    -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 user "$USER_ADDRESS" --arg song "$SONG_ID" '{
    "songId": $song,
    "userAddress": $user,
    "start": 15,
    "end": 30,
    "prompt": "Sparse drums and a warmer bass",
    "repaintMode": "balanced",
    "repaintStrength": 0.5
  }')"
  ```
</RequestExample>

<ResponseExample>
  ```json 202 theme={null}
  {
    "songId": "sng-example",
    "taskId": "task-example",
    "status": "pending",
    "task": "repaint"
  }
  ```
</ResponseExample>


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