> ## Documentation Index
> Fetch the complete documentation index at: https://developer.lulacommerce.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Order Issue

> Create a new issue report for an order, documenting problems, complaints, or special situations that require attention.

This endpoint allows you to create detailed issue reports for orders when problems occur. Issues can range from missing items and wrong products to delivery problems and customer complaints. Each issue is tracked with priority levels, attachments, and resolution workflows.

<Info>
  Issue tracking helps maintain service quality, resolve customer problems efficiently, and identify patterns that can improve operations.
</Info>

### Path Parameters

<ParamField path="order_id" type="string" required>
  The unique identifier of the order where the issue occurred
</ParamField>

### Request Body

<ParamField body="storeId" type="string" required>
  The unique identifier of the store where the issue occurred
</ParamField>

<ParamField body="reportedBy" type="string" required>
  Employee ID or user ID of the person reporting the issue
</ParamField>

<ParamField body="issue" type="object" required>
  Detailed issue information

  <Expandable title="Issue Object">
    <ParamField body="order_item_id" type="string" optional>
      ID of the specific order item related to the issue (if applicable)
    </ParamField>

    <ParamField body="issue_type" type="string" required>
      Type of issue: "wrong\_items", "missing\_items", "damaged\_items", "delivery\_issue", "payment\_issue", "customer\_complaint", "quality\_issue", "other"
    </ParamField>

    <ParamField body="description" type="string" required>
      Detailed description of the issue
    </ParamField>

    <ParamField body="priority" type="string" required>
      Issue priority level: "low", "medium", "high", "critical"
    </ParamField>

    <ParamField body="attachments" type="array" optional>
      Array of URLs pointing to images, documents, or other evidence related to the issue
    </ParamField>

    <ParamField body="customer_contacted" type="boolean" optional default="false">
      Whether the customer has been contacted about this issue
    </ParamField>

    <ParamField body="expected_resolution_time" type="string" optional>
      Expected time to resolve the issue (ISO 8601 format)
    </ParamField>
  </Expandable>
</ParamField>

### Response

<ResponseField name="success" type="boolean">
  Indicates whether the issue was successfully created
</ResponseField>

<ResponseField name="message" type="string">
  Confirmation message or error details
</ResponseField>

<ResponseField name="issue_id" type="string">
  Unique identifier for the created issue
</ResponseField>

<ResponseField name="issue_number" type="string">
  Human-readable issue number for reference
</ResponseField>

<ResponseField name="status" type="string">
  Initial issue status (typically "open" or "investigating")
</ResponseField>

<ResponseField name="created_at" type="string">
  Timestamp when the issue was created
</ResponseField>

<ResponseField name="assigned_to" type="string">
  Employee or team assigned to handle the issue
</ResponseField>

### Request Example

```json theme={null}
{
  "storeId": "449235c1-3d04-4519-998b-40d2a621e5e0",
  "reportedBy": "b1e46bf5-0e29-4c7e-8ca1-0d7407c67169",
  "issue": {
    "order_item_id": "d2fe3e81-fb54-4d90-9c45-b0f3ed9ed1f1",
    "issue_type": "wrong_items",
    "description": "I ordered the DARK chocolate Muddy Bites and the 10oz bag of Peach Rings, but received milk chocolate and gummy bears instead",
    "priority": "medium",
    "attachments": [
      "https://lula-inventory-service-staging.s3.amazonaws.com/images/dad46dc1-6d6f-4a8f-9602-29f2f5c1231d/Candy/29b4ef50-eeb3-40cb-a04f-112e187fd06a_1732713277583.webp"
    ],
    "customer_contacted": true,
    "expected_resolution_time": "2024-01-15T18:00:00Z"
  }
}
```

### Response Example

```json theme={null}
{
  "success": true,
  "message": "Issue successfully created and assigned for resolution",
  "issue_id": "issue_123456789",
  "issue_number": "ISS-2024-001234",
  "status": "open",
  "created_at": "2024-01-15T14:30:00Z",
  "assigned_to": "customer_service_team"
}
```

<Accordion title="Issue Types and Priorities">
  **Issue Types:**

  * **wrong\_items**: Customer received different items than ordered
  * **missing\_items**: Items were missing from the order
  * **damaged\_items**: Items arrived damaged or in poor condition
  * **delivery\_issue**: Problems with delivery process or timing
  * **payment\_issue**: Payment processing or billing problems
  * **customer\_complaint**: General customer dissatisfaction
  * **quality\_issue**: Product quality below standards
  * **other**: Issues not covered by other categories

  **Priority Levels:**

  * **low**: Minor issues that don't significantly impact customer experience
  * **medium**: Moderate issues requiring timely resolution
  * **high**: Serious issues that significantly impact customer satisfaction
  * **critical**: Urgent issues requiring immediate attention (safety, major losses)
</Accordion>

<Note>
  **Automatic Assignment**: Issues are automatically assigned to appropriate teams based on issue type and priority. High and critical priority issues trigger immediate notifications.
</Note>

<Tip>
  **Evidence Collection**: Always include attachments when possible. Photos and documentation help resolve issues faster and provide valuable feedback for process improvement.
</Tip>

### Issue Creation Workflow

<Accordion title="What Happens When You Create an Issue">
  1. **Issue Registration**: Issue is assigned a unique ID and tracking number
  2. **Priority Assessment**: System evaluates priority and determines urgency
  3. **Team Assignment**: Issue is routed to appropriate resolution team
  4. **Customer Notification**: Customer is informed if customer\_contacted is true
  5. **Escalation Setup**: Automatic escalation timers are set based on priority
  6. **Audit Trail**: Complete tracking begins for resolution monitoring
  7. **Analytics Update**: Issue data is added to quality metrics and reporting
</Accordion>

### Use Cases

<Accordion title="Common Issue Scenarios">
  **Wrong Items Delivered**

  * Customer received incorrect products
  * Include photos of wrong items
  * Reference specific order items

  **Missing Items**

  * Items were missing from delivery
  * Check against packing list
  * Verify inventory accuracy

  **Quality Issues**

  * Damaged or expired products
  * Poor product condition
  * Food safety concerns

  **Delivery Problems**

  * Late delivery or wrong address
  * Driver issues or communication problems
  * Weather or logistics complications

  **Customer Complaints**

  * Service quality issues
  * Staff behavior concerns
  * General dissatisfaction
</Accordion>

### Error Responses

<Accordion title="Common Error Scenarios">
  **Invalid Order**

  ```json theme={null}
  {
    "success": false,
    "message": "Order not found or not accessible",
    "error_code": "ORDER_NOT_FOUND",
    "order_id": "invalid-order-id"
  }
  ```

  **Invalid Issue Type**

  ```json theme={null}
  {
    "success": false,
    "message": "Invalid issue type provided",
    "error_code": "INVALID_ISSUE_TYPE",
    "valid_types": ["wrong_items", "missing_items", "damaged_items", "delivery_issue", "payment_issue", "customer_complaint", "quality_issue", "other"]
  }
  ```

  **Missing Required Fields**

  ```json theme={null}
  {
    "success": false,
    "message": "Required fields are missing",
    "error_code": "MISSING_FIELDS",
    "missing_fields": ["issue.description", "issue.priority"]
  }
  ```

  **Invalid Attachment URL**

  ```json theme={null}
  {
    "success": false,
    "message": "One or more attachment URLs are invalid",
    "error_code": "INVALID_ATTACHMENT",
    "invalid_urls": ["invalid-url-here"]
  }
  ```
</Accordion>

<Warning>
  **Critical Issues**: For critical priority issues involving safety or major financial impact, consider following up with immediate phone or direct communication in addition to creating the issue record.
</Warning>
