Skip to content

upload-order-return-attachments ​

Method: POST
Path: /orders/{order_number}/returns/{return_number}/attachments

Tags: Returns

Summary ​

Upload order return attachments

Description ​

Uploads supporting files while the return status is created. Provide at least one image or video.

Storefront SDK Usage ​

SDK Method: sdk.order.uploadOrderReturnAttachments()

Example:

typescript
const input = document.querySelector<HTMLInputElement>("#image-input");
const imageFiles = Array.from(input?.files ?? []);

const { data, error } = await sdk.order.uploadOrderReturnAttachments(
  { order_number: "ORD-2024-001", return_number: "RET-2024-001" },
  {
    images: imageFiles,
    videos: [new File(["video data"], "damage.mp4", { type: "video/mp4" })]
  }
);

if (error) {
  console.error("Failed to upload attachments:", error.message);
} else {
  console.log("Attachments uploaded:", data.success);
  console.log("Message:", data.message);
}

TypeScript Definition ​

typescript
"upload-order-return-attachments": {
        parameters: {
            query?: never;
            header?: never;
            path: {
                /** @description The unique identifier of the Order. */
                order_number: string;
                /** @description The unique identifier of the return request. */
                return_number: string;
            };
            cookie?: never;
        };
        requestBody: {
            content: {
                "multipart/form-data": components["schemas"]["UploadOrderReturnAttachments"];
            };
        };
        responses: {
            /** @description OK */
            200: {
                headers: {
                    [name: string]: unknown;
                };
                content: {
                    "application/json": {
                        message: string;
                        success: boolean;
                    };
                };
            };
            400: components["responses"]["BadRequest"];
            401: components["responses"]["Unauthorized"];
            403: components["responses"]["Forbidden"];
            404: components["responses"]["NotFound"];
            500: components["responses"]["InternalServerError"];
            504: components["responses"]["GatewayTimeout"];
        };
    };

Component References ​

ReferenceResolves To
components["schemas"]["UploadOrderReturnAttachments"]UploadOrderReturnAttachments
components["responses"]["BadRequest"]BadRequest
components["responses"]["Unauthorized"]Unauthorized
components["responses"]["Forbidden"]Forbidden
components["responses"]["NotFound"]NotFound
components["responses"]["InternalServerError"]InternalServerError
components["responses"]["GatewayTimeout"]GatewayTimeout

Parameters ​

  • order_number (path): The unique identifier of the Order.
  • return_number (path): The unique identifier of the return request.

Request Body ​

Content Types: multipart/form-data

Responses ​

200 ​

OK

400 ​

Bad request

401 ​

Authentication failed. Codes include token-required, token-expired and token_not_valid for an invalid or expired token.

403 ​

Access denied. token-required requires an authenticated session; permission-denied means the caller cannot access this resource. On POS, session-expired requires signing in again.

404 ​

Requested resource not found

500 ​

The request failed because of an unexpected error.

504 ​

The request timed out.

OpenAPI Definition ​

json
{
  "tags": [
    "Returns"
  ],
  "operationId": "upload-order-return-attachments",
  "summary": "Upload order return attachments",
  "description": "Uploads supporting files while the return status is `created`. Provide at least one image or video.",
  "externalDocs": {
    "url": "https://llm-docs.commercengine.io/storefront/operations/upload-order-return-attachments",
    "description": "API reference for the upload-order-return-attachments operation"
  },
  "parameters": [
    {
      "name": "order_number",
      "in": "path",
      "description": "The unique identifier of the Order.",
      "required": true,
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "return_number",
      "in": "path",
      "description": "The unique identifier of the return request.",
      "required": true,
      "schema": {
        "type": "string"
      }
    }
  ],
  "requestBody": {
    "required": true,
    "content": {
      "multipart/form-data": {
        "schema": {
          "$ref": "#/components/schemas/UploadOrderReturnAttachments"
        },
        "encoding": {
          "images": {
            "contentType": "image/jpeg, image/png, image/gif, image/webp"
          },
          "videos": {
            "contentType": "video/mp4, video/webm"
          }
        }
      }
    }
  },
  "responses": {
    "200": {
      "description": "OK",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "required": [
              "message",
              "success"
            ],
            "properties": {
              "message": {
                "type": "string"
              },
              "success": {
                "type": "boolean"
              }
            }
          }
        }
      }
    },
    "400": {
      "$ref": "#/components/responses/BadRequest"
    },
    "401": {
      "$ref": "#/components/responses/Unauthorized"
    },
    "403": {
      "$ref": "#/components/responses/Forbidden"
    },
    "404": {
      "$ref": "#/components/responses/NotFound"
    },
    "500": {
      "$ref": "#/components/responses/InternalServerError"
    },
    "504": {
      "$ref": "#/components/responses/GatewayTimeout"
    }
  },
  "security": [
    {
      "Authorization": []
    }
  ],
  "x-speakeasy-group": "orders",
  "x-speakeasy-ignore": true,
  "x-speakeasy-name-override": "uploadOrderReturnAttachments"
}

Auto-generated from OpenAPI spec and TypeScript definitions

Last updated: