# Read the contributor leaderboard

Source: https://docs.musicnerd.net/api-reference/lookups/leaderboard

Read the contributor leaderboard

## GET /api/leaderboard

Full OpenAPI specification: https://docs.musicnerd.net/spec/artist-lookups.json

## Authentication

This operation's specification permits a request without authentication.

[Authentication guide](https://docs.musicnerd.net/authentication)

## Operation and referenced schemas

```json
{
  "openapi": "3.1.0",
  "info": {
    "title": "Music Nerd API: artist lookups",
    "version": "1.0.0",
    "description": "Public lookups: an artist by Spotify ID or Instagram handle, an artist's X handle, artist search, track links, the contributor leaderboard and an artist's image. No credentials. Each endpoint answers in its own shape, with plain-text errors, not this API's `{ status }` envelope."
  },
  "servers": [
    {
      "url": "https://musicnerd-api.vercel.app",
      "description": "Production"
    },
    {
      "url": "https://musicnerd-api-staging.vercel.app",
      "description": "Staging (staging database)"
    }
  ],
  "paths": {
    "/api/leaderboard": {
      "get": {
        "summary": "Read the contributor leaderboard",
        "description": "Returns contributors ranked by artists added plus research submissions, all-time or between `from` and `to`. `email` and `wallet` are always `null`. Send `page` or `perPage` for a paginated list.",
        "operationId": "leaderboard",
        "security": [],
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Start of the period (inclusive). Counts only when `to` is also sent."
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "End of the period (inclusive)."
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "default": 1
            },
            "description": "Page number. Sending it paginates the response."
          },
          {
            "name": "perPage",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "default": 10
            },
            "description": "Entries per page. Sending it paginates the response."
          }
        ],
        "responses": {
          "200": {
            "description": "The ranked entries: an array, or `{ entries, total, pageCount }` when paginated. Counts are strings in the all-time list and integers in a period.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/LeaderboardEntry"
                      }
                    },
                    {
                      "type": "object",
                      "required": [
                        "entries",
                        "total",
                        "pageCount"
                      ],
                      "properties": {
                        "entries": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/LeaderboardEntry"
                          }
                        },
                        "total": {
                          "type": "integer"
                        },
                        "pageCount": {
                          "type": "integer"
                        }
                      }
                    }
                  ]
                },
                "examples": {
                  "allTime": {
                    "value": [
                      {
                        "userId": "a7b7c7d7-0000-4000-8000-000000000000",
                        "wallet": null,
                        "username": "Aux Bandit",
                        "email": null,
                        "isHidden": false,
                        "artistsCount": "12",
                        "ugcCount": "40"
                      }
                    ]
                  },
                  "paginatedPeriod": {
                    "value": {
                      "entries": [
                        {
                          "userId": "a7b7c7d7-0000-4000-8000-000000000000",
                          "wallet": null,
                          "username": "Aux Bandit",
                          "email": null,
                          "isHidden": false,
                          "artistsCount": 2,
                          "ugcCount": 5
                        }
                      ],
                      "total": 1,
                      "pageCount": 1
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "The database could not be read.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error",
                    "details"
                  ],
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "details": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "Failed to fetch leaderboard",
                  "details": "Error getting leaderboard"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "LeaderboardEntry": {
        "type": "object",
        "required": [
          "userId",
          "wallet",
          "username",
          "email",
          "isHidden",
          "artistsCount",
          "ugcCount"
        ],
        "properties": {
          "userId": {
            "type": "string",
            "format": "uuid"
          },
          "wallet": {
            "type": "null"
          },
          "username": {
            "type": "string",
            "description": "The chosen name, or `Anonymous`."
          },
          "email": {
            "type": "null"
          },
          "isHidden": {
            "type": "boolean"
          },
          "artistsCount": {
            "type": [
              "string",
              "integer"
            ],
            "description": "Artists the account added: a numeric string all-time, an integer in a period."
          },
          "ugcCount": {
            "type": [
              "string",
              "integer"
            ],
            "description": "Research submissions: a numeric string all-time, an integer in a period."
          }
        }
      }
    }
  }
}
```
