Skip to content

update-profile-image

Method: PUT
Path: /auth/user/{id}/profile-image

Tags: Auth

Summary

Update profile image

Description

The Profile Image API streamlines the process of updating profile images associating with user accounts, offering a user-centric approach to visual identity customization. Upon success, the API responds with a confirmation message. In case of errors, clear error messages facilitate quick issue resolution. Overall, the Profile Image API enhances user engagement by seamlessly integrating personalized visual elements into digital platforms.

Storefront SDK Usage

SDK Method: sdk.auth.updateProfileImage()

Example:

typescript
// Update existing profile image
const newImageFile = document.getElementById('file-input').files[0];
const { data, error } = await sdk.auth.updateProfileImage(
  { id: "01H9XYZ12345USERID" },
  { image: newImageFile }
);

if (error) {
  console.error("Failed to update profile image:", error.message);
} else {
  console.log("Profile image updated successfully");
  console.log("New image URL:", data.profile_image_url);
}

TypeScript Definition

typescript
"update-profile-image": {
        parameters: {
            query?: never;
            header?: never;
            path: {
                /** @description user ID */
                id: string;
            };
            cookie?: never;
        };
        requestBody: {
            content: {
                "multipart/form-data": {
                    /** Format: binary */
                    image?: string;
                };
            };
        };
        responses: {
            /** @description OK */
            200: {
                headers: {
                    [name: string]: unknown;
                };
                content: {
                    "application/json": {
                        /** @description A descriptive message confirming the success or failure of the update operation. */
                        message: string;
                        /** @description Indicates whether the request was successful or failure (true for success, false for failure). */
                        success: boolean;
                        /** @description An object containing the response content. */
                        content: {
                            /** @description A string representing the URL to a profile image. */
                            profile_image_url: string;
                        };
                    };
                };
            };
            400: components["responses"]["BadRequest"];
            401: components["responses"]["Unauthorized"];
            404: components["responses"]["NotFound"];
        };
    };

Component References

ReferenceResolves To
components["responses"]["BadRequest"]BadRequest
components["responses"]["Unauthorized"]Unauthorized
components["responses"]["NotFound"]NotFound

Parameters

  • id (path): user ID

Request Body

Content Types: multipart/form-data

Responses

200

OK

400

Bad request

401

Not authorized for given operation on the Resource

404

Requested resource not found

OpenAPI Definition

json
{
  "tags": [
    "Auth"
  ],
  "operationId": "update-profile-image",
  "summary": "Update profile image",
  "description": "The Profile Image API streamlines the process of updating profile images associating with user accounts, offering a user-centric approach to visual identity customization. Upon success, the API responds with a confirmation message. In case of errors, clear error messages facilitate quick issue resolution. Overall, the Profile Image API enhances user engagement by seamlessly integrating personalized visual elements into digital platforms.",
  "externalDocs": {
    "url": "https://llm-docs.commercengine.io/storefront/operations/update-profile-image",
    "description": "API reference for the update-profile-image operation"
  },
  "parameters": [
    {
      "name": "id",
      "in": "path",
      "description": "user ID",
      "required": true,
      "schema": {
        "type": "string"
      }
    }
  ],
  "requestBody": {
    "description": "",
    "required": true,
    "content": {
      "multipart/form-data": {
        "schema": {
          "type": "object",
          "properties": {
            "image": {
              "type": "string",
              "format": "binary",
              "contentMediaType": "application/octet-stream"
            }
          }
        }
      }
    }
  },
  "responses": {
    "200": {
      "description": "OK",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "required": [
              "message",
              "success",
              "content"
            ],
            "properties": {
              "message": {
                "description": "A descriptive message confirming the success or failure of the update operation.",
                "type": "string"
              },
              "success": {
                "description": "Indicates whether the request was successful or failure (true for success, false for failure).",
                "type": "boolean"
              },
              "content": {
                "description": "An object containing the response content.",
                "properties": {
                  "profile_image_url": {
                    "description": "A string representing the URL to a profile image.",
                    "type": "string"
                  }
                },
                "required": [
                  "profile_image_url"
                ],
                "type": "object"
              }
            }
          }
        }
      }
    },
    "400": {
      "$ref": "#/components/responses/BadRequest"
    },
    "401": {
      "$ref": "#/components/responses/Unauthorized"
    },
    "404": {
      "$ref": "#/components/responses/NotFound"
    }
  },
  "security": [
    {
      "Authorization": []
    }
  ],
  "x-speakeasy-group": "auth",
  "x-speakeasy-ignore": true,
  "x-speakeasy-name-override": "updateProfileImage"
}

Auto-generated from OpenAPI spec and TypeScript definitions

Last updated: