File upload

All workflows require at least one file to be processed. Our API endpoints expect you to provide an URL for the file. If you are unable to generate a URL for your files, you can use our temporary upload server to help getting you started. The upload flow looks like:

  • Request: You request an uploadUrl and an downloadUrl from our server.
  • Upload: You then proceed to upload your local file to the provided uploadUrl.
  • Use: Once your upload is completed, you can use the downloadUrl on any endpoint that requires a file

Requesting signed URLs

Let's go ahead and request our uploadUrl and a downloadUrl:

curl --request GET \
	--url https://api.music.ai/api/upload \
	--header 'Authorization: your-api-key-here'

Uploading a file

We can now start uploading our local file to the uploadUrl we received from the previous step:

curl --request PUT \
	--url https://storage.googleapis.com/upload/something \
	--header 'Content-Type: audio/mpeg' \
	--data-binary '@./track.mp3'

Using the file

Since the upload is now completed, we can now use the downloadUrl we received from the first step on any endpoint that requires a file:

curl --request POST \
	--url https://api.music.ai/api/job \
	--header 'Authorization: your-api-key-here' \
	--header 'Content-Type: application/json' \
	--data '{
		"name": "My job 123",
		"workflow": "my-workflow-id",
		"params": {
			"inputUrl": "https://storage.googleapis.com/download/something"
		}
	}'