Finetuning.aiFinetuning.ai

GET /v1/generations/:id

Get details for a specific generation

Retrieve the full details of a specific music generation, including its current status and download URL.

Request

GET https://pub.finetuning.ai/v1/generations/:id

Headers

HeaderTypeRequiredDescription
X-API-KeystringYesYour API key

Path parameters

ParameterTypeDescription
idstringThe generation ID (e.g., gen_abc123)

Example

curl https://pub.finetuning.ai/v1/generations/gen_abc123 \
  -H "X-API-Key: ft_live_your_key_here"

Response

200 OK
{
  "data": {
    "id": "gen_abc123",
    "title": "modern country instrumental",
    "prompt": "modern country instrumental, acoustic guitar strumming, pedal steel guitar, fiddle melody",
    "status": "completed",
    "audioUrl": "https://media.finetuning.ai/audio/gen_abc123.mp3",
    "duration": 120,
    "fileSize": null,
    "isPublic": false,
    "playCount": 0,
    "downloadCount": 0,
    "likeCount": 0,
    "parameters": {
      "bpm": 110,
      "duration": 120,
      "keyscale": "G major",
      "timesignature": 4,
      "seed": 1951074202
    },
    "errorMessage": null,
    "generationTime": 17,
    "createdAt": "2025-01-15 10:30:00",
    "completedAt": "2025-01-15T10:30:17.623Z"
  }
}

Response fields

FieldTypeDescription
data.idstringUnique generation ID
data.titlestringGeneration title
data.promptstringThe tags/prompt used
data.statusstringpending, processing, completed, failed
data.audioUrlstring | nullAudio download URL (available when completed)
data.durationnumberTrack duration in seconds
data.fileSizenumber | nullAudio file size in bytes
data.isPublicbooleanWhether the generation is publicly visible
data.playCountnumberNumber of plays
data.downloadCountnumberNumber of downloads
data.likeCountnumberNumber of likes
data.parametersobjectGeneration parameters (bpm, duration, keyscale, timesignature, seed)
data.errorMessagestring | nullError details if generation failed
data.generationTimenumber | nullTime taken to generate in seconds
data.createdAtstringCreation timestamp
data.completedAtstring | nullCompletion timestamp (ISO 8601)

Generation statuses

StatusDescription
pendingGeneration is queued
processingGeneration is in progress
completedGeneration finished — audioUrl is available
failedGeneration failed — check errorMessage field for details

Polling for completion

Since generation is asynchronous, poll this endpoint to check when your track is ready:

async function waitForGeneration(id, apiKey) {
  while (true) {
    const res = await fetch(`https://pub.finetuning.ai/v1/generations/${id}`, {
      headers: { 'X-API-Key': apiKey },
    });
    const { data } = await res.json();

    if (data.status === 'completed') return data;
    if (data.status === 'failed') throw new Error(data.errorMessage);

    // Wait 2 seconds before polling again
    await new Promise(r => setTimeout(r, 2000));
  }
}

Errors

CodeStatusDescription
MISSING_API_KEY401X-API-Key header was not provided
INVALID_API_KEY401API key is malformed, revoked, or does not exist
NOT_FOUND404Resource not found
INTERNAL_ERROR500Unexpected server error

On this page