Concepts

Objects

An object is any piece of content in your space — a page, weblink, tag, daily note instance, or custom type. The primary representation is returned by GET /object.

Response shape

FieldDescription
idObject UUID
structureIdStructure / type id (see Structures)
collectionsUUIDs of collections (databases) this object is assigned to
propertiesMap of property definition id → typed value (see Properties)
blocksOptional map of property id → block content
filesOptional signed download URLs for media types
mediaContentOptional OCR text and colors for images when analysis is complete

Example (abbreviated):

{
  "id": "7d2e7f8a-4c3b-4e1d-9f0a-123456789abc",
  "structureId": "4ba6e5c6-3f31-45f2-93a0-27a8b2d91551",
  "collections": ["9f20f3d7-7df6-4b4a-8f82-123456789abc"],
  "properties": {
    "title": { "type": "title", "title": { "value": "Example" } }
  },
  "blocks": {
    "content": [
      {
        "id": "b1111111-1111-4111-8111-111111111111",
        "type": "TextBlock",
        "tokens": [{ "type": "TextToken", "text": "Hello", "style": {} }],
        "blocks": [],
        "hierarchy": { "key": "Base", "val": 0 }
      }
    ]
  }
}

Collections

Collections are Capacities databases that group objects of a structure. On read, collections lists the collection ids the object currently belongs to.

When creating or updating:

  • Pass specific collection ids to assign the object to those databases.
  • Pass collections: [] to move the object back to its default database for that structure (when the structure supports collections).
  • Omit collections on create to use default placement behavior.

Only structures that support collections accept collections on POST /object and PATCH /object. Others ignore or reject collection changes.

CRUD overview

OperationEndpointRequired scope
ReadGET /object?id=…api:read
CreatePOST /objectapi:write
UpdatePATCH /objectapi:write
DeleteDELETE /object?id=…api:write
Create from URLPOST /object/urlapi:write
Export MarkdownGET /object/markdown?id=…api:read
Create from MarkdownPOST /object/markdownapi:write

Patch requires at least one of properties or collections. Delete supports hardDelete=true to permanently remove an object instead of moving it to trash.

To create or export body content as Markdown instead of block trees, see Markdown.

Listing objects

Beyond fetching a single object with GET /object, three endpoints return pages of object summaries — the same lightweight { id, structureId, title } shape used by search:

EndpointLists objects…Required scope
GET /objects/structure?id=……of a given structure (object type)api:read
GET /objects/tag?id=……that have a given tagapi:read
GET /objects/collection?id=……assigned to a given collection (database)api:read

Each is cursor-paginated and accepts:

Query paramDescription
idStructure, tag, or collection id to filter by — required
pageSizeResults per page. Defaults to 100, maximum 100
cursorOpaque cursor from the previous page's nextCursor. Omit to fetch the first page

Response shape:

{
  "results": [
    { "id": "7d2e7f8a-4c3b-4e1d-9f0a-123456789abc", "structureId": "RootPage", "title": "Project Alpha" }
  ],
  "nextCursor": "9f20f3d7-7df6-4b4a-8f82-123456789abc",
  "hasMore": true
}
FieldDescription
resultsObject summaries for this page
nextCursorPass as cursor to fetch the next page. null on the last page
hasMoretrue if another page is available

Keep fetching while hasMore is true:

import { CapacitiesClient } from '@capacities/api'

const capacities = new CapacitiesClient({ apiToken: 'cap-api-…' })

let cursor: string | undefined
const allResults = []

do {
  const page = await capacities.objects.structure({
    structureId: 'RootPage',
    cursor,
    pageSize: 100,
  })
  allResults.push(...page.results)
  cursor = page.hasMore ? (page.nextCursor ?? undefined) : undefined
} while (cursor)

The same loop applies to capacities.objects.tag({ tagId }) and capacities.objects.collection({ collectionId }). Each endpoint has its own rate limit — see Rate Limiting.

Looking for objects by title instead of by structure, tag, or collection? Use POST /objects/search (capacities.objects.search) — it's relevance-ordered and returns a single page (no cursor).

Media analysis (mediaContent)

For images (MediaImage), GET /object may include mediaContent when AI analysis is complete (mediaContentState is full):

FieldDescription
ocr.textText extracted from the image
colorsDominant colors (name, hex)

Other media types and fields (audio, weblinks, categories, etc.) are not exposed yet. While analysis is still running or failed, mediaContent is omitted.

Are you missing something in the documentation?

Create a ticket on our feedback board. - Let us know if you have an idea for a feature, improvement or think there is something missing.

Request additions to the documentation. - If your questions are not getting answered, let us know and we will extend the documentation.