# Sortly

> Track Sortly items and folders, stock moves, alerts, jobs and purchase orders.

App · 27 actions. Web page: https://docs.lodol.com/docs/integrations/sortly

## Actions

### Change a job's status

Move a job to in progress or completed.

**Inputs**

- Job (`job_id`, number, required): The job to use. At least 1.
- Status (`status`, text, required): The new status. A job can only move forward, and completing it locks its folder. One of: `not_started` (Not started), `in_progress` (In progress), `completed`.

**Outputs**

- `data` (object): The response from Sortly.

**Example output**

```json
{
  "data": {
    "data": {
      "completed_at": "example",
      "created_at": "example",
      "created_by": {
        "name": "example"
      },
      "custom_field_values": [],
      "end_date": "example",
      "external_job_link": "example",
      "folder_id": 1.0,
      "id": 1.0,
      "name": "example",
      "notes": "example",
      "start_date": "example",
      "started_at": "example",
      "status": "example",
      "updated_at": "example",
      "updated_by": {
        "name": "example"
      },
      "version": 1.0
    }
  }
}
```

### Change a purchase order's status

Move a purchase order to a new status, such as approved or ordered.

**Inputs**

- Purchase order (`purchase_order_id`, number, required): The purchase order to use. At least 1.
- Status (`status`, text, required): The new status. From Ordered an order can only be voided or closed. One of: `draft`, `ready_for_review` (Ready for review), `approved`, `ordered`, `voided`, `closed`.

**Outputs**

- `data` (object): The response from Sortly.

**Example output**

```json
{
  "data": {
    "data": {
      "approved_by": "example",
      "approved_date": "example",
      "bill_to": {
        "city": "example",
        "country": "example",
        "line1": "example",
        "line2": "example",
        "name": "example",
        "state": "example",
        "zip_code": "example"
      },
      "charges": {
        "discount": "example",
        "shipping_cost": "example",
        "tax": "example"
      },
      "created_at": "example",
      "created_by": "example",
      "currency_code": "example",
      "expected_delivery_date": "example",
      "id": 1.0,
      "line_items": [],
      "notes": "example",
      "ordered_by": "example",
      "ordered_date": "example",
      "purchase_order_number": "example",
      "received_by": "example",
      "received_date": "example",
      "ship_to": {
        "city": "example",
        "country": "example",
        "line1": "example",
        "line2": "example",
        "name": "example",
        "state": "example",
        "zip_code": "example"
      },
      "status": "example",
      "sub_total": "example",
      "submitted_by": "example",
      "submitted_date": "example",
      "terms": "example",
      "total": "example",
      "updated_at": "example",
      "updated_by": "example",
      "vendor": {
        "city": "example",
        "country": "example",
        "email": "example",
        "line1": "example",
        "line2": "example",
        "name": "example",
        "phone": "example",
        "state": "example",
        "zip_code": "example"
      },
      "version": 1.0
    }
  }
}
```

### Create a job

Create a job, and its job folder, to track the items it uses.

**Inputs**

- Name (`name`, text, required): The job's name. It must be unique in your account.
- Notes (`notes`, text): Notes about the job, up to 4,000 characters.
- Start date (`start_date`, date): The day the job starts.
- End date (`end_date`, date): The day the job should be finished by.
- External job link (`external_job_link`, text): A link to the job in another system, such as your field service app.

**Outputs**

- `data` (object): The response from Sortly.

**Example output**

```json
{
  "data": {
    "data": {
      "completed_at": "example",
      "created_at": "example",
      "created_by": {
        "name": "example"
      },
      "custom_field_values": [],
      "end_date": "example",
      "external_job_link": "example",
      "folder_id": 1.0,
      "id": 1.0,
      "name": "example",
      "notes": "example",
      "start_date": "example",
      "started_at": "example",
      "status": "example",
      "updated_at": "example",
      "updated_by": {
        "name": "example"
      },
      "version": 1.0
    }
  }
}
```

### Create a low stock alert

Create an alert that notifies your team when an item's stock crosses a level.

**Inputs**

- Item (`item_id`, number, required): The item to watch. At least 1.
- Threshold method (`threshold_method`, text, required): When the alert goes off: below or above a number, or at or below the item's minimum level. One of: `less_than_or_equal_to_min_quantity` (Less than or equal to min quantity), `quantity_less_than` (Quantity less than), `quantity_less_than_equal_to` (Quantity less than equal to), `quantity_greater_than` (Quantity greater than), `quantity_greater_than_equal_to` (Quantity greater than equal to).
- Threshold value (`threshold_value`, number): The quantity the alert compares the item's stock with.
- Recipient groups (`recipient_groups`, list): Who to notify when the alert goes off. Defaults to the account's owners. One or more of: `owners`, `admins`, `members`.

**Outputs**

- `data` (object): The response from Sortly.

**Example output**

```json
{
  "data": {
    "data": {
      "custom_attribute_id": 1.0,
      "is_deleted": false,
      "is_fired": false,
      "item_id": 1.0,
      "recipient_groups": [],
      "threshold_interval": "example",
      "threshold_method": "example",
      "threshold_value": 1.0,
      "type": "example"
    }
  }
}
```

### Create a purchase order

Create a draft purchase order for an item.

**Inputs**

- Currency code (`currency_code`, text, required): The three-letter currency code, such as USD.
- Item (`item_id`, number, required): The item to order. At least 1.
- Line name (`line_name`, text, required): The name to show on the order line, usually the item's name.
- Quantity (`quantity`, number, required): How many to order. At least 0.
- Unit of measure (`unit_of_measure`, text, required): The unit the quantity is in, such as units, ft or kg.
- Unit rate (`unit_rate`, number): The price of one unit. Leave blank for a line with no price. At least 0.
- Purchase order number (`purchase_order_number`, text): The order's number, up to 20 characters. Leave blank to have Sortly number it.
- Vendor name (`vendor_name`, text): The vendor's name.
- Vendor email (`vendor_email`, text): The vendor's email address.
- Expected delivery date (`expected_delivery_date`, date and time): When the order is expected to arrive.
- Notes (`notes`, text): Notes for the order, up to 4,000 characters.
- Terms (`terms`, text): The order's terms, up to 4,000 characters.

**Outputs**

- `data` (object): The response from Sortly.

**Example output**

```json
{
  "data": {
    "data": {
      "approved_by": "example",
      "approved_date": "example",
      "bill_to": {
        "city": "example",
        "country": "example",
        "line1": "example",
        "line2": "example",
        "name": "example",
        "state": "example",
        "zip_code": "example"
      },
      "charges": {
        "discount": "example",
        "shipping_cost": "example",
        "tax": "example"
      },
      "created_at": "example",
      "created_by": "example",
      "currency_code": "example",
      "expected_delivery_date": "example",
      "id": 1.0,
      "line_items": [],
      "notes": "example",
      "ordered_by": "example",
      "ordered_date": "example",
      "purchase_order_number": "example",
      "received_by": "example",
      "received_date": "example",
      "ship_to": {
        "city": "example",
        "country": "example",
        "line1": "example",
        "line2": "example",
        "name": "example",
        "state": "example",
        "zip_code": "example"
      },
      "status": "example",
      "sub_total": "example",
      "submitted_by": "example",
      "submitted_date": "example",
      "terms": "example",
      "total": "example",
      "updated_at": "example",
      "updated_by": "example",
      "vendor": {
        "city": "example",
        "country": "example",
        "email": "example",
        "line1": "example",
        "line2": "example",
        "name": "example",
        "phone": "example",
        "state": "example",
        "zip_code": "example"
      },
      "version": 1.0
    }
  }
}
```

### Create an item or folder

Create an item to track, or a folder to hold items.

**Inputs**

- Name (`name`, text, required): The item's or folder's name, up to 190 characters.
- Type (`record_type`, text, required): Whether to create an item you track, or a folder that holds items. One of: `item`, `folder`.
- Quantity (`quantity`, number): How many you have. Use 0 to empty an item.
- Min quantity (`min_quantity`, number): The level at which a quantity alert on the item can notify your team.
- Price (`price`, number): The price of one unit. At least 0.
- Notes (`notes`, text): Free-text notes.
- Parent (`parent_id`, number): The folder to put it in. Leave blank for the top level. At least 1.
- Tags (`tags`, list): Tag names to put on it.

**Outputs**

- `data` (object): The response from Sortly.

**Example output**

```json
{
  "data": {
    "data": {
      "created_at": "example",
      "custom_attribute_values": [],
      "id": 1.0,
      "label_url": "example",
      "label_url_extra": "example",
      "label_url_extra_type": "example",
      "label_url_type": "example",
      "measured_quantity": {
        "name": "lbs",
        "scale": 1.0,
        "type": "weight",
        "value": 1.0
      },
      "min_quantity": 1.0,
      "name": "example",
      "notes": "example",
      "parent_id": 1.0,
      "photo_ids": [],
      "photos": [],
      "price": 1.0,
      "quantity": 1.0,
      "sid": "example",
      "tag_names": [],
      "tags": [],
      "type": "item",
      "updated_at": "example"
    }
  }
}
```

### Delete a job

Delete a job, its folder and the items inside it. This can't be undone.

**Inputs**

- Job (`job_id`, number, required): The job to delete. Its folder and any items in it are deleted too. At least 1.

**Outputs**

- `data` (object): The response from Sortly.

**Example output**

```json
{
  "data": {}
}
```

### Delete a purchase order

Delete a purchase order. Stock already received stays received.

**Inputs**

- Purchase order (`purchase_order_id`, number, required): The purchase order to use. At least 1.

**Outputs**

- `data` (object): The response from Sortly.

**Example output**

```json
{
  "data": {}
}
```

### Delete an alert

Delete an alert.

**Inputs**

- Alert (`alert_id`, number, required): The alert to delete. At least 1.

**Outputs**

- `data` (object): The response from Sortly.

**Example output**

```json
{
  "data": {}
}
```

### Delete an item or folder

Permanently delete an item or folder. This can't be undone.

**Inputs**

- Item (`item_id`, number, required): The item or folder to delete. Deleting a folder deletes everything inside it. At least 1.

**Outputs**

- `data` (object): The response from Sortly.

**Example output**

```json
{
  "data": {}
}
```

### Get a job

Get one job's details, status and item counts.

**Inputs**

- Job (`job_id`, number, required): The job to use. At least 1.

**Outputs**

- `data` (object): The response from Sortly.

**Example output**

```json
{
  "data": {
    "data": {
      "completed_at": "example",
      "created_at": "example",
      "created_by": {
        "name": "example"
      },
      "custom_field_values": [],
      "end_date": "example",
      "external_job_link": "example",
      "folder_id": 1.0,
      "id": 1.0,
      "name": "example",
      "notes": "example",
      "start_date": "example",
      "started_at": "example",
      "status": "example",
      "updated_at": "example",
      "updated_by": {
        "name": "example"
      },
      "version": 1.0
    }
  }
}
```

### Get a purchase order

Get one purchase order with its lines, notes, terms and totals.

**Inputs**

- Purchase order (`purchase_order_id`, number, required): The purchase order to use. At least 1.

**Outputs**

- `data` (object): The response from Sortly.

**Example output**

```json
{
  "data": {
    "data": {
      "approved_by": "example",
      "approved_date": "example",
      "bill_to": {
        "city": "example",
        "country": "example",
        "line1": "example",
        "line2": "example",
        "name": "example",
        "state": "example",
        "zip_code": "example"
      },
      "charges": {
        "discount": "example",
        "shipping_cost": "example",
        "tax": "example"
      },
      "created_at": "example",
      "created_by": "example",
      "currency_code": "example",
      "expected_delivery_date": "example",
      "id": 1.0,
      "line_items": [],
      "notes": "example",
      "ordered_by": "example",
      "ordered_date": "example",
      "purchase_order_number": "example",
      "received_by": "example",
      "received_date": "example",
      "ship_to": {
        "city": "example",
        "country": "example",
        "line1": "example",
        "line2": "example",
        "name": "example",
        "state": "example",
        "zip_code": "example"
      },
      "status": "example",
      "sub_total": "example",
      "submitted_by": "example",
      "submitted_date": "example",
      "terms": "example",
      "total": "example",
      "updated_at": "example",
      "updated_by": "example",
      "vendor": {
        "city": "example",
        "country": "example",
        "email": "example",
        "line1": "example",
        "line2": "example",
        "name": "example",
        "phone": "example",
        "state": "example",
        "zip_code": "example"
      },
      "version": 1.0
    }
  }
}
```

### Get a purchase order's receive status

Check whether the latest delivery recorded against a purchase order has finished.

**Inputs**

- Purchase order (`purchase_order_id`, number, required): The purchase order to use. At least 1.

**Outputs**

- `data` (object): The response from Sortly.

**Example output**

```json
{
  "data": {
    "data": {
      "created_at": "example",
      "error": "example",
      "errors": [],
      "pending_line_item_ids": [],
      "received_line_item_ids": [],
      "status": "example",
      "updated_at": "example"
    }
  }
}
```

### Get an item or folder

Get one item's or folder's details.

**Inputs**

- Item (`item_id`, number, required): The item or folder to use. At least 1.
- Include (`include`, list): Extra details to include with each item: custom field values, photos or both. One or more of: `custom_attributes` (Custom attributes), `photos`.

**Outputs**

- `data` (object): The response from Sortly.

**Example output**

```json
{
  "data": {
    "data": {
      "created_at": "example",
      "custom_attribute_values": [],
      "id": 1.0,
      "label_url": "example",
      "label_url_extra": "example",
      "label_url_extra_type": "example",
      "label_url_type": "example",
      "min_quantity": 1.0,
      "name": "example",
      "notes": "example",
      "parent_id": 1.0,
      "photos": [],
      "price": 1.0,
      "quantity": 1.0,
      "sid": "example",
      "tag_names": [],
      "tags": [],
      "type": "example",
      "updated_at": "example"
    }
  }
}
```

### List alerts

List stock-level and date reminder alerts, and whether each has gone off.

**Inputs**

- Page (`page`, number): The page of results to return, starting at 1. At least 1.
- Per page (`per_page`, number): How many records to return on each page, up to 1,000. From 1 to 1000.

**Outputs**

- `data` (object): The response from Sortly.

**Example output**

```json
{
  "data": {
    "data": [],
    "meta": {
      "next_page_url": "example",
      "page": 1.0,
      "total_count": 1.0,
      "total_pages": 1.0
    }
  }
}
```

### List items and folders

List items and folders, newest first.

**Inputs**

- Folder (`folder_id`, number): List what is directly inside this folder. Leave blank for the top level. At least 1.
- Include subfolders (`include_subfolders`, true/false): Also list everything inside folders within the chosen folder.
- Include (`include`, list): Extra details to include with each item: custom field values, photos or both. One or more of: `custom_attributes` (Custom attributes), `photos`.
- Page (`page`, number): The page of results to return, starting at 1. At least 1.
- Per page (`per_page`, number): How many records to return on each page, up to 1,000. From 1 to 1000.

**Outputs**

- `data` (object): The response from Sortly.

**Example output**

```json
{
  "data": {
    "data": [],
    "meta": {
      "next_page_url": "example",
      "page": 1.0,
      "total_count": 1.0,
      "total_pages": 1.0
    }
  }
}
```

### List jobs

List jobs, most recently updated first.

**Inputs**

- Name (`name`, text): Only list jobs whose name starts with this text.
- Status (`status`, list): Only list jobs in these statuses. One or more of: `not_started` (Not started), `in_progress` (In progress), `completed`.
- Sort by (`sort_by`, text): The field to sort by. Defaults to when the job was last updated. One of: `name`, `status`, `start_date` (Start date), `end_date` (End date), `created_by_name` (Created by name), `updated_at` (Updated at).
- Sort direction (`sort_direction`, text): Ascending or descending. Defaults to descending. One of: `asc`, `desc`.
- Page (`page`, number): The page of results to return, starting at 1. At least 1.
- Per page (`per_page`, number): How many records to return on each page, up to 100. From 1 to 100.

**Outputs**

- `data` (object): The response from Sortly.

**Example output**

```json
{
  "data": {
    "data": [],
    "meta": {
      "pagination": {
        "has_next": false,
        "has_prev": false,
        "page": 1.0,
        "per_page": 1.0
      }
    }
  }
}
```

### List purchase orders

List purchase orders, most recently updated first. Get one to see its lines.

**Inputs**

- Purchase order number (`purchase_order_number`, text): Only list purchase orders whose number contains this text.
- Status (`status`, list): Only list purchase orders in these statuses. One or more of: `draft`, `ready_for_review` (Ready for review), `approved`, `ordered`, `partially_received` (Partially received), `received`, `voided`, `closed`.
- Sort by (`sort_by`, text): The field to sort by. Defaults to when the order was last updated. One of: `purchase_order_number` (Purchase order number), `created_by` (Created by), `submitted_by` (Submitted by), `status`, `updated_at` (Updated at), `total`, `ordered_date` (Ordered date), `expected_delivery_date` (Expected delivery date), `received_date` (Received date).
- Sort direction (`sort_direction`, text): Ascending or descending. Defaults to descending. One of: `asc`, `desc`.
- Page (`page`, number): The page of results to return, starting at 1. At least 1.
- Per page (`per_page`, number): How many records to return on each page, up to 100. From 1 to 100.

**Outputs**

- `data` (object): The response from Sortly.

**Example output**

```json
{
  "data": {
    "data": [],
    "meta": {
      "pagination": {
        "has_next": false,
        "has_prev": false,
        "page": 1.0,
        "per_page": 1.0
      }
    }
  }
}
```

### List recently updated items

List items and folders changed since a given time.

**Inputs**

- Updated since (`updated_since`, date and time): Only list items and folders changed after this time.
- Folder (`folder_id`, number): Only look in this folder. Leave blank for the top level. At least 1.
- Include subfolders (`include_subfolders`, true/false): Also look inside folders within the chosen folder.
- Include (`include`, list): Extra details to include with each item: custom field values, photos or both. One or more of: `custom_attributes` (Custom attributes), `photos`.
- Page (`page`, number): The page of results to return, starting at 1. At least 1.
- Per page (`per_page`, number): How many records to return on each page, up to 100. From 1 to 100.

**Outputs**

- `data` (object): The response from Sortly.

**Example output**

```json
{
  "data": {
    "data": [],
    "meta": {
      "next_page_url": "example",
      "page": 1.0,
      "total_count": 1.0,
      "total_pages": 1.0
    }
  }
}
```

### List units of measure

List the units of measure items and purchase order lines can use.

**Inputs**: None.

**Outputs**

- `data` (list): Units available to your account. This endpoint answers with a bare array, not the data envelope the other list endpoints use, and it is not paginated.

**Example output**

```json
{
  "data": []
}
```

### Move an item

Move some or all of an item's quantity to another folder.

**Inputs**

- Item (`item_id`, number, required): The item to move. Folders can't be moved this way; change a folder's parent folder instead. At least 1.
- Quantity (`quantity`, number, required): How many to move. Moving part of the quantity creates a separate item in the destination.
- Folder (`folder_id`, number): The folder to move it to. Leave blank for the top level. At least 1.
- Leave zero quantity (`leave_zero_quantity`, true/false): Keep an empty record in the original folder when the whole quantity moves.

**Outputs**

- `data` (object): The response from Sortly.

**Example output**

```json
{
  "data": {
    "data": {
      "created_at": "example",
      "id": 1.0,
      "name": "example",
      "notes": "example",
      "parent_id": 1.0,
      "price": 1.0,
      "quantity": 1.0,
      "sid": "example",
      "tag_names": [],
      "tags": [],
      "type": "example",
      "updated_at": "example"
    }
  }
}
```

### Pull an item into a job

Move a quantity of an item into a job's folder.

**Inputs**

- Job (`job_id`, number, required): The job to use. At least 1.
- Item (`item_id`, number, required): The item to move onto the job. At least 1.
- Quantity (`quantity`, number, required): How many to move onto the job. At least 0.
- Leave zero quantity (`leave_zero_quantity`, true/false): Keep an empty record in the original folder when the whole quantity moves.
- Notes (`notes`, text): A note to keep in the item's history.

**Outputs**

- `data` (object): The response from Sortly.

**Example output**

```json
{
  "data": {
    "data": {
      "added_item_ids": [],
      "errors": []
    }
  }
}
```

### Receive a purchase order line

Record that part or all of an order line has arrived and add it to stock. Sortly finishes the work in the background.

**Inputs**

- Purchase order (`purchase_order_id`, number, required): The purchase order to use. At least 1.
- Line item ID (`line_item_id`, number, required): The ID of the order line that arrived, from the purchase order's line items. At least 1.
- Received quantity (`received_quantity`, number, required): How much of the line has arrived now, on top of anything received before. At least 0.
- Folder (`folder_id`, number): The folder to receive the stock into. Leave blank for the top level. At least 1.
- Notes (`notes`, text): A note to keep against this delivery.

**Outputs**

- `data` (object): The response from Sortly.

**Example output**

```json
{
  "data": {
    "data": {
      "created_at": "example",
      "error": "example",
      "errors": [],
      "pending_line_item_ids": [],
      "received_line_item_ids": [],
      "status": "example",
      "updated_at": "example"
    }
  }
}
```

### Return an item from a job

Move a quantity of an item off a job and back into a folder.

**Inputs**

- Job (`job_id`, number, required): The job to use. At least 1.
- Item ID (`item_id`, number, required): The ID of the item on the job to move off it. At least 1.
- Quantity (`quantity`, number, required): How many to return. At least 0.
- Destination folder (`destination_folder_id`, number): The folder to return it to. Leave blank for All Items. At least 1.
- Leave zero quantity (`leave_zero_quantity`, true/false): Keep an empty record in the job's folder when the whole quantity returns.
- Notes (`notes`, text): A note to keep in the item's history.

**Outputs**

- `data` (object): The response from Sortly.

**Example output**

```json
{
  "data": {
    "data": {
      "errors": [],
      "returned_item_ids": []
    }
  }
}
```

### Search items

Search your inventory by name, optionally within chosen folders.

**Inputs**

- Name (`name`, text): The text to search item and folder names for, up to 190 characters.
- Type (`record_type`, text): Search items, folders or both. Defaults to both. One of: `all`, `item`, `folder`.
- Folder IDs (`folder_ids`, list): Only search inside these folders.
- Include subfolders (`include_subfolders`, true/false): Also search folders inside the chosen folders.
- Page (`page`, number): The page of results to return, starting at 1. At least 1.
- Per page (`per_page`, number): How many results to return on each page. Defaults to 100. At least 1.

**Outputs**

- `data` (object): The response from Sortly.

**Example output**

```json
{
  "data": {
    "data": [],
    "meta": {
      "next_page_url": "example",
      "page": 1.0,
      "total_count": 1.0,
      "total_pages": 1.0
    }
  }
}
```

### Update a job

Change a job's name, dates, notes or link. Fields left blank keep their current values.

**Inputs**

- Job (`job_id`, number, required): The job to use. At least 1.
- Name (`name`, text): The job's new name. It must be unique in your account.
- Notes (`notes`, text): Notes about the job, up to 4,000 characters.
- Start date (`start_date`, date): The day the job starts.
- End date (`end_date`, date): The day the job should be finished by.
- External job link (`external_job_link`, text): A link to the job in another system.

**Outputs**

- `data` (object): The response from Sortly.

**Example output**

```json
{
  "data": {
    "data": {
      "completed_at": "example",
      "created_at": "example",
      "created_by": {
        "name": "example"
      },
      "custom_field_values": [],
      "end_date": "example",
      "external_job_link": "example",
      "folder_id": 1.0,
      "id": 1.0,
      "name": "example",
      "notes": "example",
      "start_date": "example",
      "started_at": "example",
      "status": "example",
      "updated_at": "example",
      "updated_by": {
        "name": "example"
      },
      "version": 1.0
    }
  }
}
```

### Update an item or folder

Change an item's or folder's details. Fields left blank keep their current values.

**Inputs**

- Item (`item_id`, number, required): The item or folder to use. At least 1.
- Name (`name`, text): The new name, up to 190 characters.
- Quantity (`quantity`, number): How many you have. Use 0 to empty an item.
- Min quantity (`min_quantity`, number): The level at which a quantity alert on the item can notify your team.
- Price (`price`, number): The price of one unit. At least 0.
- Notes (`notes`, text): Free-text notes.
- Parent (`parent_id`, number): The folder to move it to. At least 1.
- Tags (`tags`, list): Tag names to put on it. Replaces any tags it has.

**Outputs**

- `data` (object): The response from Sortly.

**Example output**

```json
{
  "data": {}
}
```
