> ## 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 Work Orders

> This endpoint creates work orders.

### Body

<ParamField body="limit" required="true" type="string">
  This is the limit of the work orders.
</ParamField>

<ParamField body="offset" required="true" type="string">
  This is the offset of the work orders.
</ParamField>

<ParamField body="order_direction" required="true" type="string">
  This is the order direction of the work orders.
</ParamField>

### Response

<ResponseField name="id" type="uuid">
  Unique identifier for the work order (primary key)
</ResponseField>

<ResponseField name="number" type="integer">
  Number associated with the work order
</ResponseField>

<ResponseField name="site" type="string">
  Site or location where the work order is being executed
</ResponseField>

<ResponseField name="work_order_type" type="string">
  Type of the work order
</ResponseField>

<ResponseField name="location" type="string">
  Location or site where the work order is applicable
</ResponseField>

<ResponseField name="part" type="string">
  Part or item associated with the work order
</ResponseField>

<ResponseField name="order_number" type="string">
  Identifier or reference to the order associated with the work order
</ResponseField>

<ResponseField name="manufacture_order" type="string">
  Identifier or reference to the manufacturing order associated with the work order
</ResponseField>

<ResponseField name="status" type="string">
  Current status or state of the work order
</ResponseField>

<ResponseField name="created_by" type="string">
  Name or identifier of the person who created the work order
</ResponseField>

<ResponseField name="created_at" type="string">
  Date and time when the work order was created
</ResponseField>

<ResponseField name="updated_at" type="string">
  Date and time when the work order was last updated
</ResponseField>

<ResponseField name="issue_date" type="string">
  Date when the work order was issued
</ResponseField>

<ResponseField name="expected_completion_date" type="string">
  Expected completion date for the work order
</ResponseField>

<ResponseField name="priority" type="string">
  Priority level or urgency of the work order
</ResponseField>

<ResponseField name="memo" type="string">
  Memo or additional notes related to the work order
</ResponseField>

<ResponseField name="bill_of_materials_number" type="integer">
  Number associated with the bill of materials related to the work order
</ResponseField>

<ResponseField name="actual_labor_hours" type="number">
  Actual labor hours spent on the work order
</ResponseField>

<ResponseField name="standard_labor_hours" type="number">
  Standard labor hours for the work order
</ResponseField>

<ResponseField name="capacity_utilization_id" type="uuid">
  Identifier for related capacity utilization data
</ResponseField>

<ResponseField name="bill_of_materials_id" type="uuid">
  Identifier for related bill of materials
</ResponseField>

<ResponseField name="cogs_data_id" type="uuid">
  Identifier for related COGS (Cost of Goods Sold) data
</ResponseField>

### Response

<ResponseField name="success" type="number">
  Indicates whether the call was successful. 1 if successful, 0 if not.
</ResponseField>

<ResponseField name="user_group" type="object">
  The contents of the user group

  <Expandable title="Toggle object">
    <ResponseField name="team_id" type="number">
      This is the internal ID for this user group. You don't need to record this
      information, since you will not need to use it.
    </ResponseField>

    <ResponseField name="token" type="string">
      This is the user group token (userGroupToken or USER\_GROUP\_TOKEN) that will be
      used to identify which user group is viewing the dashboard. You should save
      this on your end to use when rendering an embedded dashboard.
    </ResponseField>

    <ResponseField name="name" type="string">
      This is the name of the user group provided in the request body.
    </ResponseField>

    <ResponseField name="provided_id" type="string">
      This is the user\_group\_id provided in the request body.
    </ResponseField>

    <ResponseField name="api_environment_tag" type="JSON or null">
      This is the environment tag of the user group. Possible values are 'Customer'
      and 'Testing'. User group id's must be unique to each environment, so you can
      not create multiple user groups with with same id. If you have a production
      customer and a test user group with the same id, you will be required to label
      one as 'Customer' and another as 'Testing'
    </ResponseField>
  </Expandable>
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl --location --request POST 'https://api.stateset.com/v1/work_order' \
  --header 'Content-Type: application/json' \
  --header 'Authorization: Token <token>' \
  --data-raw '{
    "bill_of_materials_number": "123",
    "created_at": "2021-01-01T00:00:00.000Z",
    "created_by": "John Doe",
    "expected_completion_date": "2021-01-01T00:00:00.000Z",
    "id": "wo_123",
    "issue_date": "2021-01-01T00:00:00.000Z",
    "location": "123",
    "manufacture_order": "123",
    "memo": "123",
    "number": "123",
    "order_number": "123",
    "part": "123",
    "priority": "123",
    "site": "123",
    "status": "123",
    "updated_at": "2021-01-01T00:00:00.000Z",
    "work_order_line_items": [
      {
        "id": "wo_123",
        "line_status": "123",
        "line_type": "123",
        "part_name": "123",
        "part_number": "123",
        "total_quantity": "123",
        "unit_quantity": "123",
        "work_order_number": "123"
      }
    ]
  }'
  ```

  ```graphQL GraphQL theme={null}

      mutation addWorkOrder($work_order: work_orders_insert_input!) {
        insert_work_orders(objects: [$work_order]) {
          returning {
            id
          }
        }
      }
  ```

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

  var workOrder = await stateset.workorder.create({
    
  })

  ```

  ```python Python theme={null}

  workOrder = stateset.workorder.create({
    
  })

  ```

  ```ruby Ruby theme={null}

  workOrder = Stateset::WorkOrder.create({
    
  })

  ```

  ```php PHP theme={null}

  $workOrder = Stateset\WorkOrder::create([
    
  ])

  ```

  ```go Go theme={null}

  workOrder := stateset.WorkOrder{
    
  }

  ```

  ```java Java theme={null}

  WorkOrder workOrder = new WorkOrder();

  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {
    {
      "bill_of_materials_number": "123",
      "created_at": "2021-01-01T00:00:00.000Z",
      "created_by": "John Doe",
      "expected_completion_date": "2021-01-01T00:00:00.000Z",
      "id": "wo_123",
      "issue_date": "2021-01-01T00:00:00.000Z",
      "location": "123",
      "manufacture_order": "123",
      "memo": "123",
      "number": "123",
      "order_number": "123",
      "part": "123",
      "priority": "123",
      "site": "123",
      "status": "123",
      "updated_at": "2021-01-01T00:00:00.000Z",
      "work_order_line_items": [
        {
          "id": "wo_123",
          "line_status": "123",
          "line_type": "123",
          "part_name": "123",
          "part_number": "123",
          "total_quantity": "123",
          "unit_quantity": "123",
          "work_order_number": "123"
        }
      ]
    }
  }
  ```
</ResponseExample>
