================ LIBRARY RULES ================ - Always use Bearer token authentication with API key for security - Use multipart/form-data for file uploads with @ prefix for local files in curl - Reference existing presets by UUID for consistent audio processing settings - Set action parameter to 'start' for immediate processing or 'save' for draft - Use Simple API for batch processing and shell scripts, JSON API for full control - Include proper Content-Type headers when sending JSON data (application/json) - Handle webhook responses for production status updates - Validate audio file formats before upload (MP3, WAV, M4A, FLAC, etc.) - Use loudnesstarget parameter between -13 to -31 LUFS for different standards - For JSON API, create production first, then upload files, then start processing - Use UUID format for all resource references (22 characters from [a-zA-Z0-9]) - Chapter start times must be relative to main input file, not including intro length - For external services, reference service UUID and filename in input_file parameter - Set review_before_publishing to true for manual approval before file transfers - Use multi_input_files array for intros, outros, and audio inserts with offsets - For multitrack productions, set is_multitrack to true and use type: multitrack for each track - Each multitrack track requires unique id parameter for file upload identification - Use OAuth 2.0 for third-party apps, API key auth for personal scripts and integrations - Webhooks receive POST callbacks with uuid, status_string, and status parameters - For external service integration, use JWT-encoded webhooks with client_secret verification ================ CODE SNIPPETS ================ ### Start Production with Local File (Simple API) Source: https://github.com/pgeth/auphonic-api/blob/main/README.md Initiates a new Auphonic production by uploading a local audio or video file and referencing a preset. Requires an API key for authentication. The action parameter can be 'start' or 'save'. ```bash curl -X POST https://auphonic.com/api/simple/productions.json \ -H "Authorization: bearer {api_key}" \ -F "preset=ceigtvDv8jH6NaK52Z5eXH" \ -F "title=My First Production" \ -F "input_file=@/home/user/your_audio_or_video_file.mp3" \ -F "action=start" ``` -------------------------------- ### Start Production with HTTP Input (Simple API) Source: https://github.com/pgeth/auphonic-api/blob/main/README.md Starts a new Auphonic production by fetching an audio or video file from a remote HTTP server. Requires an API key for authentication and specifies a preset and title. The action parameter can be 'start' or 'save'. ```bash curl -X POST https://auphonic.com/api/simple/productions.json \ -H "Authorization: bearer {api_key}" \ -F "preset=ceigtvDv8jH6NaK52Z5eXH" \ -F "title=My First HTTP Production" \ -F "input_file=https://your_server.com/somefile.mp3" \ -F "action=start" ``` -------------------------------- ### Auphonic External Service Integration Source: https://github.com/pgeth/auphonic-api/blob/main/README.md Guides on integrating external services with Auphonic, including OAuth app setup, service creation, and handling JWT-encoded webhooks. ```APIDOC External Service Integration: Integrate your service as an External Service within Auphonic. 1. OAuth App Setup: Setup an Auphonic OAuth app following the OAuth 2.0 Authentication Flow for Web Apps. 2. External Service Creation Call: Creates a connection for an external service. POST /api/service/connect.json Headers: Authorization: Bearer {access_token_of_your_user} Body: display_name: string (required) - A user-friendly name for the service. webhook_url: string (required) - The URL Auphonic will call after production. custom_data: string (optional) - Any data string you want to pass along. 3. Webhook after Production: Auphonic will invoke your webhook URL using JWT-encoded POST request. Content-Type: application/jwt Body: JWT token containing production details. Decode using your OAuth client_secret. ``` -------------------------------- ### Podcast Publishing Workflow (Bash) Source: https://github.com/pgeth/auphonic-api/blob/main/README.md An example bash script demonstrating a complete podcast publishing workflow using the Auphonic API, including metadata, output formats, outgoing services, and algorithms. ```bash curl -X POST -H "Content-Type: application/json" \ https://auphonic.com/api/productions.json \ -H "Authorization: bearer {api_key}" \ -d '{ \ "metadata": { \ "title": "Episode 42: The Answer", \ "artist": "My Podcast", \ "album": "Season 2", \ "track": 42, \ "genre": "Podcast", \ "summary": "In this episode we discuss the meaning of life.", \ "tags": ["philosophy", "life", "answers"] \ }, \ "output_files": [ \ {"format": "mp3", "bitrate": "128"}, \ {"format": "aac", "bitrate": "64"} \ ], \ "outgoing_services": [ \ {"uuid": "your_podcast_host_service_uuid"} \ ], \ "algorithms": { \ "leveler": true, \ "normloudness": true, \ "loudnesstarget": -16, \ "filtering": true \ }, \ "input_file": "https://your-server.com/raw-episode-42.wav", \ "webhook": "https://your-cms.com/auphonic-webhook", \ "action": "start" \ }' ``` -------------------------------- ### Adding Chapters to a Production Source: https://github.com/pgeth/auphonic-api/blob/main/README.md Creates a new production with specified chapter marks. Each chapter can include a start time, title, URL, and an optional image. ```bash curl -X POST -H "Content-Type: application/json" \ https://auphonic.com/api/productions.json \ -H "Authorization: bearer {api_key}" \ -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", "image": "https://auphonic.com/static/images/logo.png"} ] }' ``` -------------------------------- ### Error Handling Example Source: https://github.com/pgeth/auphonic-api/blob/main/README.md Demonstrates how to handle API errors by checking HTTP status codes and parsing error responses using curl. ```bash response=$(curl -w "%{http_code}" -s -o response.json \ -X POST https://auphonic.com/api/productions.json \ -H "Authorization: bearer {api_key}" \ -d '{"invalid": "data"}') if [ "$response" -eq 200 ]; then echo "Success" else echo "Error: HTTP $response" cat response.json fi ``` -------------------------------- ### Get Production Details Source: https://github.com/pgeth/auphonic-api/blob/main/README.md Fetches detailed information about a specific Auphonic production, identified by its UUID. Authentication is required via an API key. ```bash curl https://auphonic.com/api/production/{uuid}.json \ -H "Authorization: bearer {api_key}" ``` -------------------------------- ### JSON API: Create Production and Upload File Source: https://github.com/pgeth/auphonic-api/blob/main/README.md A multi-step process using the JSON API to first create a production with a specified preset and metadata, then upload a local input file, and finally start the production. Each step returns relevant data, including the production UUID. ```bash ### Step 1: Create a new Production curl -X POST -H "Content-Type: application/json" \ https://auphonic.com/api/productions.json \ -H "Authorization: bearer {api_key}" \ -d '{ \ "preset": "ceigtvDv8jH6NaK52Z5eXH", \ "metadata": { "title": "My first Production" } \ }' ### Response for Step 1: ```json { "status_code": 200, "form_errors": {}, "error_code": null, "error_message": "", "data": { "uuid": "KKw7AxpLrDBQKLVnQCBtCh" } } ``` ### Step 2: Upload a local input file curl -X POST https://auphonic.com/api/production/KKw7AxpLrDBQKLVnQCBtCh/upload.json \ -H "Authorization: bearer {api_key}" \ -F "input_file=@/home/user/your_audio_file.mp3" ### Step 3: Start the audio post production curl -X POST https://auphonic.com/api/production/KKw7AxpLrDBQKLVnQCBtCh/start.json \ -H "Authorization: bearer {api_key}" ``` -------------------------------- ### Add Chapter Marks to Production Source: https://github.com/pgeth/auphonic-api/blob/main/README.md Creates an Auphonic production and includes chapter marks from a specified text file. The text file should list chapter start times and titles, optionally with URLs. ```bash curl -X POST https://auphonic.com/api/simple/productions.json \ -H "Authorization: bearer {api_key}" \ -F "preset=ceigtvDv8jH6NaK52Z5eXH" \ -F "title=Production with Chapters" \ -F "input_file=@/home/user/your_audio_or_video_file.mp3" \ -F "chapters=@/home/user/chapters.txt" \ -F "action=start" ``` -------------------------------- ### Set Output Filename and Mono Mixdown Source: https://github.com/pgeth/auphonic-api/blob/main/README.md Configures the output filename and specifies whether to create a mono mixdown for the output file. This example sets the format to MP3 with a bitrate of 48. ```json {"format":"mp3", "bitrate":"48", "filename":"MyFilename.mp3", "mono_mixdown":true} ``` -------------------------------- ### Create Production with Detailed Audio Metadata Source: https://github.com/pgeth/auphonic-api/blob/main/README.md Creates a production and sets detailed audio metadata including title, artist, album, track number, summary, genre, year, publisher, URL, license, tags, and location coordinates. ```bash curl -X POST -H "Content-Type: application/json" \ https://auphonic.com/api/productions.json \ -H "Authorization: bearer {api_key}" \ -d '{ "metadata": { "title": "Production Title", "artist": "The Artist", "album": "Our Album", "track": 1, "subtitle": "Our subtitle", "append_chapters": true, "summary": "Our very long summary.", "genre": "Podcast", "year": 2012, "publisher": "that's me", "url": "https://auphonic.com", "license": "Creative Commons Attribution 3.0 Austria", "license_url": "http://creativecommons.org/licenses/by/3.0/at/", "tags": ["podcast", "auphonic api", "metadata"], "location": { "latitude": "47.070", "longitude": "15.439" } } }' ``` -------------------------------- ### Auphonic API Flavors Source: https://github.com/pgeth/auphonic-api/blob/main/README.md Describes the two main types of Auphonic APIs available: the Simple API for quick scripts and batch processing, and the JSON API for full control over detailed file formats and outgoing services without predefined presets. ```APIDOC API Flavors: - Simple API: For quick shell scripts and batch processing. Uploads files, sets metadata, references presets, and starts/saves productions in a single request. - JSON API: For full control, detailed file formats, and outgoing services. May require multiple requests and JSON response parsing. ``` -------------------------------- ### Add Intro and Outro Files Source: https://github.com/pgeth/auphonic-api/blob/main/README.md Adds intro and outro files to a production using files stored on external services like Dropbox. Specifies the service, input file, and type (intro/outro). ```bash curl -X POST -H "Content-Type: application/json" \ https://auphonic.com/api/production/{uuid}.json \ -H "Authorization: bearer {api_key}" \ -d '{ "multi_input_files": [ { "service": "pmefeNCzkyT4TbRbDmoCDf", "input_file": "my_dropbox_file.mp3", "type": "intro" } ] }' ``` -------------------------------- ### Auphonic API Authentication Methods Source: https://github.com/pgeth/auphonic-api/blob/main/README.md Demonstrates various methods for authenticating with the Auphonic API, including API Key, HTTP Basic Authentication, and OAuth 2.0. ```APIDOC API Key Authentication: Add the API Key to the authorization header: curl https://auphonic.com/api/productions.json \ -H "Authorization: bearer {api_key}" Or as a GET parameter: curl https://auphonic.com/api/productions.json?bearer_token={api_key} HTTP Basic Authentication: curl https://auphonic.com/api/productions.json -u username:password OAuth 2.0 Authentication: Step 1: Register an Auphonic App at the Auphonic Apps Page. Step 2: Redirect user to confirmation page: https://auphonic.com/oauth2/authorize/?client_id={client_id}&redirect_uri={redirect_uri}&response_type=code Step 3: Obtain access token: curl -X POST https://auphonic.com/oauth2/token/ \ -F "client_id={client_id}" \ -F "client_secret={client_secret}" \ -F "redirect_uri={redirect_uri}" \ -F "grant_type=authorization_code" \ -F "code={grant_code}" Step 4: Use access token: curl https://auphonic.com/api/productions.json \ -H "Authorization: Bearer {access_token}" ``` -------------------------------- ### Set All Production Details in One Request Source: https://github.com/pgeth/auphonic-api/blob/main/README.md Configures all production details, including metadata, output files, algorithms, input file, and action, in a single API request. This is useful for creating a new production with all parameters pre-defined. ```bash curl -X POST -H "Content-Type: application/json" \ https://auphonic.com/api/productions.json \ -H "Authorization: bearer {api_key}" \ -d '{ "metadata": { "title": "Production Title", "artist": "The Artist", "album": "Our Album", "track": 1, "summary": "Our very long summary.", "genre": "Podcast", "year": 2012, "tags": ["podcast", "auphonic api", "metadata"] }, "output_files": [ {"format": "mp3", "bitrate": "96"}, {"format": "flac"} ], "algorithms": { "filtering": true, "leveler": true, "normloudness": true, "denoise": true, "loudnesstarget": -23, "denoiseamount": 12 }, "input_file": "http://your_server.com/somefile.mp3", "action": "start" }' ``` -------------------------------- ### Set Detailed Audio Metadata Source: https://github.com/pgeth/auphonic-api/blob/main/README.md Creates an Auphonic production with extensive metadata, including title, artist, album, track number, subtitle, summary, genre, year, publisher, URL, license information, tags, and an image. The input file is also specified. ```bash curl -X POST https://auphonic.com/api/simple/productions.json \ -H "Authorization: bearer {api_key}" \ -F "preset=ceigtvDv8jH6NaK52Z5eXH" \ -F "title=My First Production" \ -F "artist=The Artist" \ -F "album=Our Album" \ -F "track=1" \ -F "subtitle=Our subtitle" \ -F "append_chapters=true" \ -F "summary=Our very long summary." \ -F "genre=Podcast" \ -F "year=2012" \ -F "publisher=that's me" \ -F "url=https://auphonic.com" \ -F "license=Creative Commons Attribution 3.0 Austria" \ -F "license_url=http://creativecommons.org/licenses/by/3.0/at/" \ -F "tags=podcast, auphonic api, metadata" \ -F "image=@/home/user/your_image.jpg" \ -F "input_file=@/home/user/your_audio_or_video_file.mp3" \ -F "action=start" ``` -------------------------------- ### Configure Audio Algorithms Source: https://github.com/pgeth/auphonic-api/blob/main/README.md Creates an Auphonic production with specific audio algorithms enabled or disabled, and their parameters configured. Supports filtering, leveler, loudness normalization, denoising, silence cutting, and more. ```bash curl -X POST https://auphonic.com/api/simple/productions.json \ -H "Authorization: bearer {api_key}" \ -F "preset=ceigtvDv8jH6NaK52Z5eXH" \ -F "title=Production with Detailed Algorithms" \ -F "input_file=@/home/user/your_audio_or_video_file.mp3" \ -F "filtering=true" \ -F "leveler=false" \ -F "normloudness=true" \ -F "loudnesstarget=-24" \ -F "maxpeak=-2" \ -F "denoise=false" \ -F "denoiseamount=100" \ -F "silence_cutter=true" \ -F "filler_cutter=true" \ -F "cough_cutter=true" \ -F "action=start" ``` -------------------------------- ### Multitrack Audio Algorithm Settings Source: https://github.com/pgeth/auphonic-api/blob/main/README.md Configures multitrack audio processing with specific algorithms for different tracks and global settings like loudness target and leveling. ```bash curl -X POST -H "Content-Type: application/json" \ https://auphonic.com/api/productions.json \ -H "Authorization: bearer {api_key}" \ -d '{ "multi_input_files": [ { "type": "multitrack", "id": "speech track", "algorithms": {"denoise": true} }, { "type": "multitrack", "id": "music track", "algorithms": {"filtering": false, "backforeground": "background"} } ], "algorithms": { "loudnesstarget": -23, "leveler": true, "gate": true, "crossgate": true }, "is_multitrack": true }' ``` -------------------------------- ### Auphonic Webhooks Source: https://github.com/pgeth/auphonic-api/blob/main/README.md Details on how to set up and receive webhook notifications from Auphonic for production status updates. ```APIDOC Webhooks: Webhooks are HTTP POST callbacks to automate the interaction with Auphonic after processing is finished. Add Webhook to Production: Configures a webhook for a production. POST /api/productions.json Body: preset: string (required) input_file: string (required) webhook: string (required) - The URL to send notifications to. Webhook Request Details: After production is finished, Auphonic calls your webhook URI with: Parameters sent: uuid: string - the uuid of your production status_string: string - either 'Done' or 'Error' status: integer - 3 for 'Done' or 2 for 'Error' Example webhook call: curl -X POST https://your-web-hook.com/endpoint \ -d "status=3&status_string=Done&uuid=zeigtvDv8jH6NaK52Z5eXH" ``` -------------------------------- ### Auphonic API Reference Source: https://github.com/pgeth/auphonic-api/blob/main/README.md Provides a summary of Auphonic API endpoints, including base URLs, authentication headers, content types, and key endpoints for managing productions and services. ```APIDOC Base URLs: - Production: `https://auphonic.com/api/` - Simple API: `https://auphonic.com/api/simple/` Authentication Headers: ``` Authorization: Bearer {api_key} Authorization: Bearer {access_token} # OAuth ``` Content Types: - JSON requests: `Content-Type: application/json` - File uploads: `multipart/form-data` (automatic with curl -F) - Webhooks: `application/x-www-form-urlencoded` or `multipart/form-data` Key Endpoints: | Method | Endpoint | Purpose | |--------|----------|---------| | POST | `/productions.json` | Create production | | GET | `/productions.json` | List productions | | GET | `/production/{uuid}.json` | Get production details | | POST | `/production/{uuid}/upload.json` | Upload files | | POST | `/production/{uuid}/start.json` | Start processing | | DELETE | `/production/{uuid}.json` | Delete production | | GET | `/services.json` | List external services | | GET | `/presets.json` | List presets | | POST | `/simple/productions.json` | Simple API endpoint | ``` -------------------------------- ### Add Speech Recognition to Production Source: https://github.com/pgeth/auphonic-api/blob/main/README.md Adds speech recognition capabilities to an existing Auphonic production. Requires the production UUID and an API key for authorization. Specifies language and keywords for recognition. ```bash curl -X POST -H "Content-Type: application/json" \ https://auphonic.com/api/production/{uuid}.json \ -H "Authorization: bearer {api_key}" \ -d '{ "speech_recognition": { "language": "en", "keywords": ["keyword1", "keyword2"], "shownotes": true } }' ``` -------------------------------- ### Auphonic API Authentication Methods Source: https://github.com/pgeth/auphonic-api/blob/main/README.md Details the available authentication methods for the Auphonic API, including API Key Authentication, HTTP Basic Authentication, and OAuth 2.0. API Key Authentication is recommended for accessing personal resources. ```APIDOC Authentication: - API Key Authentication: Recommended method for accessing your own resources. - HTTP Basic Authentication - OAuth 2.0 Authentication ``` -------------------------------- ### Query External Services Source: https://github.com/pgeth/auphonic-api/blob/main/README.md Fetches information about available external services that can be integrated with Auphonic. Requires an API key for authentication. ```bash curl https://auphonic.com/api/services.json \ -H "Authorization: bearer {api_key}" ``` -------------------------------- ### Complex JavaScript Upload with Progress Source: https://github.com/pgeth/auphonic-api/blob/main/README.md Shows a more advanced JavaScript upload process using the Auphonic API, including JSON payloads, progress tracking, and creating productions. ```javascript function createCORSRequest(method, url) { var xhr = new XMLHttpRequest(); if ("withCredentials" in xhr) { xhr.open(method, url, true); } else if (typeof XDomainRequest != "undefined") { xhr = new XDomainRequest(); xhr.open(method, url); } else { xhr = null; } return xhr; } function get_token() { return 'XXXXXXX'; // your OAuth2 bearer token } // Create production using JSON API var xhr = createCORSRequest("POST", "https://auphonic.com/api/productions.json"); xhr.setRequestHeader("Content-Type", "application/json"); xhr.setRequestHeader("Authorization", "Bearer " + get_token()); xhr.onload = function(e) { console.log("Production: created"); var response = JSON.parse(e.target.response); var production_uuid = response.data.uuid; var file = document.querySelector('#files').files[0]; if (file) { console.log("File Upload: started"); var url = 'https://auphonic.com/api/production/{uuid}/upload.json'.replace('{uuid}', production_uuid); var xhr2 = createCORSRequest("POST", url); xhr2.setRequestHeader("Authorization", "Bearer " + get_token()); xhr2.upload.addEventListener("progress", function(e) { console.log((e.loaded / e.total) * 100); }, false); xhr2.onload = function(e) { console.log("File Upload: Done"); }; var formData = new FormData(); formData.append('input_file', file); xhr2.send(formData); } }; xhr.send(JSON.stringify({"metadata":{"title": "test upload 2"}})); ``` -------------------------------- ### Create Multitrack Production Source: https://github.com/pgeth/auphonic-api/blob/main/README.md Initiates a multitrack production, which processes multiple input audio tracks individually and as a combined mixdown. Requires setting `is_multitrack` to true and specifying input tracks with their types and IDs. ```bash curl -X POST -H "Content-Type: application/json" \ https://auphonic.com/api/productions.json \ -H "Authorization: bearer {api_key}" \ -d '{ "multi_input_files": [ {"type": "multitrack", "id": "speech track"}, {"type": "multitrack", "id": "music track"} ], "metadata": { "title": "My first Multitrack Production" }, "output_files": [{"format": "mp3"}], "is_multitrack": true }' ``` -------------------------------- ### External Service Creation Call Source: https://github.com/pgeth/auphonic-api/blob/main/README.md Creates an external service integration with Auphonic, providing a display name, webhook URL, and custom data. ```bash curl -X POST \ -H "Content-Type: application/json" \ -H "Authorization: Bearer {access_token_of_your_user}" \ https://auphonic.com/api/service/connect.json \ -d '{ "display_name": "My Family Podcast", "webhook_url": "https://your-service.fm/userXY/webhook/token/", "custom_data": "any-data-string-you-want" }' ``` -------------------------------- ### Batch Processing Multiple Files (Bash) Source: https://github.com/pgeth/auphonic-api/blob/main/README.md A bash script to process multiple audio files in a directory using the Auphonic Simple API, creating a new production for each file. ```bash #!/bin/bash for file in *.mp3; do curl -X POST https://auphonic.com/api/simple/productions.json \ -H "Authorization: bearer {api_key}" \ -F "preset=ceigtvDv8jH6NaK52Z5eXH" \ -F "title=$file" \ -F "input_file=@$file" \ -F "action=start" done ``` -------------------------------- ### Download Result Files Source: https://github.com/pgeth/auphonic-api/blob/main/README.md Downloads the processed audio result files for a production. The API response contains URLs for all result files, which can be accessed directly. The `-L` flag ensures redirection is followed. ```bash curl https://auphonic.com/api/download/audio-result/{uuid}/filename.mp3 \ -H "Authorization: bearer {api_key}" -L ``` -------------------------------- ### Auphonic Resource Referencing Source: https://github.com/pgeth/auphonic-api/blob/main/README.md Explains how resources such as presets, productions, and services are referenced within the Auphonic API. All resources are identified using a UUID, a unique 22-character string composed of alphanumeric characters. ```APIDOC Resource Referencing: - Resources are referenced using a UUID. - UUID format: A unique string of 22 characters out of [a-zA-Z0-9]. ``` -------------------------------- ### List All Productions Source: https://github.com/pgeth/auphonic-api/blob/main/README.md Retrieves a list of all Auphonic productions associated with the authenticated user. Supports filtering by limit, offset, UUIDs only, and minimal data. ```bash curl https://auphonic.com/api/productions.json \ -H "Authorization: bearer {api_key}" ``` -------------------------------- ### Add Webhook to Production Source: https://github.com/pgeth/auphonic-api/blob/main/README.md Configures a webhook to receive notifications when a production is finished processing. ```bash curl -X POST -H "Content-Type: application/json" \ https://auphonic.com/api/productions.json \ -H "Authorization: bearer {api_key}" \ -d '{ "preset": "iWfe3DUoKLFxF7pJzoq5qa", "input_file": "http://auphonic.com/media/audio-examples/file.m4a", "webhook": "https://your-server.com/callback" }' ``` -------------------------------- ### Upload Files with HTTP Source: https://github.com/pgeth/auphonic-api/blob/main/README.md Uploads a file to Auphonic for processing by specifying its URL. This is an alternative to uploading the file directly. It requires a preset and the input file URL. ```bash curl -X POST -H "Content-Type: application/json" \ https://auphonic.com/api/productions.json \ -H "Authorization: bearer {api_key}" \ -d '{ "preset": "ceigtvDv8jH6NaK52Z5eXH", "input_file": "https://your_server.com/somefile.mp3", "metadata": { "title": "My first HTTP Production" }, "action": "start" }' ``` -------------------------------- ### Simple JavaScript File Upload (CORS) Source: https://github.com/pgeth/auphonic-api/blob/main/README.md Demonstrates how to upload a file to Auphonic using the Simple API with JavaScript and XMLHttpRequest, handling CORS requests. ```javascript function createCORSRequest(method, url) { var xhr = new XMLHttpRequest(); if ("withCredentials" in xhr) { xhr.open(method, url, true); } else if (typeof XDomainRequest != "undefined") { xhr = new XDomainRequest(); xhr.open(method, url); } else { xhr = null; } return xhr; } function createProduction() { var xhr = new createCORSRequest("POST", "https://auphonic.com/api/simple/productions.json"); xhr.setRequestHeader("Authorization", "Bearer XXXXXXX"); var formData = new FormData(); formData.append("title", "javascript upload test"); formData.append("artist", "me"); formData.append("loudnesstarget", -23); formData.append("action", "start"); formData.append("input_file", document.querySelector('#files').files[0]); xhr.send(formData); } document.getElementById('files').addEventListener('change', createProduction, false); ``` ```html ``` -------------------------------- ### Webhook Request Details Source: https://github.com/pgeth/auphonic-api/blob/main/README.md Details of the parameters sent to a webhook URI after a production is completed, including status and production UUID. ```bash curl -X POST https://your-web-hook.com/endpoint \ -d "status=3&status_string=Done&uuid=zeigtvDv8jH6NaK52Z5eXH" ``` -------------------------------- ### Export Individual Tracks Source: https://github.com/pgeth/auphonic-api/blob/main/README.md Requests the export of individual, processed audio tracks from a multitrack production in specified formats. ```bash curl -X POST -H "Content-Type: application/json" \ https://auphonic.com/api/productions.json \ -H "Authorization: bearer {api_key}" \ -d '{ "output_files": [ {"format": "tracks", "ending": "wav.zip"}, {"format": "tracks", "ending": "flac.zip"} ], "is_multitrack": true }' ``` -------------------------------- ### Upload Audio Files for Multitrack Production Source: https://github.com/pgeth/auphonic-api/blob/main/README.md Uploads audio files for individual tracks of a multitrack production. Each track is identified by its ID, which must match the ID specified during production creation. Uses multipart/form-data for file uploads. ```bash curl -X POST https://auphonic.com/api/production/{uuid}/upload.json \ -H "Authorization: bearer {api_key}" \ -F "speech track=@/home/user/file-for-track1.wav" \ -F "music track=@/home/user/file-for-track2.wav" ``` -------------------------------- ### Query Production Status Source: https://github.com/pgeth/auphonic-api/blob/main/README.md Retrieves the current status of a specific Auphonic production using its unique identifier (UUID). Requires an API key for authentication. ```bash curl https://auphonic.com/api/production/{uuid}/status.json \ -H "Authorization: bearer {api_key}" ``` -------------------------------- ### Add Output Files to an Existing Production Source: https://github.com/pgeth/auphonic-api/blob/main/README.md Adds specified output files to an existing production identified by its UUID. Supports various formats like MP3, Ogg Vorbis, AAC, FLAC, WAV, and video formats. ```bash curl -H "Content-Type: application/json" -X POST \ https://auphonic.com/api/production/{uuid}.json \ -H "Authorization: bearer {api_key}" \ -d '{ "output_files": [ {"format":"mp3", "bitrate":"96"}, {"format":"aac", "bitrate":"64"}, {"format":"flac"} ] }' ``` -------------------------------- ### Error Handling and Status Monitoring (Bash) Source: https://github.com/pgeth/auphonic-api/blob/main/README.md A bash script to monitor the status of an Auphonic production by periodically polling the API until the production is 'Done' or 'Error'. ```bash #!/bin/bash UUID="your_production_uuid" while true; do STATUS=$(curl -s "https://auphonic.com/api/production/$UUID/status.json" \ -H "Authorization: bearer {api_key}" | \ jq -r '.data.status_string') echo "Status: $STATUS" if [ "$STATUS" = "Done" ] || [ "$STATUS" = "Error" ]; then break fi sleep 30 done echo "Production finished with status: $STATUS" ``` -------------------------------- ### Upload Files from External Services Source: https://github.com/pgeth/auphonic-api/blob/main/README.md Uploads audio files to Auphonic for processing by referencing an external service like Dropbox, SFTP, or Amazon S3. Requires the preset UUID, service UUID, and the input file name. ```bash curl -X POST https://auphonic.com/api/simple/productions.json \ -H "Authorization: bearer {api_key}" \ -F "preset=ceigtvDv8jH6NaK52Z5eXH" \ -F "service=pmefeNCzkyT4TbRbDmoCDf" \ -F "input_file=my_dropbox_file.mp3" \ -F "title=My First Dropbox Production" \ -F "action=start" ``` -------------------------------- ### Configure Audio Algorithms Source: https://github.com/pgeth/auphonic-api/blob/main/README.md Adjusts audio processing algorithms for a production, including loudness leveling, normalization, filtering, and noise reduction. The loudness target can be set to a specific LUFS value. ```bash curl -H "Content-Type: application/json" -X POST \ https://auphonic.com/api/production/{uuid}.json \ -H "Authorization: bearer {api_key}" \ -d '{ "algorithms": { "leveler": true, "normloudness": true, "loudnesstarget": -23, "filtering": true, "denoise": false, "denoiseamount": 0 } }' ``` -------------------------------- ### Reset Production Data Source: https://github.com/pgeth/auphonic-api/blob/main/README.md Resets a production to its initial state, preserving the input file but discarding processing results and metadata changes. Allows for optional updates to metadata and output files during the reset. ```bash curl -X POST -H "Content-Type: application/json" \ https://auphonic.com/api/production/{uuid}.json \ -H "Authorization: bearer {api_key}" \ -d '{ "reset_data": true, "metadata": {"title": "New Title"}, "output_files": [{"format":"mp3"}] }' ``` -------------------------------- ### Stop a Production Source: https://github.com/pgeth/auphonic-api/blob/main/README.md Halts the processing of an ongoing Auphonic production. Requires the production UUID and an API key. This is useful for stopping a production that is taking too long or has encountered an issue. ```bash curl -X POST https://auphonic.com/api/production/{uuid}/stop.json \ -H "Authorization: bearer {api_key}" ``` -------------------------------- ### Webhook after Production (JWT Encoded) Source: https://github.com/pgeth/auphonic-api/blob/main/README.md Receives JWT-encoded webhook data from Auphonic after production, which needs to be decoded using the OAuth client secret. ```bash curl -X POST -H "Content-Type: application/jwt" \ https://your-service.fm/userXY/webhook/token/ \ -d 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9...' ``` -------------------------------- ### Delete a Production Source: https://github.com/pgeth/auphonic-api/blob/main/README.md Removes a specific Auphonic production and all its associated data. Requires the production UUID and an API key for authorization. This action is irreversible. ```bash curl -X DELETE https://auphonic.com/api/production/{uuid}.json \ -H "Authorization: bearer {api_key}" ``` -------------------------------- ### Update Production Metadata Source: https://github.com/pgeth/auphonic-api/blob/main/README.md Modifies the metadata of an existing Auphonic production, such as title or track number. Requires the production UUID and an API key. The request body should contain a JSON object with the metadata to update. ```bash curl -X POST -H "Content-Type: application/json" \ https://auphonic.com/api/production/{uuid}.json \ -H "Authorization: bearer {api_key}" \ -d '{"metadata": {"title": "New Title", "track": 2}}' ``` -------------------------------- ### Decode JWT Webhook Data Source: https://github.com/pgeth/auphonic-api/blob/main/README.md Python code snippet to decode the JWT-encoded webhook data received from Auphonic using the OAuth client secret. ```python import jwt data = jwt.decode( jwt_token, your_oauth_client_secret, algorithms=["HS256"] ) # Returns: {"uuid": "production_uuid", "custom_data": "your_data"} ```