Activities
Activities
Activity log for entity resources. Tracks actions like creation, updates, deletions, and custom events across all resource types. Read-only - activities are created automatically by the system.
List activities
/activitiesRetrieve a paginated list of activities for the entity. Supports filtering by resource_type, resource_id, and action. Set include_related_payments=true with resource_id to include historical Payment events linked through invoice_id, credit_note_id, or advance_invoice_id. Other filters still apply. Omitted, null, or false retains exact resource filtering; without resource_id the flag has no effect. Activities are ordered by ID descending by default.
Header parameters
Entity ID on which the request is made. Auto-selected when only one entity exists, required when multiple entities exist.
Query parameters
Number of results per request.
Default: 10
Opaque cursor to fetch the next page of results. Reuse only with the same effective ordering. Use the value from pagination.next_cursor in the previous response.
Opaque cursor to fetch the previous page of results. Reuse only with the same effective ordering. Use the value from pagination.prev_cursor in the previous response.
Whether to include the total count of items in pagination.total.
Default is true.
When false, pagination.total returns -1 for better performance.
Sort by one field or provide a repeated array for multi-column ordering. Prefix a field with - for descending order. When paginating, reuse cursors only with the same effective ordering.
JSON query object for filtering results. Supports MongoDB-style operators.
Array columns (such as an item's categories) compare as sets: a direct value asks whether the list contains it, contains takes an array and requires all of them, in matches any of them, and notIn matches none. Scalar operators such as gt do not apply and are ignored.
Supported operators:
- equals or direct value - Exact match (default)
- gte - Greater than or equal
- lte - Less than or equal
- gt - Greater than
- lt - Less than
- in - Value in array
- notIn - Value not in array
- contains - String contains (case-insensitive)
- startsWith - String starts with
- endsWith - String ends with
- between - Value between two numbers/dates [min, max]
Allowed fields: id, resource_type, resource_id, action, actor_type, created_at
Examples:
- {"total": {"gte": 1000}} - Invoices over 1000
- {"customer.name": {"contains": "Acme"}} - Customer name contains "Acme"
- {"date": {"between": ["2025-01-01", "2025-12-31"]}} - Date range
Filter by resource type (e.g., Invoice, Customer, Payment)
Filter by specific resource ID
Include Payment activities linked to resource_id within the current entity. Other filters still apply. Defaults to false; has no effect without resource_id.
Filter by action type (e.g., created, updated, deleted, sent)
import SpaceInvoices from '@spaceinvoices/js-sdk/sdk';
const sdk = new SpaceInvoices('YOUR_API_KEY');
const response = await sdk.activities.list({
limit: 20,
entity_id: "YOUR_ENTITY_ID"
});
console.log(response);Returns
{
"data": [
{
"id": "act_abc123",
"entity_id": "ent_xyz789",
"resource_type": "Invoice",
"resource_id": "inv_def456",
"action": "sent",
"actor_type": "user",
"actor_id": "usr_abc123",
"actor_label": "alex.carter@starward.example",
"details": {
"to": "procurement@horizonlaunch.example",
"subject": "Invoice #INV-2024-001"
},
"created_at": "2024-01-15T14:30:00.000Z"
},
{
"id": "act_def456",
"entity_id": "ent_xyz789",
"resource_type": "Invoice",
"resource_id": "inv_def456",
"action": "created",
"actor_type": "user",
"actor_id": "usr_abc123",
"actor_label": "alex.carter@starward.example",
"details": {},
"created_at": "2024-01-15T10:00:00.000Z"
}
],
"has_more": false,
"next_cursor": null
}