Items
An item represents a product or service that you sell. Items can be used to generate line items and can also be used by plans.
Item Object
Attributes
{
"avalara_location_code": null,
"avalara_tax_code": null,
"created_at": 1477327516,
"currency": "usd",
"description": null,
"discountable": true,
"gl_account": null,
"id": "delivery",
"metadata": [],
"name": "Delivery",
"object": "item",
"taxable": true,
"taxes": [],
"type": "service",
"unit_cost": 100,
"updated_at": 1477327516
}
Parameter | Type | Description |
---|---|---|
id | string | The item's unique ID |
object | string | Object type, item |
name | string | Item name |
currency | string | 3-letter ISO code |
unit_cost | number | Unit cost or rate |
description | string | Optional description |
type | string | Optional line item type. Used to group line items by type in reporting |
taxable | boolean | Excludes amount from taxes when false |
taxes | array | Collection of Tax Rate Objects |
avalara_tax_code | string | Avalara-specific tax code |
avalara_location_code | string | Optional Avalara location code |
gl_account | string | General ledger account code |
discountable | boolean | Excludes amount from discounts when false |
created_at | timestamp | Timestamp when created |
updated_at | timestamp | Timestamp when updated |
metadata | object | A hash of key/value pairs that can store additional information about this object. |
Create an item
curl "https://api.invoiced.com/items" \
-u {API_KEY}: \
-d id="delivery" \
-d name="Delivery" \
-d type="service" \
-d unit_cost=100
invoiced.Item.create(
:id => "delivery",
:name => "Delivery",
:type => "service",
:unit_cost => 100
)
<?php
$invoiced->Item->create([
'id' => "delivery",
'name' => "Delivery",
'type' => "service",
'unit_cost' => 100
]);
client.Item.create(
id="delivery",
name="Delivery",
type="service",
unit_cost=100
)
Item item = invoiced.newItem();
item.id = "delivery";
item.name = "Delivery";
item.type = "service";
item.unitCost = 100;
item.create();
var item = invoiced.NewItem();
item.Id = "delivery";
item.Name = "Delivery";
item.Type = "service";
item.UnitCost = 100;
item.Create();
item, err := client.Item.Create(&invoiced.ItemRequest{
Id: invoiced.String("delivery"),
Name: invoiced.String("Delivery"),
Type: invoiced.String("service"),
UnitCost: invoiced.Float64(100),
})
The above command returns JSON structured like this:
{
"avalara_location_code": null,
"avalara_tax_code": null,
"created_at": 1477327516,
"currency": "usd",
"description": null,
"discountable": true,
"gl_account": null,
"id": "delivery",
"metadata": [],
"name": "Delivery",
"object": "item",
"taxable": true,
"taxes": [],
"type": "service",
"unit_cost": 100,
"updated_at": 1477327516
}
Create a new item with this endpoint.
HTTP Request
POST /items
Attributes
Parameter | Type | Description |
---|---|---|
id | string | The item's unique ID. Auto-generated by default. |
name | string | Item name |
currency | string | 3-letter ISO code |
unit_cost | number | Unit cost or rate |
description | string | Optional description |
type | string | Optional line item type. Used to group line items by type in reporting |
taxable | boolean | Excludes amount from taxes when false |
avalara_tax_code | string | Avalara-specific tax code |
avalara_location_code | string | Optional Avalara location code |
gl_account | string | General ledger account code |
discountable | boolean | Excludes amount from discounts when false |
metadata | object | A hash of key/value pairs that can store additional information about this object. |
Retrieve an item
curl "https://api.invoiced.com/items/:id" \
-u {API_KEY}:
item = invoiced.Item.retrieve("{ITEM_ID}")
<?php
$item = $invoiced->Item->retrieve("{ITEM_ID}");
item = client.Item.retrieve("{ITEM_ID}")
Item item = invoiced.newItem().retrieve({ITEM_ID});
var item = invoiced.NewItem().Retrieve({ITEM_ID});
item, err := client.Item.Retrieve({ITEM_ID})
The above command returns JSON structured like this:
{
"avalara_location_code": null,
"avalara_tax_code": null,
"created_at": 1477327516,
"currency": "usd",
"description": null,
"discountable": true,
"gl_account": null,
"id": "delivery",
"metadata": [],
"name": "Delivery",
"object": "item",
"taxable": true,
"taxes": [],
"type": "service",
"unit_cost": 100,
"updated_at": 1477327516
}
This endpoint retrieves a specific item.
HTTP Request
GET /items/:id
Update an item
curl "https://api.invoiced.com/items/:id" \
-u {API_KEY}: \
-X PATCH \
-d type="product"
item.type = "product"
item.save
<?php
item->type = "product";
$item->save();
item.type = "product"
item.save()
item.type = "product";
item.save();
item.Type = "product";
item.SaveAll();
item, err := client.Item.Update({ITEM_ID}, &invoiced.ItemRequest{
Type: invoiced.String("product"),
})
The above command returns JSON structured like this:
{
"avalara_location_code": null,
"avalara_tax_code": null,
"created_at": 1477327516,
"currency": "usd",
"description": null,
"discountable": true,
"gl_account": null,
"id": "delivery",
"metadata": [],
"name": "Delivery",
"object": "item",
"taxable": true,
"taxes": [],
"type": "product",
"unit_cost": 100,
"updated_at": 1477327516
}
Use this endpoint to update an item.
The properties that can be updated via this endpoint are limited. For other updates, it is necessary to delete and recreate the item.
HTTP Request
PATCH /items/:id
Attributes
Parameter | Type | Description |
---|---|---|
name | string | Item name |
description | string | Optional description |
type | string | Optional line item type. Used to group line items by type in reporting |
metadata | object | A hash of key/value pairs that can store additional information about this object. |
Delete an item
curl "https://api.invoiced.com/items/:id" \
-u {API_KEY}: \
-X DELETE
item.delete
<?php
$item->delete();
item.delete()
item.delete();
item.Delete();
err := client.Item.Delete({ITEM_ID})
The above command returns
204 No Content
This endpoint deletes a specific item.
HTTP Request
DELETE /items/:id
List all items
curl "https://api.invoiced.com/items" \
-u {API_KEY}:
items, metadata = invoiced.Item.list(:per_page => 3)
<?php
list($items, $metadata) = $invoiced->Item->all(['per_page' => 3]);
items, metadata = client.Item.list(per_page=3)
EntityList<Item> items = conn.newItem().listAll();
var items = item.ListAll();
items, err := client.Item.ListAll(nil, nil)
The above command returns JSON structured like this:
[
{
"avalara_location_code": null,
"avalara_tax_code": null,
"created_at": 1477327516,
"currency": "usd",
"description": null,
"discountable": true,
"gl_account": null,
"id": "delivery",
"metadata": [],
"name": "Delivery",
"object": "item",
"taxable": true,
"taxes": [],
"type": "service",
"unit_cost": 100,
"updated_at": 1477327516
}
]
This endpoint retrieves all items.
HTTP Request
GET /items
Query Parameters
Parameter | Description |
---|---|
sort string | Column to sort by, i.e. name asc |
filter object | Filter object |
updated_after timestamp | Only gets records updated after the given timestamp |