Skip to content

Get a client company's services

GET
/clients/{id}/services
Code sample: Shell / cURL
curl --request GET \
--url https://example.com/api/v1/clients/example/services \
--header 'Authorization: Bearer <token>'

Returns the services of the company: billed, the services its sent invoices bill (never drafts or cancelled invoices), each with its invoice count, the issue dates of its first and last invoice and status, latest first; liveOrders, the open orders inside the caller’s order reach that are not invoiced yet or that billed does not cover, sent only to a caller with orders.view while the Orders module is on; linesWithoutService, how many charged lines of sent invoices name no service; and manual, the services the team provides without invoicing, added by hand with POST /clients/{id}/services, oldest first. A service is ACTIVE while an open order (active or out of hours) or a billed subscription not cancelled names it, while an open order naming no service is tied to one of its invoice lines, or while the period invoiced on a line with no order or subscription of its own has not ended in the workspace timezone, unless the invoice’s order has closed and was the one providing the service; otherwise it is PAST. Without orders.view or with the Orders module off, status stays and activeSource, subscriptionStatus and activeUntil report only an invoiced period. Requires the clients.view and invoices.view permissions, a client company inside the caller’s assignments (or clients.view_all) and, for the billed part, inside the caller’s invoice reach (or invoices.view_all); anything else out of reach answers 404.

id
required

Resource identifier (CUID2).

string
>= 1 characters

Resource identifier (CUID2).

The company’s billed and hand-added services.

Media typeapplication/json
object
data
required

The services of a company: those it is invoiced for and those added by hand.

object
billed
required

Services the company was invoiced for, latest invoice first.

Array<object>

A service a company was invoiced for, read from its sent invoices.

object
activeSource

What keeps the service active; null when it is past. Without orders.view, with the Orders module off, or when the order behind it is out of the caller’s reach, only INVOICE_PERIOD is returned. Absent on a server older than the field.

Any of:
string
Allowed values: SUBSCRIPTION ORDER INVOICE_PERIOD
activeUntil

When what keeps the service active ends: the last instant of the period its subscription cancels at, or the last invoiced day. Null when nothing says it ends; a caller who cannot read the order behind it gets only the last invoiced day. Absent on a server older than the field.

Any of:
string format: date-time
/^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$/
firstBilledAt
required

Issue date of the first invoice.

string format: date-time
/^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$/
invoiceCount
required

Sent invoices, never drafts or cancelled ones, that bill the service.

integer
>= -9007199254740991 <= 9007199254740991
isRecurring
required
boolean
lastBilledAt
required

Issue date of the latest invoice.

string format: date-time
/^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$/
name
required
string
serviceId
required
string
status

ACTIVE while an open order or a billed subscription not cancelled names the service, while an open order naming no service is tied to a line of it, or while the period invoiced on a line with no order or subscription of its own has not ended, unless the invoice’s order has closed and was the one providing the service; PAST otherwise. Absent on a server older than the field.

string
Allowed values: ACTIVE PAST
subscriptionStatus

The status of the billed subscription backing the service; null when the caller cannot read the order behind it. Absent on a server older than the field.

Any of:
string
Allowed values: ACTIVE PAST_DUE SUSPENDED PAUSED
linesWithoutService

Charged lines of sent invoices, discounts left out, that name no service directly or through their order, so no entry of billed counts them. Absent on a server older than the field.

integer
>= -9007199254740991 <= 9007199254740991
liveOrders

Open orders the caller reaches that billed does not cover, newest first. Absent without the orders.view permission, with the Orders module off, and on a server older than the field.

Array<object>

An open order, with its live subscription if any, that billed does not cover: it has no sent invoice yet, one of its services was never invoiced to the company, or it names no service.

object
activeUntil
required

The last instant of the period its subscription cancels at, if it is cancelling.

Any of:
string format: date-time
/^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$/
invoiceCount
required

Sent invoices tied to the order or its subscription; 0 when not invoiced yet.

integer
>= -9007199254740991 <= 9007199254740991
isNonBillable
required

Whether the order runs on a behavior that is never invoiced.

boolean
name
required

The order’s name.

string
orderId
required
string
serviceIds
required
Array<string>
serviceNames
required

The services it provides, in the order of serviceIds; empty when it names none.

Array<string>
subscriptionStatus
required

The status of its billed subscription; null when it has no live one.

Any of:
string
Allowed values: ACTIVE PAST_DUE SUSPENDED PAUSED
manual
required

Services added by hand, oldest first.

Array<object>

A service the team provides a company without invoicing it, added by hand.

object
createdAt
required
string format: date-time
/^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$/
id
required
string
name
required
string
note
required
string | null

Example

{
"data": {
"billed": [
{
"activeSource": "SUBSCRIPTION",
"status": "ACTIVE",
"subscriptionStatus": "ACTIVE"
}
],
"liveOrders": [
{
"subscriptionStatus": "ACTIVE"
}
]
}
}

Unauthorized.

Media typeapplication/json

Standard error envelope.

object
error
required
object
code
required

Stable machine-readable error code.

string
message
required

Human-readable error message.

string
status
required

HTTP status code, mirrored in the body.

integer
>= -9007199254740991 <= 9007199254740991

Example

{
"error": {
"code": "UNAUTHORIZED"
}
}

Forbidden.

Media typeapplication/json

Standard error envelope.

object
error
required
object
code
required

Stable machine-readable error code.

string
message
required

Human-readable error message.

string
status
required

HTTP status code, mirrored in the body.

integer
>= -9007199254740991 <= 9007199254740991

Example

{
"error": {
"code": "UNAUTHORIZED"
}
}

Not found.

Media typeapplication/json

Standard error envelope.

object
error
required
object
code
required

Stable machine-readable error code.

string
message
required

Human-readable error message.

string
status
required

HTTP status code, mirrored in the body.

integer
>= -9007199254740991 <= 9007199254740991

Example

{
"error": {
"code": "UNAUTHORIZED"
}
}

Rate limit exceeded. Wait for Retry-After before retrying.

Media typeapplication/json

Standard error envelope.

object
error
required
object
code
required

Stable machine-readable error code.

string
message
required

Human-readable error message.

string
status
required

HTTP status code, mirrored in the body.

integer
>= -9007199254740991 <= 9007199254740991

Example

{
"error": {
"code": "UNAUTHORIZED"
}
}
RateLimit-Limit
string
/^\d+$/

Maximum requests in the current quota window.

RateLimit-Policy
string

Quota policy in requests and window seconds, for example 60;w=60.

RateLimit-Remaining
string
/^\d+$/

Requests left in this quota window (zero when blocked).

RateLimit-Reset
string
/^\d+$/

Seconds until the current quota window resets, when available from the rate-limit store.

Retry-After
string
/^\d+$/

Seconds until another request may be attempted.