Skip to main content

Products and Services

Products and Services (also called line items) store the catalog entries that appear anywhere you choose items on invoices, quotes, or subscriptions. Each record captures the descriptive text, price, preferred revenue account, and optional analytics so your teams and integrations can reuse the same configuration instead of retyping details on every document.

Prerequisites

  • A Naqood API secret or OAuth-issued secret scoped to the target organization
  • The organization slug on every query or mutation
  • A role with permission to manage products and services

Line item fields

LineItem objects expose the following fields when queried directly or through lists:

FieldTypeNotes
idID!Stable identifier used with mutations.
nameString!Display name shown on invoices and quotes.
codeStringOptional SKU or product code.
quantityString!Default quantity suggested when the item is inserted (usually 1).
unitString!Text label for the quantity (for example hour, pcs).
unitPriceString!Sales price per unit in the organization currency.
costPriceStringOptional internal cost per unit.
commentStringExtra description rendered beneath the line on documents.
accountIdID!Revenue or liability account that will be credited by default.
archivedBoolean!Hides the record from pickers without deleting it.
isDeletableBooleanfalse when the item is already referenced on invoices/subscriptions.
quantitySoldStringPresent when using aggregate queries; total units on sent invoices.
valueSoldStringPresent when using aggregate queries; total recognized revenue.
createdAtTimestampRecord creation timestamp.
updatedAtTimestampLast update timestamp.

Fetch a line item

Retrieve one catalog entry when you know its ID:

query LineItem($lineItemID: ID!) {
lineItem(lineItemID: $lineItemID) {
id
name
code
unit
unitPrice
quantity
costPrice
comment
archived
accountId
isDeletable
quantitySold
valueSold
}
}

List catalog items

List or search items within an organization. Pagination, ordering, and filters use the standard operators (equalTo, notEqualTo, greaterThan, lessThanOrEqualTo, in, and boolean and/or).

query LineItems(
$slug: Slug!
$offset: Int
$limit: Int
$orderBy: OrderByInput
$filter: JSONObject
) {
organization(slug: $slug) {
lineItems(
offset: $offset
limit: $limit
orderBy: $orderBy
filter: $filter
) {
count
entries
}
}
}

entries contains an array of LineItem objects, so you can project only the fields you need on the client side.

Create a line item

mutation CreateLineItem($input: CreateLineItemInput!) {
createLineItem(input: $input) {
id
name
unit
unitPrice
}
}

Key CreateLineItemInput properties:

FieldRequiredNotes
slugOrganization identifier tied to your API secret.
nameDisplay name customers will see.
codeOptionalHelpful SKU or internal reference.
quantityDefault quantity suggested when inserting the item.
unitSingular label for the quantity (for example hour).
unitPriceDecimal string in the organization currency.
costPriceOptionalTrack the cost side for margin reporting.
commentOptionalExtra descriptive text rendered under the line.
accountIdRevenue account that will be credited when the item is used.

Example variables:

{
"input": {
"slug": "acme-co",
"name": "Consulting hours",
"code": "CONS-001",
"quantity": "1",
"unit": "hour",
"unitPrice": "650.00",
"costPrice": "400.00",
"comment": "Includes travel within Dubai",
"accountId": "87da1ad4-6f0a-40dc-a8ba-98abbfb59de6"
}
}

Update a line item

mutation UpdateLineItem($input: UpdateLineItemInput!) {
updateLineItem(input: $input) {
id
name
unitPrice
costPrice
accountId
updatedAt
}
}

Provide the id plus the fields you want to change. Fields you leave out remain unchanged, so you can update price lists, rename items, or reassign revenue accounts incrementally.

Archive or delete

  • Archive: archiveLineItem(lineItemID: ID!) hides the catalog entry from selection menus while preserving its history. Use this when an item is temporarily unavailable.
  • Restore: unarchiveLineItem(lineItemID: ID!) makes an archived item selectable again.
  • Delete: deleteLineItem(lineItemID: ID!) permanently removes a record that has never been used on an invoice or subscription. Check the isDeletable flag first to confirm the item has no dependencies.