Complex JSON API: Start Productions using Presets

Our complex JSON-based API can be used for complex workflows and detailed control.

Warning

Please try the Auphonic Simple API first and only use our Complex API if you are a programmer and want complete control!

The first examples on this page show how it’s possible to start a production by referencing an existing preset and how to add chapter marks. More complex examples are on the next page.

Multiple steps are necessary to create and start an audio post production:

Step 1:
Create a production and reference the preset you want to use.
Step 2 (optional):
Upload your input file and add it to the newly created production.
Step 3:
Start the audio post production on our servers.

Start a Production and Upload a File

Step 1: The following POST request creates a new Production and references an existing Preset:

curl -X POST -H "Content-Type: application/json" \
    https://auphonic.com/api/productions.json \
    -u username:password \
    -d '{
            "preset": "ceigtvDv8jH6NaK52Z5eXH",
            "metadata": { "title": "My first Production" }
        }'
Parameters:
  • preset: UUID of the referenced preset, you can find it on the Preset Page
  • title: the title metadata tag of the production

The API URL to create productions is https://auphonic.com/api/productions.json - here the ending .json means, that the returned data will be in JSON format. It’s also possible to use https://auphonic.com/api/productions.xml if you prefer XML data output.

Note

It’s necessary to set the HTTP header to JSON (using curl -H “Content-Type: application/json”)!

This first request returns JSON data containing the UUID of the newly created production:

{
    "status_code": 200,
    "form_errors": {},
    "error_code": null,
    "error_message": "",
    "data": {
        ...
        "uuid": "KKw7AxpLrDBQKLVnQCBtCh",
        ...
    }
}

Step 2: Using the production UUID, it’s possible to upload an input file:

curl -X POST https://auphonic.com/api/production/KKw7AxpLrDBQKLVnQCBtCh/upload.json \
    -u username:password \
    -F "input_file=@/home/user/your_audio_file.mp3"
Parameters:
  • the UUID of the production is now included in the URL https://auphonic.com/api/production/{uuid}/upload.json
  • input_file: the local audio or video file you want to upload

Note

For uploading files, it’s necessary to encode your POST request in multipart/form-data, not JSON!

Step 3: Now we have all data to start the audio post production on the auphonic servers, which can be done with:

curl -X POST https://auphonic.com/api/production/KKw7AxpLrDBQKLVnQCBtCh/start.json -u username:password

where the UUID of the production is again part of the URL https://auphonic.com/api/production/{uuid}/start.json.

See also how to download result media files!

Upload Files with HTTP

The manual file upload (step 2) is not necessary, if you fetch a file from an external HTTP server as input audio:

curl -X POST -H "Content-Type: application/json" \
    https://auphonic.com/api/productions.json \
    -u username:password \
    -d '{
            "preset": "ceigtvDv8jH6NaK52Z5eXH",
            "input_file": "http://your_server.com/somefile.mp3",
            "metadata": { "title": "My first HTTP Production" }
        }'

Here we reference an existing preset, set the URL of the input file using the parameter input_file and update the metadata title tag.

This request returns the UUID and it’s possible to start the audio post production:

curl -X POST https://auphonic.com/api/production/{uuid}/start.json -u username:password

Upload Files with External Services (SFTP/FTP/Dropbox/etc.)

When fetching files from SFTP, FTP, Dropbox, Amazon S3, SoundCloud or other External Services, it’s necessary to reference the external service:

curl -X POST -H "Content-Type: application/json" \
    https://auphonic.com/api/productions.json \
    -u username:password \
    -d '{
            "service": "pmefeNCzkyT4TbRbDmoCDf",
            "input_file": "my_dropbox_file.mp3",
            "preset": "ceigtvDv8jH6NaK52Z5eXH",
            "metadata": { "title": "My first Dropbox Production" }
        }'
Parameters:
  • service: the UUID of your registered external service (SFTP/FTP/Dropbox), see Services Page
  • input_file: the filename of the input file (e.g. on the Dropbox server, in the auphonic path)
  • preset: the UUID of the preset you want to use

Warning

For SoundCloud and Spreaker, you have to use the title for the field input_file. For Facebook please use the video ID (as shown on the SoundCloud/Spreaker/Facebook page or returned by List Files on an External Service)!

Adding Chapters

Create a new production with Chapter Marks:

curl -X POST -H "Content-Type: application/json" \
    https://auphonic.com/api/productions.json \
    -u username:password \
    -d '{
            "preset": "ceigtvDv8jH6NaK52Z5eXH",
            "input_file": "http://your_server.com/somefile.mp3",
            "metadata": { "title": "My first Production with Chapters" },
            "chapters": [
                {"start": "00:00:00", "title": "Start Chapter", "url": "http://auphonic.com"},
                {"start": "00:02:18", "title": "Second Chapter"},
                {"start": "00:04:41", "title": "Chapter with Image from URL", "image": "https://auphonic.com/static/images/logo.png"},
                {"start": "00:05:41", "title": "Base64-encoded Chapter Image", "image": "/9j/4AAQEBAQEBAQEBAQEBAQE...E4fp2WCm0nHbX/9k"},
            ]
        }'

Chapters must be added to the chapters parameter, where start is the start time in HH:MM:ss[.mmm], title the title of the chapter and url is an URL with further information. You can also include the parameter image to add a chapter image. The image parameter must be a valid URL to a picture, or the image file itself encoded in base64 (without MIME-Type prefix, just the data).

Warning

Chapter mark start times must be relative to the main input file! If the production contains and additional intro, the length of this intro will be added to each chapter automatically!

Alternatively you can also reference a chapters file from a publicly available URL:

curl -X POST -H "Content-Type: application/json" \
    https://auphonic.com/api/productions.json \
    -u username:password \
    -d '{
            "preset": "ceigtvDv8jH6NaK52Z5eXH",
            "input_file": "http://your_server.com/somefile.mp3",
            "metadata": { "title": "My first Production with Chapters" },
            "chapters": "http://your_server.com/chapters.txt"
        }'

Auphonic imports various chapter formats and marker file formats from audio editors, see How to Import Chapter Marks .

Now start the audio post production:

curl -X POST https://auphonic.com/api/production/{uuid}/start.json -u username:password