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 can 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"
phase.idIDThe ID of the associated phaseSee Phases docs
phase.codestringThe code of the associated phaseSee Phases docs
descriptionstringA description of this cost category"Material"
job.idIDThe id of the job this cost category is associated withSee Jobs docs
job.codestringThe code of the job this cost category is associated withSee Jobs docs
updatedAtDateTimeWhen this cost category was last modified"2021-03-24 17:26:46.983Z"

REST Endpoints (Global Categories)​

GET /global-categories​

Reads all global categories (without associated phase)

Parameters​

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[] objects

Example Request​

GET https://api.kojo.tech/global-categories?limit=10

Example Response​

[
{
"code": "M",
"createdAt": "2021-03-24 17:26:46.983Z",
"description": "Material",
"id": "ckmnpybixiy5y0817spfhmj78",
"updatedAt": "2021-03-24 17:26:46.983Z"
}
]

POST /global-categories​

Creates a global cost category

Parameters​

NameTypeDescriptionExample
codestringA unique human-readable code to represent this cost category"L"
descriptionstringA description of the cost category"Lighting"

Example Request​

POST https://api.kojo.tech/global-categories
{
"code": "M",
"description": "Material",
}

Response​

The created CostCategory object

Example Response​

{
"code": "M",
"createdAt": "2021-03-24 17:26:46.983Z",
"description": "Material",
"id": "ckmnpybixiy5y0817spfhmj78",
"updatedAt": "2021-03-24 17:26:46.983Z"
}

GET /global-categories/:idOrCode​

Reads a single global cost category

Parameters​

NameTypeDescriptionExample
codestringA unique human-readable code to represent this cost category"M"
idIDThe cost category ID"ckmnpybisiy5x08abky4g2d1f"

Response​

A single CostCategory object

Example Request​

GET https://api.kojo.tech/global-categories/ckmnpybisiy5x08abky4g2d1f

Example Response​

[
{
"code": "M",
"createdAt": "2021-03-24 17:26:46.983Z",
"description": "Material",
"id": "ckmnpybixiy5y0817spfhmj78",
"updatedAt": "2021-03-24 17:26:46.983Z"
}
]

PATCH /global-categories/:idOrCode​

Updates a single global cost category

Parameters​

NameTypeDescriptionExample
codestringA unique human-readable code to represent this cost category"M"
idIDThe cost category ID"ckmnpybisiy5x08abky4g2d1f"
descriptionstringThe cost category ID"Material"

Response​

A single CostCategory object

Example Request​

PATCH https://api.kojo.tech/global-categories/ckmnpybisiy5x08abky4g2d1f
{
"description": "Material",
}

Example Response​

[
{
"code": "M",
"createdAt": "2021-03-24 17:26:46.983Z",
"description": "Material",
"id": "ckmnpybixiy5y0817spfhmj78",
"updatedAt": "2021-03-29 20:26:46.983Z"
}
]

DELETE /global-categories/:id​

Deletes a single global cost category

Response​

A single CostCategory object

Example Request​

DELETE https://api.kojo.tech/global-categories/ckmnpybisiy5x08abky4g2d1f

Example Response​

[
{
"code": "M",
"createdAt": "2021-03-24 17:26:46.983Z",
"description": "Material",
"id": "ckmnpybixiy5y0817spfhmj78",
"updatedAt": "2021-03-29 20:26:46.983Z",
"deletedAt": "2021-03-29 20:26:46.983Z"
}
]

Cost cateogories related to phase codes and thus jobs are accessed via a nested URL structure which includes the associated Phase and Job information in the URL. All phase-related cost categories can be queried and filtered via the /phase-categories endpoint

GET /phase-categories​

Reads all phase-related cost categories

Parameters​

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[] objects

Example Request​

GET https://api.kojo.tech/phase-categories?limit=10

Example Response​

[
{
"code": "M",
"createdAt": "2021-03-24 17:26:46.983Z",
"description": "Material",
"id": "ckmnpybixiy5y0817spfhmj78",
"updatedAt": "2021-03-24 17:26:46.983Z"
}
]

GET /jobs/:jobIdOrCode/phases/:phaseIdOrCode/categories​

Reads all cost categories associated with the provided phase and job

Parameters​

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[] objects

Example Request​

GET https://api.kojo.tech/jobs/ckmnpybixiy5y0817spfhmj78/phases/ckmnpasdfzc5y081fasdf425da/categories

Example Response​

[
{
"code": "M",
"createdAt": "2021-03-24 17:26:46.983Z",
"description": "Material",
"id": "ckmnpybixiy5y0817spfhmj78",
"updatedAt": "2021-03-24 17:26:46.983Z"
}
]

POST /jobs/:jobIdOrCode/phases/:phaseIdOrCode/categories​

Creates a phase-related cost category.

Parameters​

NameTypeDescriptionExample
codestringA unique human-readable code to represent this cost category"L"
descriptionstringA description of the cost category"Lighting"
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"

Example Request​

POST https://api.kojo.tech/jobs/ckmnpybixiy5y0817spfhmj78/phases/ckmnpasdfzc5y081fasdf425da/categories
{
"code": "M",
"description": "Material",
}

Response​

The created CostCategory object.

Example Response​

{
"code": "M",
"createdAt": "2021-03-24 17:26:46.983Z",
"description": "Material",
"id": "ckmnpybixiy5y0817spfhmj78",
"updatedAt": "2021-03-24 17:26:46.983Z"
}

GET /jobs/:jobIdOrCode/phases/:phaseIdOrCode/categories/:categoryIdOrCode​

Reads a single cost category associated with a phase

Parameters​

NameTypeDescriptionExample
idIDThe cost category ID"ckmnpybisiy5x08abky4g2d1f"

Response​

A single CostCategory object.

Example Request​

GET https://api.kojo.tech/jobs/ckmnpybixiy5y0817spfhmj78/phases/ckmnpasdfzc5y081fasdf425da/categories/dxxnpybisiy5x08abky4g5dag

Example Response​

[
{
"code": "M",
"createdAt": "2021-03-24 17:26:46.983Z",
"description": "Material",
"id": "ckmnpybixiy5y0817spfhmj78",
"updatedAt": "2021-03-24 17:26:46.983Z"
}
]

PATCH /jobs/:jobIdOrCode/phases/:phaseIdOrCode/categories/:categoryIdOrCode​

Updates a single cost category

Parameters​

NameTypeDescriptionExample
idIDThe cost category ID"ckmnpybisiy5x08abky4g2d1f"

Response​

The updated CostCategory object.

Example Request​

PATCH https://api.kojo.tech/jobs/ckmnpybixiy5y0817spfhmj78/phases/ckmnpasdfzc5y081fasdf425da/categories/dxxnpybisiy5x08abky4g5dag
{
"description": "Material",
}

Example Response​

[
{
"code": "M",
"createdAt": "2021-03-24 17:26:46.983Z",
"description": "Material",
"id": "ckmnpybixiy5y0817spfhmj78",
"updatedAt": "2021-03-29 20:26:46.983Z"
}
]

DELETE /jobs/:jobIdOrCode/phases/:phaseIdOrCode/categories/:id​

Deletes a single cost category

Response​

The deleted CostCategory object.

Example Request​

DELETE https://api.kojo.tech/jobs/ckmnpybixiy5y0817spfhmj78/phases/ckmnpasdfzc5y081fasdf425da/categories/dxxnpybisiy5x08abky4g5dag

Example Response​

[
{
"code": "M",
"createdAt": "2021-03-24 17:26:46.983Z",
"description": "Material",
"id": "dxxnpybisiy5x08abky4g5dag",
"jobId": "ckmnpybixiy5y0817spfhmj78",
"phaseId": "ckmnpasdfzc5y081fasdf425da",
"updatedAt": "2021-03-29 20:26:46.983Z",
"deletedAt": "2021-03-29 20:26:46.983Z"
}
]

Cost cateogories related directly to jobs (and not to a phase code) are accessed via a nested URL structure which includes the associated Job information in the URL. All job-related cost categories can be queried and filtered via the /job-categories endpoint

GET /job-categories​

Reads all job-related cost categories

Parameters​

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[] objects

Example Request​

GET https://api.kojo.tech/job-categories?limit=10

Example Response​

[
{
"code": "M",
"createdAt": "2021-03-24 17:26:46.983Z",
"description": "Material",
"id": "ckmnpybixiy5y0817spfhmj78",
"updatedAt": "2021-03-24 17:26:46.983Z"
}
]

GET /jobs/:jobIdOrCode/categories​

Reads all cost categories associated with the provided job

Parameters​

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[] objects

Example Request​

GET https://api.kojo.tech/jobs/ckmnpybixiy5y0817spfhmj78/categories

Example Response​

[
{
"code": "M",
"createdAt": "2021-03-24 17:26:46.983Z",
"description": "Material",
"id": "ckmnpybixiy5y0817spfhmj78",
"updatedAt": "2021-03-24 17:26:46.983Z"
}
]

POST /jobs/:jobIdOrCode/categories​

Creates a job-related cost category.

Parameters​

NameTypeDescriptionExample
codestringA unique human-readable code to represent this cost category"L"
descriptionstringA description of the cost category"Lighting"

Example Request​

POST https://api.kojo.tech/jobs/ckmnpybixiy5y0817spfhmj78/categories
{
"code": "M",
"description": "Material",
}

Response​

The created CostCategory object.

Example Response​

{
"code": "M",
"createdAt": "2021-03-24 17:26:46.983Z",
"description": "Material",
"id": "ckmnpybixiy5y0817spfhmj78",
"updatedAt": "2021-03-24 17:26:46.983Z"
}

GET /jobs/:jobIdOrCode/categories/:categoryIdOrCode​

Reads a single cost category associated with a job

Parameters​

NameTypeDescriptionExample
idIDThe cost category ID"ckmnpybisiy5x08abky4g2d1f"

Response​

A single CostCategory object.

Example Request​

GET https://api.kojo.tech/jobs/ckmnpybixiy5y0817spfhmj78/categories/dxxnpybisiy5x08abky4g5dag

Example Response​

[
{
"code": "M",
"createdAt": "2021-03-24 17:26:46.983Z",
"description": "Material",
"id": "ckmnpybixiy5y0817spfhmj78",
"updatedAt": "2021-03-24 17:26:46.983Z"
}
]

PATCH /jobs/:jobIdOrCode/categories/:categoryIdOrCode​

Updates a single cost category associated with a job

Parameters​

NameTypeDescriptionExample
descriptionstringThe cost category ID"Material"

Response​

The updated CostCategory object.

Example Request​

PATCH https://api.kojo.tech/jobs/ckmnpybixiy5y0817spfhmj78/categories/dxxnpybisiy5x08abky4g5dag
{
"description": "Material",
}

Example Response​

[
{
"code": "M",
"createdAt": "2021-03-24 17:26:46.983Z",
"description": "Material",
"id": "dxxnpybisiy5x08abky4g5dag",
"jobId": "ckmnpybixiy5y0817spfhmj78",
"updatedAt": "2021-03-29 20:26:46.983Z"
}
]

DELETE /jobs/:jobIdOrCode/categories/:id​

Deletes a single cost category associated with a job

Response​

The deleted CostCategory object.

Example Request​

DELETE https://api.kojo.tech/jobs/ckmnpybixiy5y0817spfhmj78/categories/dxxnpybisiy5x08abky4g5dag

Example Response​

[
{
"code": "M",
"createdAt": "2021-03-24 17:26:46.983Z",
"description": "Material",
"id": "ckmnpybixiy5y0817spfhmj78",
"jobId": "ckmnpybixiy5y0817spfhmj78",
"updatedAt": "2021-03-29 20:26:46.983Z",
"deletedAt": "2021-03-29 20:26:46.983Z"
}
]