# Get Runs

Source: https://recoupable.dev/docs/api-reference/songs/runs

Get runs

## GET /api/runs

Full OpenAPI specification: https://recoupable.dev/docs/spec/releases.json

## Authentication

This operation requires one of the security alternatives in the specification below. Security scheme definitions are included where present in the published specification.

[Authentication guide](https://recoupable.dev/docs/authentication)

## Operation and referenced schemas

```json
{
  "openapi": "3.1.0",
  "info": {
    "title": "Recoup API - Releases",
    "description": "API documentation for the Recoup platform - an AI agent platform for the music industry",
    "license": {
      "name": "MIT"
    },
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://api.recoupable.dev"
    }
  ],
  "paths": {
    "/api/runs": {
      "get": {
        "summary": "Get runs",
        "description": "Get background runs, newest first. A run is the generic status resource for long-running work. `kind` selects the run type (`valuation` and `music` today); future kinds are new enum values here, never new endpoints.",
        "security": [
          {
            "apiKeyAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "kind",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "valuation",
                "music"
              ]
            },
            "description": "Required. The run type to list. Unknown kinds are rejected with 400."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 20,
              "default": 1
            },
            "description": "Optional. Maximum runs to return, newest first. Defaults to 1 (the latest run)."
          }
        ],
        "responses": {
          "200": {
            "description": "The calling account's runs of the requested kind, newest first. Empty when the account has never run one.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetRunsResponse"
                }
              }
            }
          },
          "400": {
            "description": "Missing or unknown kind, or invalid limit.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CatalogSongsErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid credentials.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CatalogSongsErrorResponse"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "GetRunsResponse": {
        "type": "object",
        "description": "The calling account's runs of the requested kind, newest first.",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "success",
              "error"
            ],
            "description": "Status of the request"
          },
          "runs": {
            "type": "array",
            "description": "Runs, newest first. Empty when the account has never run one of this kind. The item shape follows the requested `kind`.",
            "items": {
              "oneOf": [
                {
                  "title": "Valuation run",
                  "$ref": "#/components/schemas/ValuationRun"
                },
                {
                  "title": "Music run",
                  "$ref": "#/components/schemas/MusicRun"
                }
              ]
            }
          },
          "error": {
            "type": "string",
            "description": "Error message (only present if status is 'error')"
          }
        }
      },
      "CatalogSongsErrorResponse": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "error"
            ],
            "description": "Status of the request"
          },
          "error": {
            "type": "string",
            "description": "Error message describing what went wrong"
          }
        }
      },
      "ValuationRun": {
        "type": "object",
        "description": "One background run. `id` is opaque; `state` is a domain phase, not a storage value: `queued` (capture accepted, not yet scraping), `measuring` (capture in flight, or finished moments ago and being claimed), `claimed` (catalog materialized - `result.catalog_id` is set), `failed` (the capture finished but no catalog was claimed, or the capture itself failed).",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Opaque run id. Do not infer anything from its format; it is stable for polling a single run across requests."
          },
          "kind": {
            "type": "string",
            "enum": [
              "valuation"
            ],
            "description": "The run type."
          },
          "state": {
            "type": "string",
            "enum": [
              "queued",
              "measuring",
              "claimed",
              "failed"
            ],
            "description": "Domain phase of the run."
          },
          "album_count": {
            "type": "integer",
            "description": "Number of releases in the run's capture scope."
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the run was created."
          },
          "result": {
            "type": "object",
            "nullable": true,
            "description": "Set once the run is claimed; null before that.",
            "properties": {
              "catalog_id": {
                "type": "string",
                "format": "uuid",
                "description": "The materialized catalog. Read its value band via [Get Catalog Measurements](/api-reference/songs/catalog-measurements)."
              }
            }
          }
        }
      },
      "MusicRun": {
        "type": "object",
        "description": "One music generation, surfaced as a run. `id` is the generation's id: read the full record, including its logs, with [Get Music Generation](/api-reference/music/get).",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "The generation's id."
          },
          "kind": {
            "type": "string",
            "enum": [
              "music"
            ],
            "description": "The run type."
          },
          "state": {
            "type": "string",
            "enum": [
              "queued",
              "generating",
              "complete",
              "failed"
            ],
            "description": "Domain phase of the run: `queued` before the workflow picks it up, `generating` while the model renders, then `complete` or `failed`."
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the generation was created."
          },
          "result": {
            "type": "object",
            "nullable": true,
            "description": "Set once the generation completes; null before that.",
            "properties": {
              "generation_id": {
                "type": "string",
                "format": "uuid",
                "description": "The completed generation."
              },
              "audio_url": {
                "type": "string",
                "description": "Playable audio URL."
              }
            }
          }
        }
      }
    },
    "securitySchemes": {
      "apiKeyAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "x-api-key",
        "description": "Your Recoup API key. [Learn more](/quickstart#api-keys)."
      },
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer"
      }
    }
  }
}
```
