# Set the header position

Source: https://docs.musicnerd.net/api-reference/artist-images/header-position

Set the header position

## PATCH /api/artist/header-position

Full OpenAPI specification: https://docs.musicnerd.net/spec/artist-images.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: artist images",
    "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/header-position": {
      "patch": {
        "summary": "Set the header position",
        "operationId": "setHeaderPosition",
        "security": [
          {
            "privyBearer": []
          }
        ],
        "description": "Saves how far down the artist's header image is framed, as a percentage, together with the image it applies to. Choosing a different provider photo later clears it.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/HeaderPosition"
              },
              "example": {
                "artistId": "aab92f80-f9e1-4299-aa33-7dd85c8de5d3",
                "imageUrl": "https://e-cdns-images.dzcdn.net/images/artist/0a1b2c3d4e5f/1000x1000-000000-80-0-0.jpg",
                "y": 35
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The position was saved.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success"
                },
                "example": {
                  "status": "ok",
                  "success": true
                }
              }
            }
          },
          "400": {
            "description": "The body isn't a valid position: unknown fields, a non-UUID `artistId`, an `imageUrl` that is neither a site-relative path nor an `https` URL, or a `y` outside 0 to 100.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "status": "error",
                  "error": "Invalid photo position"
                }
              }
            }
          },
          "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 claimant nor an admin, or the artist's claim changed while the write ran.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "notAuthorized": {
                    "summary": "Not the claimant or an admin",
                    "value": {
                      "status": "error",
                      "error": "Not authorized for this artist"
                    }
                  },
                  "ownershipChanged": {
                    "summary": "The claim changed during the write",
                    "value": {
                      "status": "error",
                      "error": "Artist ownership changed"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "No artist with that ID.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "status": "error",
                  "error": "Artist not found"
                }
              }
            }
          },
          "500": {
            "description": "The write failed, or the token could not be checked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "status": "error",
                  "error": "Could not save photo position"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "HeaderPosition": {
        "type": "object",
        "required": [
          "artistId",
          "imageUrl",
          "y"
        ],
        "additionalProperties": false,
        "properties": {
          "artistId": {
            "type": "string",
            "format": "uuid",
            "description": "The artist's ID."
          },
          "imageUrl": {
            "type": "string",
            "maxLength": 4096,
            "description": "The header image the position applies to: a site-relative path starting with one `/`, or an `https` URL without credentials."
          },
          "y": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100,
            "description": "How far down the image is framed, as a percentage."
          }
        }
      },
      "Success": {
        "type": "object",
        "required": [
          "status",
          "success"
        ],
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "ok"
            ]
          },
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          }
        }
      },
      "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."
      }
    }
  }
}
```
