# Your profile photo

Source: https://docs.musicnerd.net/api-reference/users/profile-image

Your profile photo

## GET /api/user/profile-image

Full OpenAPI specification: https://docs.musicnerd.net/spec/users.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: users and profile",
    "version": "1.0.0",
    "description": "The signed-in user's own account and profile: their user name, profile photo, approved claim, contributed artists, contribution summary and the updates feed. Every route answers about the caller only; the account comes from the token, never from the request."
  },
  "servers": [
    {
      "url": "https://musicnerd-api.vercel.app",
      "description": "Production"
    },
    {
      "url": "https://musicnerd-api-staging.vercel.app",
      "description": "Staging (staging database)"
    }
  ],
  "paths": {
    "/api/user/profile-image": {
      "get": {
        "summary": "Your profile photo",
        "operationId": "getUserProfileImage",
        "security": [
          {
            "privyBearer": []
          }
        ],
        "description": "A one-hour signed URL for the caller's profile photo, or `url: null` when none has been uploaded. The optional `X-Profile-Account` header lets a caller detect that the signed-in account changed.",
        "parameters": [
          {
            "$ref": "#/components/parameters/ProfileAccountOptional"
          }
        ],
        "responses": {
          "200": {
            "description": "The photo URL, or null. `Cache-Control: private, no-store`.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "status",
                    "userId",
                    "url"
                  ],
                  "properties": {
                    "status": {
                      "type": "string",
                      "enum": [
                        "ok"
                      ]
                    },
                    "userId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "url": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "A signed URL valid for an hour, with a cache-busting `v` query, or null."
                    }
                  }
                },
                "examples": {
                  "photo": {
                    "summary": "A photo",
                    "value": {
                      "status": "ok",
                      "userId": "6f1d2e3a-4b5c-4d6e-8f90-a1b2c3d4e5f6",
                      "url": "https://example.supabase.co/storage/v1/object/sign/user-profile-images/6f1d2e3a-4b5c-4d6e-8f90-a1b2c3d4e5f6/avatar.webp?token=example&v=1760000000000"
                    }
                  },
                  "none": {
                    "summary": "No photo yet",
                    "value": {
                      "status": "ok",
                      "userId": "6f1d2e3a-4b5c-4d6e-8f90-a1b2c3d4e5f6",
                      "url": null
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "No token, an invalid or expired token, or no user row for it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "noToken": {
                    "summary": "No valid token",
                    "value": {
                      "status": "error",
                      "error": "Not signed in"
                    }
                  },
                  "noRow": {
                    "summary": "The user row is gone",
                    "value": {
                      "status": "error",
                      "error": "Account not found"
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "`X-Profile-Account` was sent and is not the caller's id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "status": "error",
                  "error": "Your account changed. Refresh and try again."
                }
              }
            }
          },
          "503": {
            "description": "Storage or the account lookup could not be read.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "status": "error",
                  "error": "Could not load your profile photo"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "parameters": {
      "ProfileAccountOptional": {
        "name": "X-Profile-Account",
        "in": "header",
        "required": false,
        "description": "The user id the page believes is signed in. When sent, it must equal the token's user, or the response is 409.",
        "schema": {
          "type": "string",
          "format": "uuid"
        },
        "example": "6f1d2e3a-4b5c-4d6e-8f90-a1b2c3d4e5f6"
      }
    },
    "schemas": {
      "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. Every route here answers about that user only."
      }
    }
  }
}
```
