Create Task - AudioShake Developers

Documentation Index

Fetch the complete documentation index at: /llms.txt

Use this file to discover all available pages before exploring further.

Create Task

cURL

curl --request POST \
  --url https://api.audioshake.ai/tasks \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <api-key>' \
  --data '
{
  "assetId": "your_asset_id",
  "targets": [
    {
      "model": "vocals",
      "formats": [
        "wav"
      ]
    },
    {
      "model": "instrumental",
      "formats": [
        "wav"
      ]
    }
  ]
}
'

Python

import requests

url = "https://api.audioshake.ai/tasks"

payload = {
    "assetId": "your_asset_id",
    "targets": [
        {
            "model": "vocals",
            "formats": ["wav"]
        },
        {
            "model": "instrumental",
            "formats": ["wav"]
        }
    ]
}
headers = {
    "x-api-key": "<api-key>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)

JavaScript

const options = {
  method: 'POST',
  headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
  body: JSON.stringify({
    assetId: 'your_asset_id',
    targets: [{model: 'vocals', formats: ['wav']}, {model: 'instrumental', formats: ['wav']}]
  })
};

fetch('https://api.audioshake.ai/tasks', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));

PHP

<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api.audioshake.ai/tasks",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => json_encode([
    'assetId' => 'your_asset_id',
    'targets' => [
        [
                'model' => 'vocals',
                'formats' => [
                                'wav'
                ]
        ],
        [
                'model' => 'instrumental',
                'formats' => [
                                'wav'
                ]
        ]
    ]
  ]),
  CURLOPT_HTTPHEADER => [
    "Content-Type: application/json",
    "x-api-key: <api-key>"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
?>

Go

package main

import (
    "fmt"
    "strings"
    "net/http"
    "io"
)

func main() {

url := "https://api.audioshake.ai/tasks"

payload := strings.NewReader("{\n  \"assetId\": \"your_asset_id\",\n  \"targets\": [\n    {\n      \"model\": \"vocals\",\n      \"formats\": [\n        \"wav\"\n      ]\n    },\n    {\n      \"model\": \"instrumental\",\n      \"formats\": [\n        \"wav\"\n      ]\n    }\n  ]\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("x-api-key", "<api-key>")
    req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
    body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))
}

Java

HttpResponse<String> response = Unirest.post("https://api.audioshake.ai/tasks")
  .header("x-api-key", "<api-key>")
  .header("Content-Type", "application/json")
  .body("{\n  \"assetId\": \"your_asset_id\",\n  \"targets\": [\n    {\n      \"model\": \"vocals\", \"formats\": [\n        \"wav\"\n      ]\n    },\n    {\n      \"model\": \"instrumental\", \"formats\": [\n        \"wav\"\n      ]\n    }\n  ]\n}")
  .asString();

Ruby

require 'uri'
require 'net/http'

url = URI("https://api.audioshake.ai/tasks")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"assetId\": \"your_asset_id\",\n  \"targets\": [\n    {\n      \"model\": \"vocals\", \"formats\": [\n        \"wav\"\n      ]\n    },\n    {\n      \"model\": \"instrumental\", \"formats\": [\n        \"wav\"\n      ]\n    }\n  ]\n}"

response = http.request(request)
puts response.read_body

Response Example

{
  "id": "<string>",
  "createdAt": "2023-11-07T05:31:56Z",
  "completedAt": "2023-11-07T05:31:56Z",
  "clientId": "<string>",
  "cost": 123,
  "assetId": "<string>",
  "url": "<string>",
  "writeDestination": "<string>",
  "metadata": "<string>",
  "targets": [
    {
      "id": "<string>",
      "model": "<string>",
      "formats": [
        "<string>"
      ],
      "output": [
        {
          "name": "<string>",
          "format": "<string>",
          "link": "<string>"
        }
      ],
      "cost": 123,
      "error": {
        "code": 123,
        "message": "<string>"
      },
      "duration": 123,
      "residual": true,
      "language": "<string>",
      "transcriptUrl": "<string>",
      "transcriptAssetId": "<string>"
    }
  ]
}

Submit a media source and up to 20 model targets for processing. Each target specifies a model and output format. Provide exactly one source — either a public url or an assetId from a previous upload.

To write outputs directly to your own S3 bucket, see Custom S3 Write Destination.

Examples

Separate vocals and instrumental:

{
  "assetId": "your_asset_id",
  "targets": [
    { "model": "vocals", "formats": ["wav"] },
    { "model": "instrumental", "formats": ["wav"] }
  ]
}

Transcribe lyrics:

{
  "assetId": "your_asset_id",
  "targets": [
    { "model": "transcription", "formats": ["json"] }
  ]
}

Checking results

Tasks process asynchronously. The response returns a Task id you can use to check progress:

  1. Task is created

Each target begins in processing status.

  1. Check for completion

Call Get Task by ID and check each target’s status. When a target finishes, its status becomes completed (with output download links) or error.

Use webhooks to get notified when a Task completes instead of polling.

Authorizations

x-api-key

string

header

required

Body

application/json

assetId

string

required

Asset ID of an input media file

targets

object[]

required

One or more model targets to process

Required array length: 1 - 20 elements

Response

200 - application/json

Default Response

id

string

Unique identifier of the Task

createdAt

string

Timestamp of when the Task was created

completedAt

string | null

Timestamp of when the Task was completed

clientId

string

Unique identifier of the client

cost

number

Processing cost in credits

assetId

string

Asset ID of an input media file. Mutually exclusive with url

url

string | null

URL of an input media file. Mutually exclusive with assetId

writeDestination

string | null

S3 URI prefix outputs were written under. Outputs are organized as //targets//output/. Only present when a custom write destination was provided.

metadata

string

Client-provided metadata. Stored and returned as-is in responses and webhooks.

Note

Responses are generated using AI and may contain mistakes.