﻿# Categories

Categories organize the line items used on Flute invoices.
Categories are intended to be a convenient way to group and locate line items.
Line items are used to create invoices.
Each line item is product or service with predefined values such a name, unit type, and price.
To build an invoice, add the appropriate line items to itemize billing.
Categories can organize groups of line items.
The use of categories is optional.
A category may contain zero, one or more line items.
Line items may be assigned to a category.
However, line items are not required to be assigned to a category.
For more about line items, see [Line Items](#line-items-overview).
Each category has:
* A name, which must be unique within a merchant account.
* An optional default unit type, such as each, hour, or pound, that applies automatically to line items created under it.

A category may be deleted,
This does not delete the line items assigned to it.
Those line items will remain but without a category.
Each category returned by the API also reports an item count.
This gives a quick view of how many line items currently belong to it.
With that information, a merchant may decide to rename, reassign, or delete it.
The Categories endpoints support listing, creating, updating, and removing categories.
The following endpoints are available:
| Endpoint | Explanation |
|  --- | --- |
| `GET /pay-int-api/categories` | The list endpoint accepts a search string along with paging and sort parameters. A merchant catalog with many categories can be filtered to relevant results rather than paged through in full. |
| `POST /pay-int-api/categories` | Creates a new category. The category name must be unique within the merchant account. |
| `PUT /pay-int-api/categories/{categoryId}` | Updates an existing category's name or default unit type. The name must remain unique within the merchant account. |
| `DELETE /pay-int-api/categories/{categoryId}` | Deletes a category. Line items that referenced it stay in the catalog, now with an empty category. |

 - [GET /pay-int-api/categories](https://developer.flute.com/api-reference/categories/flute-v1-get-pay-int-api-categories.md): GET {{baseURL}}/pay-int-api/categories This endpoint retrieves a paginated list of the merchant's categories. Results can be narrowed with the `search` parameter for a case-insensitive, partial-match
 - [POST /pay-int-api/categories](https://developer.flute.com/api-reference/categories/flute-v1-post-pay-int-api-categories.md): POST {{baseURL}}/pay-int-api/categories This endpoint creates a new category. Example request: `POST {{baseURL}}/pay-int-api/categories` ```json Authorization: Bearer {{merchantApiToken}} Content-Typ
 - [PUT /pay-int-api/categories/{categoryId}](https://developer.flute.com/api-reference/categories/flute-v1-put-pay-int-api-categories-categoryid.md): PUT {{baseURL}}/pay-int-api/categories/{{categoryId}} This endpoint updates or edits category information. The category name must be unique in the merchant account. See Also: To list categories, see G
 - [DELETE /pay-int-api/categories/{categoryId}](https://developer.flute.com/api-reference/categories/flute-v1-delete-pay-int-api-categories-categoryid.md): DELETE {{baseURL}}/pay-int-api/categories/{{categoryId}} This endpoint deletes a category. This category will not be available in the catalog. Items linked to this category will still be in the cata