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

# Create Warranty

> This endpoint creates a new warranty

### Body

<ParamField body="id" type="string">
  This is the unique identifier for the warranty.
</ParamField>

<ParamField body="order_id" type="string">
  This is the unique identifier for the order.
</ParamField>

<ParamField body="serial_number" type="string">
  This is the unique identifier for the serial number.
</ParamField>

<ParamField body="description" type="string">
  This is the description of the warranty.
</ParamField>

<ParamField body="status" type="string">
  This is the status of the warranty.
</ParamField>

<ParamField body="reported_condition" type="string">
  This is the reported condition of the warranty.
</ParamField>

<ParamField body="tracking_number" type="string">
  This is the tracking number of the warranty.
</ParamField>

<ParamField body="zendesk_number" type="string">
  This is the zendesk number of the warranty.
</ParamField>

<ParamField body="action_needed" type="string">
  This is the action needed of the warranty.
</ParamField>

<ParamField body="rma" type="string">
  This is the rma of the warranty.
</ParamField>

<ParamField body="country" type="string">
  This is the country of the warranty.
</ParamField>

<ParamField body="created_date" type="string">
  This is the created date of the warranty.
</ParamField>

### Response

<ResponseField name="id" type="string">
  This is the id of the warranty.
</ResponseField>

<ResponseField name="action_needed" type="boolean">
  Indicates whether any action is needed for the warranty.
</ResponseField>

<ResponseField name="advanced_replacement" type="boolean">
  Indicates if advanced replacement is available for the warranty.
</ResponseField>

<ResponseField name="amount" type="decimal">
  The monetary amount associated with the warranty.
</ResponseField>

<ResponseField name="condition" type="string">
  Describes the condition of the item or situation.
</ResponseField>

<ResponseField name="condition_date" type="datetime">
  Date and time when the condition was recorded or observed.
</ResponseField>

<ResponseField name="country" type="string">
  Country associated with the warranty entry.
</ResponseField>

<ResponseField name="created_date" type="datetime">
  Date and time when the warranty entry was created.
</ResponseField>

<ResponseField name="customerEmail" type="string">
  Email address of the customer associated with the warranty.
</ResponseField>

<ResponseField name="customer_id" type="integer">
  Unique identifier for the customer associated with the warranty.
</ResponseField>

<ResponseField name="description" type="string">
  Brief description or additional details about the warranty.
</ResponseField>

<ResponseField name="enteredBy" type="string">
  Name or identifier of the person who entered the warranty.
</ResponseField>

<ResponseField name="issue" type="string">
  Issue or problem associated with the warranty.
</ResponseField>

<ResponseField name="match" type="boolean">
  Indicates whether the warranty matches the specified conditions.
</ResponseField>

<ResponseField name="order_date" type="datetime">
  Date and time when the order associated with the warranty was placed.
</ResponseField>

<ResponseField name="order_id" type="integer">
  Unique identifier for the order associated with the warranty.
</ResponseField>

<ResponseField name="reason_category" type="string">
  Category or reason associated with the warranty.
</ResponseField>

<ResponseField name="replacement_color" type="string">
  Color of the replacement item for the warranty.
</ResponseField>

<ResponseField name="model" type="string">
  Model of the replacement item for the warranty.
</ResponseField>

<ResponseField name="replacement_order_created" type="boolean">
  Indicates if a replacement order has been created for the warranty.
</ResponseField>

<ResponseField name="reported_condition" type="string">
  Condition as reported by the customer or user.
</ResponseField>

<ResponseField name="requested_date" type="datetime">
  Date and time when a specific request was made for the warranty.
</ResponseField>

<ResponseField name="rma" type="string">
  Return Merchandise Authorization (RMA) number for the warranty.
</ResponseField>

<ResponseField name="scanned_serial_number" type="string">
  Serial number obtained through scanning for the warranty.
</ResponseField>

<ResponseField name="serial_number" type="string">
  Unique serial number associated with the item in the warranty.
</ResponseField>

<ResponseField name="shipstation_order_id" type="string">
  ShipStation order ID associated with the warranty.
</ResponseField>

<ResponseField name="shipped_date" type="datetime">
  Date and time when the item was shipped or dispatched.
</ResponseField>

<ResponseField name="sso_id" type="string">
  Single Sign-On (SSO) ID associated with the warranty.
</ResponseField>

<ResponseField name="status" type="string">
  Current status or state of the warranty.
</ResponseField>

<ResponseField name="stripe_invoice_id" type="string">
  Stripe invoice ID associated with the warranty.
</ResponseField>

<ResponseField name="tax_refunded" type="decimal">
  The amount of tax refunded for the warranty.
</ResponseField>

<ResponseField name="total_refunded" type="decimal">
  The total amount refunded for the warranty.
</ResponseField>

<ResponseField name="tracking_number" type="string">
  Tracking number associated with the shipment for the warranty.
</ResponseField>

<ResponseField name="warehouse_received_date" type="datetime">
  Date and time when the item was received in the warehouse.
</ResponseField>

<ResponseField name="warranty_line_items" type="object">
  This is an array of warranty line items.

  <Expandable title="Show child attributes">
    <ResponseField name="amount" type="decimal">
      The monetary amount associated with the warranty line item.
    </ResponseField>

    <ResponseField name="condition" type="string">
      Describes the condition of the replaced item.
    </ResponseField>

    <ResponseField name="flat_rate_shipping" type="boolean">
      Indicates whether the shipping rate is a flat rate.
    </ResponseField>

    <ResponseField name="id" type="integer">
      Unique identifier for the warranty line item.
    </ResponseField>

    <ResponseField name="name" type="string">
      Name or description of the warranty line item.
    </ResponseField>

    <ResponseField name="price" type="decimal">
      The price of the warranty line item.
    </ResponseField>

    <ResponseField name="warranty_id" type="integer">
      Unique identifier for the warranty associated with the line item.
    </ResponseField>

    <ResponseField name="serial_number" type="string">
      Unique serial number associated with the warranty item.
    </ResponseField>

    <ResponseField name="sales_order_sku" type="string">
      Stock Keeping Unit (SKU) of the replaced item.
    </ResponseField>
  </Expandable>
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl --location --request POST 'https://api.stateset.com/v1/warranty' \
  --header 'Content-Type: application/json' \
  --header 'Authorization: Token <token>' \
  --data-raw '{
      "current_token": ""
  }'
  ```

  ```graphQL GraphQL theme={null}

  mutation InsertNewWarranty(
        $warranty: warranties_insert_input!
        ) {
          insert_warranties (
          objects: [$warranty]
          ) {    
          returning {
            id
            order_id
            serial_number
            customer_id
            description
            status
            tracking_number
            zendesk_number
            action_needed
            issue
            shipped_date
            requested_date
            enteredBy
            customerEmail
            rma
            country
          }
        }
      }
  ```

  ```js Node.js theme={null}

  const warranty = await stateset.warranties.create({
    warranty: 'W-23213322',
    warranty_line_items: [
      {id: 'WI-232133223'},
    ],
  });

  ```

  ```py Python theme={null}

  warranty = stateset.warranties.create({
    warranty: 'W-23213322',
    warranty_line_items: [
      {id: 'WI-232133223'},
    ],
  })

  ```

  ```go Golang theme={null}

  warranty, err := stateset.Warranties.Create(&stateset.WarrantyParams{
    Warranty: 'W-23213322',
    WarrantyLineItems: []*stateset.WarrantyLineItemParams{
      {ID: 'WI-232133223'},
    },
  })

  ```

  ```rb Ruby theme={null}

  warranty = Stateset::Warranty.create({
    warranty: 'W-23213322',
    warranty_line_items: [
      {id: 'WI-232133223'},
    ],
  })

  ```

  ```java Java theme={null}

  Warranty warranty = Warranty.create({
    warranty: 'W-23213322',
    warranty_line_items: [
      {id: 'WI-232133223'},
    ],
  })

  ```

  ```php PHP theme={null}

  $warranty = Warranty::create([
    'warranty' => 'W-23213322',
    'warranty_line_items' => [
      ['id' => 'WI-232133223'],
    ],
  ]);

  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {
      "warranties": [
          {
              "id": "0901f083-aa1c-43c5-af5c-0a9d2fc64e30",
              "created_date": "2023-06-28T19:34:59.189838+00:00",
              "amount": null,
              "action_needed": null,
              "condition": null,
              "customerEmail": "customer@gmail.com",
              "customer_id": null,
              "description": null,
              "enteredBy": null,
              "flat_rate_shipping": null,
              "order_date": null,
              "order_id": "524213310335630636",
              "reason_category": null,
              "reported_condition": null,
              "requested_date": null,
              "rma": "#1014-R5",
              "serial_number": null,
              "shipped_date": null,
              "status": "RCV",
              "tax_refunded": null,
              "total_refunded": null,
              "tracking_number": null,
              "warranty_line_items": []
          },
      ]
  } 
  ```
</ResponseExample>
