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

# Upload a File

> Upload a local file and use it in a Task

If your media is local rather than a public URL, upload it first to create an Asset. Then reference the returned `assetId` when creating a Task.

## Upload and create a Task

<CodeGroup>
  ```python upload_and_process.py theme={null}
  import requests

  API_KEY = "your_api_key"

  # 1. Upload the file
  upload_res = requests.post(
      "https://api.audioshake.ai/assets",
      headers={"x-api-key": API_KEY},
      files={"file": open("song.mp3", "rb")}
  )

  asset_id = upload_res.json()["id"]
  print(f"Asset created: {asset_id}")

  # 2. Create a Task using the assetId
  task_res = requests.post(
      "https://api.audioshake.ai/tasks",
      headers={"Content-Type": "application/json", "x-api-key": API_KEY},
      json={
          "assetId": asset_id,
          "targets": [
              {"model": "vocals", "formats": ["wav"]},
              {"model": "instrumental", "formats": ["wav"]}
          ]
      }
  )

  task_id = task_res.json()["id"]
  print(f"Task created: {task_id}")
  ```

  ```javascript uploadAndProcess.js theme={null}
  const API_KEY = "your_api_key";

  // 1. Upload the file
  const formData = new FormData();
  formData.append("file", fileBlob, "song.mp3");

  const uploadRes = await fetch("https://api.audioshake.ai/assets", {
    method: "POST",
    headers: { "x-api-key": API_KEY },
    body: formData
  });

  const { id: assetId } = await uploadRes.json();
  console.log(`Asset created: ${assetId}`);

  // 2. Create a Task using the assetId
  const taskRes = await fetch("https://api.audioshake.ai/tasks", {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
      "x-api-key": API_KEY
    },
    body: JSON.stringify({
      assetId,
      targets: [
        { model: "vocals", formats: ["wav"] },
        { model: "instrumental", formats: ["wav"] }
      ]
    })
  });

  const { id: taskId } = await taskRes.json();
  console.log(`Task created: ${taskId}`);
  ```

  ```bash curl theme={null}
  # 1. Upload the file
  curl -X POST "https://api.audioshake.ai/assets" \
    -H "x-api-key: $AUDIOSHAKE_API_KEY" \
    -F 'file=@song.mp3'

  # 2. Create a Task with the returned assetId
  curl -X POST "https://api.audioshake.ai/tasks" \
    -H "Content-Type: application/json" \
    -H "x-api-key: $AUDIOSHAKE_API_KEY" \
    -d '{
      "assetId": "your_asset_id",
      "targets": [
        { "model": "vocals", "formats": ["wav"] },
        { "model": "instrumental", "formats": ["wav"] }
      ]
    }'
  ```
</CodeGroup>

Then [check Task status](/check-task-status) to monitor progress and download results.

<Info>Maximum file size is 2GB. Uploaded Assets expire after 72 hours.</Info>

See the [Formats](/api-reference/formats) page for supported input file types.
