Skip to content

Financial Categories

The Financial Category object

object

Attributes

idstring
Other attributes
entity_idstring
namestring
colorstringnullable
sort_orderinteger
archived_atstring<date-time>nullable
created_atstring<date-time>
updated_atstring<date-time>

Create a financial category

POST/financial-categories

Create a financial category

Header parameters

entity_idstringoptional

Entity ID on which the request is made. Auto-selected when only one entity exists, required when multiple entities exist.

Body parameters

namestringrequired
Other parameters
colorstringoptionalnullable
sort_orderintegeroptionalnullable
import SpaceInvoices from '@spaceinvoices/js-sdk';

const sdk = new SpaceInvoices('YOUR_API_KEY');

const response = await sdk.financialCategories.create({
  name: "Mission services",
  color: "#93c5fd",
  sort_order: 0
});

console.log(response);
Example:

Returns

idstring
Other parameters
entity_idstring
namestring
colorstringnullable
sort_orderinteger
archived_atstring<date-time>nullable
created_atstring<date-time>
updated_atstring<date-time>
json
{
  "id": "fcat_abc123",
  "entity_id": "ent_abc123",
  "name": "Mission services",
  "color": "#93c5fd",
  "sort_order": 0,
  "archived_at": null,
  "created_at": "2026-04-15T10:00:00.000Z",
  "updated_at": "2026-04-15T10:00:00.000Z"
}

List financial categories

GET/financial-categories

List financial categories

Header parameters

entity_idstringoptional

Entity ID on which the request is made. Auto-selected when only one entity exists, required when multiple entities exist.

Query parameters

include_archivedbooleanoptional
import SpaceInvoices from '@spaceinvoices/js-sdk';

const sdk = new SpaceInvoices('YOUR_API_KEY');

const response = await sdk.financialCategories.list();

console.log(response);

Returns

dataarray of objects
json
{
  "data": [
    {
      "id": "fcat_abc123",
      "entity_id": "ent_abc123",
      "name": "Mission services",
      "color": "#93c5fd",
      "sort_order": 0,
      "archived_at": null,
      "created_at": "2026-04-15T10:00:00.000Z",
      "updated_at": "2026-04-15T10:00:00.000Z"
    }
  ]
}

Get accrued revenue grouped by financial category

GET/financial-categories/revenue-summary

Get accrued revenue grouped by financial category

Header parameters

entity_idstringoptional

Entity ID on which the request is made. Auto-selected when only one entity exists, required when multiple entities exist.

Query parameters

date_fromstringrequired

Start date filter (ISO 8601 date).

date_tostringrequired

End date filter (ISO 8601 date).

import SpaceInvoices from '@spaceinvoices/js-sdk';

const sdk = new SpaceInvoices('YOUR_API_KEY');

const response = await sdk.financialCategories.getRevenueByFinancialCategory({
  date_from: "2026-01-01",
  date_to: "2026-12-31"
});

console.log(response);

Returns

dataarray of objects
Other parameters
totalnumber
currency_codestring
date_fromstring
date_tostring
json
{
  "data": [
    {
      "financial_category_id": "fcat_abc123",
      "name": "Mission services",
      "color": "#93c5fd",
      "amount": 12000,
      "percentage": 75,
      "currency_code": "EUR"
    },
    {
      "financial_category_id": null,
      "name": "Uncategorized",
      "color": null,
      "amount": 4000,
      "percentage": 25,
      "currency_code": "EUR"
    }
  ],
  "total": 16000,
  "currency_code": "EUR",
  "date_from": "2026-01-01",
  "date_to": "2026-12-31"
}

Update a financial category

PATCH/financial-categories/{id}

Update a financial category

Header parameters

entity_idstringoptional

Entity ID on which the request is made. Auto-selected when only one entity exists, required when multiple entities exist.

Path parameters

idstring<resource-id>required

Unique resource identifier

Body parameters

namestringoptionalnullable
colorstringoptionalnullable
sort_orderintegeroptionalnullable
import SpaceInvoices from '@spaceinvoices/js-sdk';

const sdk = new SpaceInvoices('YOUR_API_KEY');

const response = await sdk.financialCategories.update("inv_6595a27b5d35015c3ef0c3fd", {
  name: "Mission services retainer",
  color: "#60a5fa"
});

console.log(response);

Returns

idstring
Other parameters
entity_idstring
namestring
colorstringnullable
sort_orderinteger
archived_atstring<date-time>nullable
created_atstring<date-time>
updated_atstring<date-time>
json
{
  "id": "fcat_abc123",
  "entity_id": "ent_abc123",
  "name": "Mission services retainer",
  "color": "#60a5fa",
  "sort_order": 0,
  "archived_at": null,
  "created_at": "2026-04-15T10:00:00.000Z",
  "updated_at": "2026-04-15T12:00:00.000Z"
}

Atomically update saved categories for multiple document line items

PATCH/financial-categories/document-items/batch

Atomically update saved categories for multiple document line items

Header parameters

entity_idstringoptional

Entity ID on which the request is made. Auto-selected when only one entity exists, required when multiple entities exist.

Body parameters

assignmentsarray of objectsrequired

Atomic batch of saved document line category updates.

import SpaceInvoices from '@spaceinvoices/js-sdk';

const sdk = new SpaceInvoices('YOUR_API_KEY');

const response = await sdk.financialCategories.updateDocumentItemFinancialCategories({
  assignments: [
    {
      id: "item_abc123",
      financial_category_id: "fcat_abc123"
    },
    {
      id: "item_def456",
      financial_category_id: null
    }
  ]
});

console.log(response);
Example:
json
[
  {
    "document_item_id": "item_abc123",
    "financial_category_id": "fcat_abc123"
  },
  {
    "document_item_id": "item_def456",
    "financial_category_id": null
  }
]

Update the saved category for a document line item

PATCH/financial-categories/document-items/{id}

Update the saved category for a document line item

Header parameters

entity_idstringoptional

Entity ID on which the request is made. Auto-selected when only one entity exists, required when multiple entities exist.

Path parameters

idstring<resource-id>required

Unique resource identifier

Body parameters

financial_category_idstringrequirednullable

Category to assign to this saved document line. Use null to explicitly mark the line as uncategorized.

import SpaceInvoices from '@spaceinvoices/js-sdk';

const sdk = new SpaceInvoices('YOUR_API_KEY');

const response = await sdk.financialCategories.updateDocumentItemFinancialCategory("inv_6595a27b5d35015c3ef0c3fd", {
  financial_category_id: "fcat_abc123"
});

console.log(response);
Example:

Returns

document_item_idstring
financial_category_idstringnullable
json
{
  "document_item_id": "item_abc123",
  "financial_category_id": "fcat_abc123"
}

Archive a financial category

DELETE/financial-categories/{id}

Archive a financial category

Header parameters

entity_idstringoptional

Entity ID on which the request is made. Auto-selected when only one entity exists, required when multiple entities exist.

Path parameters

idstring<resource-id>required

Unique resource identifier

import SpaceInvoices from '@spaceinvoices/js-sdk';

const sdk = new SpaceInvoices('YOUR_API_KEY');

await sdk.financialCategories.delete("inv_6595a27b5d35015c3ef0c3fd");

console.log('Deleted successfully');