# Artist data

Source: https://docs.musicnerd.net/api-reference/admin/artist-data

Artist data

## GET /api/admin/artist-data

Full OpenAPI specification: https://docs.musicnerd.net/spec/admin.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: admin",
    "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/admin/artist-data": {
      "get": {
        "summary": "Artist data",
        "operationId": "getArtistData",
        "security": [
          {
            "adminBearer": []
          }
        ],
        "description": "Artist data coverage: how many artists exist and have a Spotify ID, platform-ID coverage with today's count, link coverage per platform, the distribution of how many tracked fields each artist has, and enrichment readiness.",
        "responses": {
          "200": {
            "description": "The catalog summary; a repeat call within 30 seconds may return the same numbers.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ArtistDataSummary"
                },
                "example": {
                  "status": "ok",
                  "totalArtists": 41971,
                  "totalWithSpotify": 38403,
                  "platformIdCoverage": [
                    {
                      "platform": "deezer",
                      "count": 1210,
                      "percentage": 3.15,
                      "todayCount": 11
                    }
                  ],
                  "artistLinkCoverage": [
                    {
                      "column": "instagram",
                      "category": "social",
                      "count": 29010,
                      "percentage": 69.12
                    },
                    {
                      "column": "bio",
                      "category": "content",
                      "count": 4120,
                      "percentage": 9.82
                    }
                  ],
                  "completenessDistribution": [
                    {
                      "bucket": "0-1",
                      "count": 3783,
                      "percentage": 9.01
                    },
                    {
                      "bucket": "2-3",
                      "count": 12050,
                      "percentage": 28.71
                    }
                  ],
                  "medianFields": 5,
                  "averageFields": 5.2,
                  "enrichmentReadiness": {
                    "hasWikidata": 41,
                    "hasSpotifyNoWikidata": 38362,
                    "noSpotify": 3568
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/NotSignedIn"
          },
          "403": {
            "$ref": "#/components/responses/NotAdmin"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "ArtistDataSummary": {
        "type": "object",
        "required": [
          "status",
          "totalArtists",
          "totalWithSpotify",
          "platformIdCoverage",
          "artistLinkCoverage",
          "completenessDistribution",
          "medianFields",
          "averageFields",
          "enrichmentReadiness"
        ],
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "ok"
            ]
          },
          "totalArtists": {
            "type": "integer"
          },
          "totalWithSpotify": {
            "type": "integer",
            "description": "Artists with a non-empty `spotify`."
          },
          "platformIdCoverage": {
            "type": "array",
            "description": "From `artist_id_mappings`, most mapped first. Only platforms with at least one mapping appear.",
            "items": {
              "type": "object",
              "required": [
                "platform",
                "count",
                "percentage",
                "todayCount"
              ],
              "properties": {
                "platform": {
                  "type": "string"
                },
                "count": {
                  "type": "integer"
                },
                "percentage": {
                  "type": "number",
                  "description": "Of `totalWithSpotify`, to two decimals."
                },
                "todayCount": {
                  "type": "integer"
                }
              }
            }
          },
          "artistLinkCoverage": {
            "type": "array",
            "description": "One row per tracked column, in a fixed order: instagram, bluesky, x, facebook, tiktok, youtube, youtubechannel, soundcloud, bandcamp, subvert, discogs, lastfm, musicbrainz, wikidata, imdb, wikipedia, bio, linkedin, farcaster, twitch, patreon. Spotify is left out because it is the denominator elsewhere.",
            "items": {
              "type": "object",
              "required": [
                "column",
                "category",
                "count",
                "percentage"
              ],
              "properties": {
                "column": {
                  "type": "string"
                },
                "category": {
                  "type": "string",
                  "enum": [
                    "social",
                    "listen",
                    "reference",
                    "content"
                  ]
                },
                "count": {
                  "type": "integer"
                },
                "percentage": {
                  "type": "number",
                  "description": "Of `totalArtists`, to two decimals."
                }
              }
            }
          },
          "completenessDistribution": {
            "type": "array",
            "description": "How many of the tracked columns each artist has filled, bucketed `0-1`, `2-3`, `4-6`, `7-10`, `11+`; empty buckets are absent.",
            "items": {
              "type": "object",
              "required": [
                "bucket",
                "count",
                "percentage"
              ],
              "properties": {
                "bucket": {
                  "type": "string"
                },
                "count": {
                  "type": "integer"
                },
                "percentage": {
                  "type": "number"
                }
              }
            }
          },
          "medianFields": {
            "type": "number"
          },
          "averageFields": {
            "type": "number"
          },
          "enrichmentReadiness": {
            "type": "object",
            "required": [
              "hasWikidata",
              "hasSpotifyNoWikidata",
              "noSpotify"
            ],
            "properties": {
              "hasWikidata": {
                "type": "integer"
              },
              "hasSpotifyNoWikidata": {
                "type": "integer"
              },
              "noSpotify": {
                "type": "integer"
              }
            }
          }
        }
      },
      "Error": {
        "type": "object",
        "required": [
          "status",
          "error"
        ],
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "error"
            ]
          },
          "error": {
            "type": "string"
          }
        }
      }
    },
    "responses": {
      "NotSignedIn": {
        "description": "No token, an invalid or expired token, or no Music Nerd user for it.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "status": "error",
              "error": "Not signed in"
            }
          }
        }
      },
      "NotAdmin": {
        "description": "The user is not an admin.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "status": "error",
              "error": "Forbidden"
            }
          }
        }
      },
      "InternalError": {
        "description": "The database could not be read or written.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "status": "error",
              "error": "Internal server error"
            }
          }
        }
      }
    },
    "securitySchemes": {
      "adminBearer": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "Access token",
        "description": "A Music Nerd admin's access token. Copy it at https://musicnerd.net/access after signing in. A signed-in user who is not an admin gets 403."
      }
    }
  }
}
```
