# Advance research

Source: https://musicnerd-docs.vercel.app/api-reference/research/advance

Advance research

## POST /api/research/advance

Full OpenAPI specification: https://musicnerd-docs.vercel.app/spec/research.json

## Authentication

This operation's specification permits a request without authentication.

[Authentication guide](https://musicnerd-docs.vercel.app/authentication)

## Operation and referenced schemas

```json
{
  "openapi": "3.1.0",
  "info": {
    "title": "Music Nerd API: research",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://musicnerd-api.vercel.app",
      "description": "Production"
    },
    {
      "url": "https://musicnerd-api-staging.vercel.app",
      "description": "Staging (staging database)"
    }
  ],
  "paths": {
    "/api/research/advance": {
      "post": {
        "summary": "Advance research",
        "operationId": "advanceResearch",
        "security": [],
        "description": "Runs one slice of queued research and returns. Research jobs (`artist_research_jobs`) run in slices that each fit one request; the web app's research pump calls this while an artist's page is open, and the scheduler resumes anything left. Safe to call concurrently: jobs are claimed atomically under a lease.\n\nPass `artistId` to run only that artist's jobs, and `kinds` to run only some kinds.",
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "artistId": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Run only this artist's jobs."
                  },
                  "kinds": {
                    "type": "array",
                    "minItems": 1,
                    "items": {
                      "type": "string",
                      "enum": [
                        "social_ingest",
                        "caption_extract",
                        "lore_refresh",
                        "source_search",
                        "latest_refresh"
                      ]
                    },
                    "description": "Run only jobs of these kinds."
                  }
                }
              },
              "example": {
                "artistId": "aab92f80-f9e1-4299-aa33-7dd85c8de5d3",
                "kinds": [
                  "latest_refresh"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "A slice ran, or nothing was waiting (`ran: false`). A failure inside the slice is reported as `{ status: \"error\", error: \"advance failed\", ran: false }` with status 200.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "status",
                    "ran"
                  ],
                  "properties": {
                    "status": {
                      "type": "string",
                      "enum": [
                        "ok"
                      ]
                    },
                    "ran": {
                      "type": "boolean",
                      "description": "Whether a slice ran. `false` means nothing was claimable."
                    },
                    "jobId": {
                      "type": "string",
                      "format": "uuid",
                      "description": "The job the slice belonged to."
                    },
                    "kind": {
                      "type": "string",
                      "enum": [
                        "social_ingest",
                        "caption_extract",
                        "lore_refresh",
                        "source_search",
                        "latest_refresh"
                      ],
                      "description": "The job's kind."
                    },
                    "artistId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "progress": {
                      "type": "string",
                      "description": "A short description of what the slice did."
                    },
                    "done": {
                      "type": "boolean",
                      "description": "Whether the job finished with this slice."
                    },
                    "waiting": {
                      "type": "boolean",
                      "description": "The job is waiting on an outside run (an Apify scrape); call again later."
                    }
                  }
                },
                "example": {
                  "status": "ok",
                  "ran": true,
                  "jobId": "6baabdd8-e8f3-4c09-8edb-71a71f7342ae",
                  "kind": "social_ingest",
                  "artistId": "aab92f80-f9e1-4299-aa33-7dd85c8de5d3",
                  "progress": "collected 12 posts",
                  "done": true
                }
              }
            }
          },
          "400": {
            "description": "`artistId` is not a UUID, or `kinds` names a kind this API does not run.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "status": "error",
                  "error": "artistId must be a UUID"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Error": {
        "type": "object",
        "required": [
          "status",
          "error"
        ],
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "error"
            ]
          },
          "error": {
            "type": "string"
          }
        }
      }
    }
  }
}
```
