# Add a source

Source: https://docs.musicnerd.net/api-reference/vault/add-source

Add a source

## POST /api/artist/{id}/knowledge/sources

Full OpenAPI specification: https://docs.musicnerd.net/spec/vault.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: vault",
    "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/artist/{id}/knowledge/sources": {
      "post": {
        "summary": "Add a source",
        "operationId": "addArtistSource",
        "security": [
          {
            "privyBearer": []
          }
        ],
        "description": "Adds a web page to the artist's sources. It is approved at once when the caller is an admin or a whitelisted contributor, and then starts a Lore refresh; otherwise it waits for review. Returns the saved source.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The artist's ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "url"
                ],
                "properties": {
                  "url": {
                    "type": "string",
                    "maxLength": 2048,
                    "description": "A public http(s) web page. A bare domain gets `https://`; the fragment is dropped."
                  }
                }
              },
              "example": {
                "url": "https://pitchfork.com/reviews/albums/bio-ritmo-puerta-del-sur/"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The saved source. `warning` is set when the source was approved but the Lore refresh could not start.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "status",
                    "source"
                  ],
                  "properties": {
                    "status": {
                      "type": "string",
                      "enum": [
                        "ok"
                      ]
                    },
                    "source": {
                      "$ref": "#/components/schemas/VaultSource"
                    },
                    "warning": {
                      "type": "string",
                      "description": "Advice to show the user. Absent when there is none."
                    }
                  }
                },
                "example": {
                  "status": "ok",
                  "source": {
                    "id": "2c6f1c6e-4f0a-4b9b-8a6a-3b1f0b2d9e71",
                    "artistId": "aab92f80-f9e1-4299-aa33-7dd85c8de5d3",
                    "origin": "submission",
                    "activityId": "5d1e3a0c-7b2f-4c8e-9a1d-0e2f3a4b5c6d",
                    "url": "https://pitchfork.com/reviews/albums/bio-ritmo-puerta-del-sur/",
                    "title": "Bio Ritmo: Puerta del Sur Album Review",
                    "snippet": null,
                    "type": "review",
                    "status": "approved",
                    "fileName": null,
                    "fileSize": null,
                    "filePath": null,
                    "contentType": null,
                    "extractedText": null,
                    "ogImage": "https://media.pitchfork.com/photos/bio-ritmo.jpg",
                    "podcastEpisodeKey": null,
                    "podcastShowTitle": null,
                    "podcastEpisodeTitle": null,
                    "publishedAt": null,
                    "createdAt": "2026-10-28T18:02:11.512Z",
                    "updatedAt": "2026-10-28T18:02:11.512Z"
                  }
                }
              }
            }
          },
          "400": {
            "description": "`id` isn't a UUID, or `url` isn't a public web page.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "badId": {
                    "summary": "`id` isn't a UUID",
                    "value": {
                      "status": "error",
                      "error": "artistId must be a UUID"
                    }
                  },
                  "badUrl": {
                    "summary": "Not a public web page",
                    "value": {
                      "status": "error",
                      "error": "Enter a public website URL"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "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"
                }
              }
            }
          },
          "403": {
            "description": "The user is neither the artist's approved claimant nor an admin, or the artist's claim changed during the request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "notYours": {
                    "summary": "Not the claimant or an admin",
                    "value": {
                      "status": "error",
                      "error": "Not your artist"
                    }
                  },
                  "ownershipChanged": {
                    "summary": "The claim changed during the request",
                    "value": {
                      "status": "error",
                      "error": "Artist ownership changed; this operation was cancelled."
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "The artist already has this source.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "status": "error",
                  "error": "This source has already been added"
                }
              }
            }
          },
          "500": {
            "description": "The source could not be saved.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "status": "error",
                  "error": "Failed to add source"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "VaultSource": {
        "type": "object",
        "description": "A source in the artist's vault: a web page or an uploaded file.",
        "required": [
          "id",
          "artistId",
          "origin",
          "url",
          "status",
          "createdAt"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "artistId": {
            "type": "string",
            "format": "uuid"
          },
          "origin": {
            "type": "string",
            "description": "`upload` for an uploaded file, `submission` for a page a user added, `research` for one Music Nerd found."
          },
          "activityId": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid",
            "description": "The activity event that recorded the addition."
          },
          "url": {
            "type": "string",
            "format": "uri",
            "description": "The web page, or an uploaded file's public URL in storage."
          },
          "title": {
            "type": [
              "string",
              "null"
            ],
            "description": "The page's title, or the uploaded file's name."
          },
          "snippet": {
            "type": [
              "string",
              "null"
            ],
            "description": "A short excerpt. For an upload, the first 300 characters of extracted text, or `Uploaded file: <name>`."
          },
          "type": {
            "type": [
              "string",
              "null"
            ],
            "description": "`article`, `interview`, `review`, `profile`, `document`, `image`, `audio`, `video`, `data`, `social`, `website` or `music`. An upload is `image` or `audio` by MIME type, `data` for CSV and JSON, `document` otherwise."
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "approved",
              "rejected"
            ],
            "description": "An upload is always `approved`."
          },
          "fileName": {
            "type": [
              "string",
              "null"
            ]
          },
          "fileSize": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Bytes."
          },
          "filePath": {
            "type": [
              "string",
              "null"
            ],
            "description": "The storage key (`<artistId>/<name>`), not the URL."
          },
          "contentType": {
            "type": [
              "string",
              "null"
            ],
            "description": "The resolved MIME type."
          },
          "extractedText": {
            "type": [
              "string",
              "null"
            ],
            "description": "The file's text, for text files and PDFs with readable text."
          },
          "ogImage": {
            "type": [
              "string",
              "null"
            ]
          },
          "podcastEpisodeKey": {
            "type": [
              "string",
              "null"
            ]
          },
          "podcastShowTitle": {
            "type": [
              "string",
              "null"
            ]
          },
          "podcastEpisodeTitle": {
            "type": [
              "string",
              "null"
            ]
          },
          "publishedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date"
          },
          "createdAt": {
            "type": "string"
          },
          "updatedAt": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "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."
      }
    }
  }
}
```
