Skip to main content

Mixtapes API

Upload DJ mix sets for scheduled broadcast on baseFM. Mix uploads use Mux direct uploads — the client receives a pre-signed URL and uploads the audio file directly to Mux. Requires a Collective plan or higher with an active subscription.

Upload a mix

POST /api/basefm/mixtapes
Creates a Mux direct upload URL for a new DJ mix set. Requires session authentication and a qualifying subscription plan.

Request body

FieldTypeRequiredDescription
titlestringYesMix title
artistNamestringNoArtist or DJ name. Defaults to Unknown Artist in Mux metadata.
scheduledAtstringNoISO 8601 timestamp for when the mix should be broadcast. When omitted, the mix is uploaded but not automatically scheduled.

Response

{
  "success": true,
  "mixtape": {
    "id": "clxyz456def",
    "title": "Late Night Techno Vol. 3",
    "artistName": "DJ Rave",
    "status": "pending",
    "scheduledAt": "2026-04-15T22:00:00.000Z"
  },
  "upload": {
    "id": "upload_abc123",
    "url": "https://storage.googleapis.com/video-storage-us-east1-uploads/...",
    "timeout": 3600
  }
}
FieldTypeDescription
mixtape.idstringMixtape record identifier
mixtape.titlestringMix title
mixtape.artistNamestring | nullArtist name
mixtape.statusstringInitial status — always pending after creation
mixtape.scheduledAtstring | nullISO 8601 broadcast time, or null if not scheduled
upload.idstringMux upload identifier
upload.urlstringPre-signed URL for direct file upload. The client PUTs the audio file to this URL.
upload.timeoutnumberUpload window in seconds (3600 = 1 hour)

Mixtape statuses

StatusDescription
pendingUpload created, waiting for file upload to complete
readyMux asset is ready (set via webhook)
scheduledMix is scheduled for broadcast
broadcastingCurrently being broadcast on baseFM
completeBroadcast finished

Required plans

Mix uploads require one of the following plans with an active or trialing subscription status:
  • collective
  • label
  • network

Errors

CodeDescription
400Mix title is required
401Unauthorized — no valid session
403Mix uploads require a Collective plan or higher — the user’s plan does not qualify. The response includes requiredPlans.
404User not found
500Mux not configured — Mux credentials are missing
502Failed to create upload — try again — Mux API error

Example

curl -X POST https://agentbot.sh/api/basefm/mixtapes \
  -H "Content-Type: application/json" \
  -H "Cookie: next-auth.session-token=YOUR_SESSION" \
  -d '{
    "title": "Late Night Techno Vol. 3",
    "artistName": "DJ Rave",
    "scheduledAt": "2026-04-15T22:00:00.000Z"
  }'

List mixtapes

GET /api/basefm/mixtapes
Returns the authenticated user’s mixtapes, ordered by creation date (newest first). Returns up to 50 records.

Response

{
  "mixtapes": [
    {
      "id": "clxyz456def",
      "title": "Late Night Techno Vol. 3",
      "artist_name": "DJ Rave",
      "status": "scheduled",
      "playback_id": "xYz789",
      "scheduled_at": "2026-04-15T22:00:00.000Z",
      "broadcast_at": null,
      "ended_at": null,
      "duration_secs": 3600,
      "created_at": "2026-04-12T10:00:00.000Z"
    }
  ]
}
FieldTypeDescription
idstringMixtape identifier
titlestringMix title
artist_namestring | nullArtist name
statusstringCurrent status (see statuses)
playback_idstring | nullMux playback ID, available after the asset is ready
scheduled_atstring | nullScheduled broadcast time
broadcast_atstring | nullActual broadcast start time
ended_atstring | nullBroadcast end time
duration_secsnumber | nullMix duration in seconds
created_atstringRecord creation timestamp

Errors

CodeDescription
401Unauthorized — no valid session

Example

curl -X GET https://agentbot.sh/api/basefm/mixtapes \
  -H "Cookie: next-auth.session-token=YOUR_SESSION"

Update a mixtape (internal)

PATCH /api/basefm/mixtapes
Updates a mixtape record, typically called by the Mux webhook handler when an upload completes and the asset becomes ready. Matches records by Mux upload ID.
This endpoint is intended for internal platform use. It is called automatically by the Mux webhook handler when upload assets are processed.

Request body

FieldTypeRequiredDescription
uploadIdstringYesMux upload ID used to match the mixtape record
assetIdstringNoMux asset ID
playbackIdstringNoMux playback ID
statusstringNoNew status value

Response

{
  "success": true
}

Errors

CodeDescription
400uploadId required