# Start the claim build

Source: https://docs.musicnerd.net/api-reference/onboarding/build

Start the claim build

## POST /api/onboarding/{artistId}/build

Full OpenAPI specification: https://docs.musicnerd.net/spec/onboarding.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://docs.musicnerd.net/authentication)

## Operation and referenced schemas

```json
{
  "openapi": "3.1.0",
  "info": {
    "title": "Music Nerd API: onboarding",
    "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/onboarding/{artistId}/build": {
      "post": {
        "summary": "Start the claim build",
        "operationId": "startClaimBuild",
        "security": [
          {
            "privyBearer": []
          },
          {
            "researchService": []
          }
        ],
        "description": "Starts building a claimed artist's profiles, sources, Lore and About on the server and returns right away; only one build runs per artist, whether or not anyone keeps the page open. Search-provider failures leave the affected stage unconfirmed and retain partial saved links and sources, so calling again can resume without deleting content; successful searches with no matches can complete. Older runs already marked complete still return `started: false` and need separate recovery. Follow progress with [Onboarding state](/api-reference/onboarding/state).",
        "parameters": [
          {
            "name": "artistId",
            "in": "path",
            "required": true,
            "description": "The artist's ID (a UUID).",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "aab92f80-f9e1-4299-aa33-7dd85c8de5d3"
          }
        ],
        "responses": {
          "200": {
            "description": "Whether a build started. `started: false` means the page is already built.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ClaimBuildStarted"
                },
                "examples": {
                  "started": {
                    "summary": "Started (or restarted at the first unconfirmed step)",
                    "value": {
                      "status": "ok",
                      "started": true,
                      "runId": "wrun_01K7XQ3Y4ZB6G0N2F8W5C9D1EJ"
                    }
                  },
                  "alreadyBuilt": {
                    "summary": "Already built; nothing started",
                    "value": {
                      "status": "ok",
                      "started": false,
                      "runId": null
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`artistId` isn't a UUID.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "status": "error",
                  "error": "artistId must be a UUID"
                }
              }
            }
          },
          "401": {
            "description": "No credential, or an invalid token or research key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "status": "error",
                  "error": "Not signed in"
                }
              }
            }
          },
          "403": {
            "description": "The user is neither the artist's claimant nor an admin.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "status": "error",
                  "error": "Not your artist"
                }
              }
            }
          },
          "409": {
            "description": "The artist has no approved claim, so there is nobody to build the page for.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "status": "error",
                  "error": "No approved claim"
                }
              }
            }
          },
          "503": {
            "description": "The build couldn't be started. Retry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "status": "error",
                  "error": "Research is temporarily unavailable"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "ClaimBuildStarted": {
        "type": "object",
        "required": [
          "status",
          "started",
          "runId"
        ],
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "ok"
            ]
          },
          "started": {
            "type": "boolean",
            "description": "True when a build run was started. False when the page was already built."
          },
          "runId": {
            "type": [
              "string",
              "null"
            ],
            "description": "The workflow run's ID, for support and logs. `null` when nothing started."
          }
        }
      },
      "Error": {
        "type": "object",
        "required": [
          "status",
          "error"
        ],
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "error"
            ]
          },
          "error": {
            "type": "string"
          }
        }
      }
    },
    "securitySchemes": {
      "privyBearer": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "Access token",
        "description": "The signed-in user's access token. Copy it at https://musicnerd.net/access after signing in. The user must be the artist's approved claimant or a Music Nerd admin."
      },
      "researchService": {
        "type": "apiKey",
        "in": "header",
        "name": "X-MusicNerd-Research-Key",
        "description": "Server-only MUSICNERD_RESEARCH_API_KEY. Music Nerd's site sends it when an admin approves a claim. Never sent from a browser."
      }
    }
  }
}
```
