Skip to main content

Cost Categories

Cost Categories are used to breakdown purchase order costs into different categories (i.e. Material, Labor, etc). Cost Categories are defined per-phase for phase codes related to jobs. They can also be defined per-job or globally for the organization.

Schema​

Cost Category​

NameTypeDescriptionExample
idIDThe unique ID"ckmnpybisiy5x08abky4g2d1f"
createdAtDateTimeWhen this cost category was created"2021-03-24 17:26:46.983Z"
codestringThe human-readable code to identify this cost category"M"
phasePhaseAssociated phase codeSee Phases docs
descriptionstringA description of this cost category"Material"
jobJobThe job this cost category is associated withSee Jobs docs
updatedAtDateTimeWhen this cost category was last modified"2021-03-24 17:26:46.983Z"

Queries​

costCategory​

Read a single cost category.

Parameters​

For global cost categories, a code or id must be specified.
For phase-related cost categories, a cost category code can only be used alongside a phase id, a phase code and job code, or a phase code and job id.
For job-related cost categories, a cost category code can only be used alongside a job code or job id.

NameTypeDescriptionExample
codestringA unique human-readable code to represent this cost cateogry"M"
descriptionstringA description of the cost category"Material"
phaseCodestringThe code of the phase this cost category is linked to"01-300"
phaseIdIDThe ID of the phase this cost category is linked to"ckmnpybisiy5x08abky4g2d1f"
jobCodestringThe code of the job this cost category is linked to"01-300"
jobIdIDThe ID of the job this cost category is linked to"ckmnpybisiy5x08abky4g2d1f"
idIDThe cost category ID"ckmnpybisiy5x08abky4g2d1f"

Response​

A single CostCategory.

Example Query (Global)​

query {
costCategory(code: "M") {
code
description
id
}
}

Example Response (Global)​

{
"code": "M",
"description": "Material",
"id": "ckmnpybisiy5x08abky4g2d1f"
}
query {
costCategory(code: "M", phaseId: "5dgapybifdsvxsdg4ky4g25xz") {
code
description
id
phase {
id
}
}
}
{
"code": "M",
"description": "Material",
"id": "ckmnpybisiy5x08abky4g2d1f",
"phase": {
"id": "5dgapybifdsvxsdg4ky4g25xz"
}
}

costCategories​

Reads a list of cost categories

Parameters​

If no phase or job information is provided, global cost categories are returned.
If phase information is provided, phase-related cost categories are returned.
If only job information is provided, job-related cost categories are returned.

NameTypeDescriptionExample
codestringA unique human-readable code to represent this cost cateogry"M"
descriptionstringA description of the cost category"Material"
phaseCodestringThe code of the phase this cost category is linked to"01-300"
phaseIdIDThe ID of the phase this cost category is linked to"ckmnpybisiy5x08abky4g2d1f"
jobCodestringThe code of the job this cost category is linked to"01-300"
jobIdIDThe ID of the job this cost category is linked to"ckmnpybisiy5x08abky4g2d1f"
idIDThe cost category ID"ckmnpybisiy5x08abky4g2d1f"

Accepts all standard pagination parameters.

Allowed orderBy fields: code, createdAt, description, id, updatedAt.

Allowed filter fields: code, createdAt, description, id, updatedAt.

Response​

A list of CostCategory[].

Example Query (Global)​

query {
costCategories() {
code
description
id
}
}

Example Response (Global)​

[
{
"code": "M",
"description": "Material",
"id": "ckmnpybisiy5x08abky4g2d1f"
},
{
"code": "L",
"description": "Labor",
"id": "234faybis20983phasfg2dgzx"
}
]
query {
costCategories(phaseId: "ckmnpybisiy5x08abky4g2d1f") {
code
description
id
phase {
id
}
}
}
[
{
"code": "M",
"description": "Material",
"id": "144dpybisiy52dgabky4g2dxz",
"phase": {
"id": "ckmnpybisiy5x08abky4g2d1f"
}
}
]
query {
costCategories(jobId: "ckmnpybisiy5x08abky4g2d1f") {
code
description
id
job {
id
}
}
}
[
{
"code": "M",
"description": "Material",
"id": "144dpybisiy52dgabky4g2dxz",
"job": {
"id": "ckmnpybisiy5x08abky4g2d1f"
}
}
]

phaseCostCategories​

Reads a list of all phase-related cost categories

Response​

A list of CostCategory[].

Example Query​

query {
phaseCostCategories {
code
description
id
phase {
id
}
}
}

Example Response​

[
{
"code": "M",
"description": "Material",
"id": "144dpybisiy52dgabky4g2dxz",
"phase": {
"id": "ckmnpybisiy5x08abky4g2d1f"
}
},
{
"code": "L",
"description": "Labor",
"id": "ckxot4jmt4256mqtcyrgfrl9y",
"phase": {
"id": "ckxot4jq74404mqtct51649rt"
}
},
]

jobCostCategories​

Reads a list of all job-related cost categories

Response​

A list of CostCategory[].

Example Query​

query {
jobCostCategories {
code
description
id
job {
id
}
}
}

Example Response​

[
{
"code": "M",
"description": "Material",
"id": "144dpybisiy52dgabky4g2dxz",
"job": {
"id": "ckmnpybisiy5x08abky4g2d1f"
}
},
{
"code": "L",
"description": "Labor",
"id": "ckxot4jmt4256mqtcyrgfrl9y",
"job": {
"id": "ckxot4jq74404mqtct51649rt"
}
},
]

createCostCategory​

Read a cost category.

Parameters​

For global cost categories, the phase id is left out.
To create a phase-related cost category, a phase id must be provided, or a phase code along with either a job code or job id.
To create a job-related cost category, a job code or job id must be provided.

NameTypeDescriptionExample
codestringA unique human-readable code to represent this cost cateogry"M"
descriptionstringA description of the cost category"Material"
phaseCodestringThe code of the phase this cost category is linked to"01-300"
phaseIdIDThe ID of the phase this cost category is linked to"ckmnpybisiy5x08abky4g2d1f"
jobCodestringThe code of the job this cost category is linked to"01-300"
jobIdIDThe ID of the job this cost category is linked to"ckmnpybisiy5x08abky4g2d1f"
idIDThe cost category ID"ckmnpybisiy5x08abky4g2d1f"

Response​

The created CostCategory.

Example Query​

mutation {
createCostCategory(code: "M", description: "Material", phaseId: "ckmnpybisiy5x08abky4g2d1f") {
code
description
id
}
}

Example Response​

{
"code": "M",
"description": "Material",
"id": "ckmnpybisiy5x08abky4g2d1f"
}

updateCostCategory​

Update the description of a cost category.

Parameters​

Any cost category can be updated by providing the id.
The different types of cost categories can also be updated by providing the information below.
A global cost category can be updated by provide just the code.
A phase-related cost category can be updated by providing the code along with a phase id, or a phase code and job code.
A job-related cost category can be updated by providing a code along with a job code or job id.

NameTypeDescriptionExample
codestringA unique human-readable code to represent this cost cateogry"M"
descriptionstringA description of the cost category"Material"
phaseCodestringThe code of the phase this cost category is linked to"01-300"
phaseIdIDThe ID of the phase this cost category is linked to"ckmnpybisiy5x08abky4g2d1f"
jobCodestringThe code of the job this cost category is linked to"01-300"
jobIdIDThe ID of the job this cost category is linked to"ckmnpybisiy5x08abky4g2d1f"
idIDThe cost category ID"ckmnpybisiy5x08abky4g2d1f"

Response​

The updated CostCategory.

Example Query​

mutation {
updateCostCategory(code: "M", description: "Material", phaseId: "ckmnpybisiy5x08abky4g2d1f") {
code
description
id
}
}

Example Response​

{
"code": "M",
"description": "Material",
"id": "ckmnpybisiy5x08abky4g2d1f"
}