# Prism ## Domain Types ### Prism Object Properties - `PrismObjectProperties` - `default?: Record` Properties keyed by property slug. Values can be strings, numbers, booleans, arrays, or null. For select/multiselect properties, values may be option slugs or option UUIDs on write; option slugs are returned on read. - `list?: unknown` # Properties ## Get metadata properties by object type `client.prism.properties.list("deal" | "identity" | "ai_chat_thread" | 6 moreobjectType, PropertyListParamsparams?, RequestOptionsoptions?): PropertyListResponse` **get** `/v2/prism/{teamId}/{objectType}/properties` Get metadata properties by object type ### Parameters - `objectType: "deal" | "identity" | "ai_chat_thread" | 6 more` - `"deal"` - `"identity"` - `"ai_chat_thread"` - `"ai_chat_message"` - `"document"` - `"action"` - `"event"` - `"organization"` - `"contact"` - `params: PropertyListParams` - `teamId?: string` Path param - `autofill?: boolean` Query param - `list_id?: string` Query param: Scope properties to a specific list/app. - `term?: string` Query param ### Returns - `PropertyListResponse = Record` Property definitions keyed by object type, then by property definition id (UUID). When the request scopes to a single object type, only that key is present. ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); const properties = await client.prism.properties.list('deal'); console.log(properties); ``` #### Response ```json { "foo": {} } ``` ## Get metadata properties `client.prism.properties.listAll(PropertyListAllParamsparams?, RequestOptionsoptions?): PropertyListAllResponse` **get** `/v2/prism/{teamId}/properties` Get metadata properties ### Parameters - `params: PropertyListAllParams` - `teamId?: string` Path param - `autofill?: boolean` Query param - `list_id?: string` Query param: Scope properties to a specific list/app. - `term?: string` Query param ### Returns - `PropertyListAllResponse = Record` Property definitions keyed by object type, then by property definition id (UUID). When the request scopes to a single object type, only that key is present. ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); const response = await client.prism.properties.listAll(); console.log(response); ``` #### Response ```json { "foo": {} } ``` ## Domain Types ### Property List Response - `PropertyListResponse = Record` Property definitions keyed by object type, then by property definition id (UUID). When the request scopes to a single object type, only that key is present. ### Property List All Response - `PropertyListAllResponse = Record` Property definitions keyed by object type, then by property definition id (UUID). When the request scopes to a single object type, only that key is present. # Imports ## Get the status of an import job `client.prism.imports.get(stringjobID, ImportGetParamsparams?, RequestOptionsoptions?): ImportGetResponse` **get** `/v2/prism/{teamId}/imports/{jobId}` Poll the status of an async import. Sync imports complete in the original response and don't appear here. Async jobs are retained for 7 days. Returns 404 once the job has expired. ### Parameters - `jobID: string` - `params: ImportGetParams` - `teamId?: string` ### Returns - `ImportGetResponse` Status snapshot of an import job. Same shape used by the POST /import response and by GET /imports/{jobId}. - `job_id: string | null` Null for sync imports (results inlined). Set for async imports. - `status: "complete" | "processing" | "failed"` - `"complete"` - `"processing"` - `"failed"` - `total: number` Total number of rows in the import. - `created_at?: string` - `error?: Error` Set when status=failed; describes the job-level failure (not per-row). - `code?: string` - `message?: string` - `expires_at?: string` - `failed?: number` - `processed?: number` Rows that have been attempted (succeeded + failed). - `results?: Array` Per-row outcomes. Always present for sync imports; populated for async imports once the job reaches `complete`. - `id?: string | null` - `created?: boolean` - `error?: Error` - `code?: string` - `message?: string` - `existing?: boolean` True if the row matched an existing record via the dedupe key. - `succeeded?: number` - `updated_at?: string` ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); const _import = await client.prism.imports.get('jobId'); console.log(_import.job_id); ``` #### Response ```json { "job_id": "job_id", "status": "complete", "total": 0, "created_at": "2019-12-27T18:11:19.117Z", "error": { "code": "code", "message": "message" }, "expires_at": "2019-12-27T18:11:19.117Z", "failed": 0, "processed": 0, "results": [ { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "created": true, "error": { "code": "code", "message": "message" }, "existing": true } ], "succeeded": 0, "updated_at": "2019-12-27T18:11:19.117Z" } ``` ## Domain Types ### Import Get Response - `ImportGetResponse` Status snapshot of an import job. Same shape used by the POST /import response and by GET /imports/{jobId}. - `job_id: string | null` Null for sync imports (results inlined). Set for async imports. - `status: "complete" | "processing" | "failed"` - `"complete"` - `"processing"` - `"failed"` - `total: number` Total number of rows in the import. - `created_at?: string` - `error?: Error` Set when status=failed; describes the job-level failure (not per-row). - `code?: string` - `message?: string` - `expires_at?: string` - `failed?: number` - `processed?: number` Rows that have been attempted (succeeded + failed). - `results?: Array` Per-row outcomes. Always present for sync imports; populated for async imports once the job reaches `complete`. - `id?: string | null` - `created?: boolean` - `error?: Error` - `code?: string` - `message?: string` - `existing?: boolean` True if the row matched an existing record via the dedupe key. - `succeeded?: number` - `updated_at?: string` # Objects # Contacts ## Create object `client.prism.objects.contacts.create(ContactCreateParamsparams?, RequestOptionsoptions?): ContactCreateResponse` **post** `/v2/prism/{teamId}/contact` Create object ### Parameters - `params: ContactCreateParams` - `teamId?: string` Path param - `_default?: Record` Body param: Properties keyed by property slug. Values can be strings, numbers, booleans, arrays, or null. For select/multiselect properties, values may be option slugs or option UUIDs on write; option slugs are returned on read. - `list?: unknown` Body param - `idempotencyKey?: string` Header param: A unique key (UUID or any opaque string up to 255 chars) that identifies this logical request. The server caches the first response under this key for 24 hours and replays it on retry — safe to use on every POST/PUT/PATCH to make network retries deterministic. Reusing the same key with a different body returns 409 `idempotency_key_mismatch`. Replays include the `idempotent-replay: true` response header. ### Returns - `ContactCreateResponse` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); const contact = await client.prism.objects.contacts.create(); console.log(contact.id); ``` #### Response ```json { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "default": { "foo": "bar" }, "list": {} } ``` ## List records of an object type `client.prism.objects.contacts.list(ContactListParamsparams?, RequestOptionsoptions?): ContactListResponse` **get** `/v2/prism/{teamId}/contact` Convenience list endpoint. Equivalent to `POST /v2/prism/{teamId}/{objectType}/query` with an empty body, plus query-string sugar for the common cases. Any unrecognized query parameter is interpreted as an equality filter on a property of that name; pass arrays for `in`. Values are received as strings, so non-string property filters via this endpoint may not work — use the `query` endpoint for typed comparisons or anything beyond simple equality. ### Parameters - `params: ContactListParams` - `teamId?: string` Path param - `cursor?: string` Query param: Opaque cursor from a previous response's `next_cursor`. Pass it back unchanged to fetch the next page. - `deleted?: boolean` Query param: Include soft-deleted records. Pass the literal string `true`. - `include_total?: boolean` Query param: When set to `true`, the response includes a `total` field with the unpaginated row count. Costs an extra pass; prefer `GET .../count` for the unfiltered total. - `limit?: number` Query param: Maximum number of rows to return. Capped server-side at 50. - `list_id?: string` Query param: Scope properties to a specific list/app. - `select?: string` Query param: Comma-separated property slugs to return. Use dot notation for relationships. `id` is always returned at the top level. Defaults to all properties. - `sort?: string` Query param: Comma-separated list of slugs. Prefix with `-` for descending. Example: `sort=-updated_at,name`. ### Returns - `ContactListResponse` - `data: Array` - `id: string` - `is_user_object?: boolean` - `properties?: Record` Selected property values keyed by property slug. For select/multiselect properties, option slugs are returned. For reference properties, values are nested `{ id, properties }` objects. - `source?: string | null` - `has_more: boolean` Accurate end-of-data signal — false on the last page, never forces clients to overshoot. - `next_cursor?: string | null` - `total?: number | null` Populated only when `?include_total=true` was passed. ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); const contacts = await client.prism.objects.contacts.list(); console.log(contacts.data); ``` #### Response ```json { "data": [ { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "is_user_object": true, "properties": { "foo": "bar" }, "source": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e" } ], "has_more": true, "next_cursor": "next_cursor", "total": 0 } ``` ## Get object `client.prism.objects.contacts.get(stringcontactID, ContactGetParamsparams?, RequestOptionsoptions?): ContactGetResponse` **get** `/v2/prism/{teamId}/contact/{contactId}` Get object ### Parameters - `contactID: string` - `params: ContactGetParams` - `teamId?: string` Path param - `select?: string` Query param: Comma-separated property slugs to return. Use dot notation for relationships. `id` is always returned at the top level. Defaults to all properties. ### Returns - `ContactGetResponse` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); const contact = await client.prism.objects.contacts.get('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e'); console.log(contact.id); ``` #### Response ```json { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "default": { "foo": "bar" }, "list": {} } ``` ## Patch object `client.prism.objects.contacts.update(stringcontactID, ContactUpdateParamsparams, RequestOptionsoptions?): ContactUpdateResponse` **patch** `/v2/prism/{teamId}/contact/{contactId}` Patch object ### Parameters - `contactID: string` - `params: ContactUpdateParams` - `teamId?: string` Path param - `_default?: Record` Body param: Properties keyed by property slug. Values can be strings, numbers, booleans, arrays, or null. For select/multiselect properties, values may be option slugs or option UUIDs on write; option slugs are returned on read. - `list?: unknown` Body param - `idempotencyKey?: string` Header param: A unique key (UUID or any opaque string up to 255 chars) that identifies this logical request. The server caches the first response under this key for 24 hours and replays it on retry — safe to use on every POST/PUT/PATCH to make network retries deterministic. Reusing the same key with a different body returns 409 `idempotency_key_mismatch`. Replays include the `idempotent-replay: true` response header. - `ifMatch?: string` Header param: Optimistic concurrency. Pass back the `etag` header from a previous GET of this record; the write only proceeds if the record hasn't changed since. Mismatch → 412 `precondition_failed`. Use `*` to require the record exists (any ETag accepted). ### Returns - `ContactUpdateResponse` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); const contact = await client.prism.objects.contacts.update('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e'); console.log(contact.id); ``` #### Response ```json { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "default": { "foo": "bar" }, "list": {} } ``` ## Delete object `client.prism.objects.contacts.delete(stringcontactID, ContactDeleteParamsparams?, RequestOptionsoptions?): void` **delete** `/v2/prism/{teamId}/contact/{contactId}` Delete object ### Parameters - `contactID: string` - `params: ContactDeleteParams` - `teamId?: string` Path param - `ifMatch?: string` Header param: Optimistic concurrency. Pass back the `etag` header from a previous GET of this record; the write only proceeds if the record hasn't changed since. Mismatch → 412 `precondition_failed`. Use `*` to require the record exists (any ETag accepted). ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); await client.prism.objects.contacts.delete('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e'); ``` ## Query `client.prism.objects.contacts.query(ContactQueryParamsparams, RequestOptionsoptions?): ContactQueryResponse` **post** `/v2/prism/{teamId}/contact/query` Query ### Parameters - `params: ContactQueryParams` - `teamId?: string` Path param - `query: Query` Body param - `select: Array` Property slugs to select. Use dot notation for relationships (e.g. attendee.contact.first_name). `id` is always returned at the top level of each row and does not need to be selected. - `combinator?: "AND" | "OR"` Logical operator for combining filters - `"AND"` - `"OR"` - `cursor?: string` Opaque cursor from a previous response's `next_cursor`. Pass it back unchanged to fetch the next page. When set, `page` and `limit` are derived from the cursor and any explicit values are ignored. - `filter?: Array>` Filters as [{ slug: { operator: value } }]. For select/multiselect properties, values may be option slugs or option UUIDs. - `PrismQueryFilterEq` - `"=": string | boolean` - `string` - `boolean` - `PrismQueryFilterNe` - `"!=": string | boolean` - `string` - `boolean` - `PrismQueryFilterLt` - `"<": string` - `PrismQueryFilterGt` - `">": string` - `PrismQueryFilterLte` - `"<=": string` - `PrismQueryFilterGte` - `">=": string` - `Contains` - `contains: string | boolean | Array` - `string` - `boolean` - `Array` - `BeginsWith` - `begins_with: string` - `EndsWith` - `ends_with: string` - `NotContains` - `not_contains: string` - `Exists` - `exists: boolean` - `NotExists` - `not_exists: boolean` - `IsNull` - `is_null: string | boolean | Array` - `string` - `boolean` - `Array` - `IsNotNull` - `is_not_null: string | boolean | Array` - `string` - `boolean` - `Array` - `Between` - `between: string | boolean | Array` - `string` - `boolean` - `Array` - `In` - `in: Array` - `NotIn` - `not_in: Array` - `limit?: number` Maximum number of rows to return. Capped server-side at 50; requests above the cap are rejected. - `list_id?: string` - `page?: number` Page number (1-based). Prefer `cursor`. Page-number pagination drifts under concurrent writes; use it only for one-shot exports. - `sort?: Array>` Sort order as [{ slug: direction }]. Array order determines sort priority - `"asc"` - `"desc"` - `id?: string | Array` Body param - `string` - `Array` - `boxes?: Array` Body param - `cursor?: string` Body param: Alternative location for the opaque cursor (sibling of `query`). Use whichever feels more natural; if both are present, `query.cursor` wins. - `deleted?: boolean` Body param - `include_total?: boolean` Body param: When true, the response includes a `total` field with the unpaginated row count. Costs an additional pass over the result set — for unfiltered totals prefer `GET /v2/prism/{teamId}/{objectType}/count` instead. - `sources?: Array` Body param ### Returns - `ContactQueryResponse` - `data: Array` - `id: string` - `is_user_object?: boolean` - `properties?: Record` Selected property values keyed by property slug. For select/multiselect properties, option slugs are returned. For reference properties, values are nested `{ id, properties }` objects. - `source?: string | null` - `has_more: boolean` Accurate end-of-data signal. False when this page contains the last record; true only when at least one more record exists. (Implementation note: the server fetches one extra row internally to determine this — clients never need to overshoot to discover the end.) - `next_cursor?: string | null` Opaque cursor pointing at the next page. Pass it back unchanged in the request body (`cursor`) of the next call. Null when `has_more` is false. - `total?: number | null` Only populated when the request set `include_total: true`. Total number of records matching the query, ignoring pagination. Opt-in because it costs an additional pass over the result set. ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); const response = await client.prism.objects.contacts.query({ query: { select: ['string'] } }); console.log(response.data); ``` #### Response ```json { "data": [ { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "is_user_object": true, "properties": { "foo": "bar" }, "source": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e" } ], "has_more": true, "next_cursor": "next_cursor", "total": 0 } ``` ## Total record count for an object type `client.prism.objects.contacts.count(ContactCountParamsparams?, RequestOptionsoptions?): ContactCountResponse` **get** `/v2/prism/{teamId}/contact/count` Returns the total number of records of this object type that the caller can see. Avoids the page-overshoot anti-pattern — clients no longer need to keep paging until `has_more` flips false to discover the total. Currently does not apply query filters; for a filtered total, pass `include_total: true` in a POST `/query` body. ### Parameters - `params: ContactCountParams` - `teamId?: string` Path param - `list_id?: string` Query param: Scope the count to a specific list/app. ### Returns - `ContactCountResponse` - `total: number` Number of records matching the access scope. ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); const response = await client.prism.objects.contacts.count(); console.log(response.total); ``` #### Response ```json { "total": 0 } ``` ## Find a record by property value `client.prism.objects.contacts.find(stringvalue, ContactFindParamsparams, RequestOptionsoptions?): ContactFindResponse` **get** `/v2/prism/{teamId}/contact/by/{slug}/{value}` Returns the single record whose property `{slug}` equals `{value}`. 404 if nothing matches; 409 if more than one record matches. ### Parameters - `value: string` - `params: ContactFindParams` - `teamId?: string` Path param - `slug: string` Path param: Property slug to match (e.g. `email`). - `list_id?: string` Query param: Scope the lookup to a specific list/app. ### Returns - `ContactFindResponse` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); const response = await client.prism.objects.contacts.find('value', { slug: 'slug' }); console.log(response.id); ``` #### Response ```json { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "default": { "foo": "bar" }, "list": {} } ``` ## Upsert by property value `client.prism.objects.contacts.upsert(stringvalue, ContactUpsertParamsparams, RequestOptionsoptions?): ContactUpsertResponse` **put** `/v2/prism/{teamId}/contact/by/{slug}/{value}` Idempotent create-or-update keyed on `{slug}={value}`. If exactly one record matches, it is patched and 200 is returned. If none match, a new record is created (with the lookup property set if absent) and 201 is returned. If multiple records match, 409 is returned and you should patch by id instead. ### Parameters - `value: string` - `params: ContactUpsertParams` - `teamId?: string` Path param - `slug: string` Path param - `_default?: Record` Body param: Properties keyed by property slug. Values can be strings, numbers, booleans, arrays, or null. For select/multiselect properties, values may be option slugs or option UUIDs on write; option slugs are returned on read. - `list?: unknown` Body param - `idempotencyKey?: string` Header param: A unique key (UUID or any opaque string up to 255 chars) that identifies this logical request. The server caches the first response under this key for 24 hours and replays it on retry — safe to use on every POST/PUT/PATCH to make network retries deterministic. Reusing the same key with a different body returns 409 `idempotency_key_mismatch`. Replays include the `idempotent-replay: true` response header. ### Returns - `ContactUpsertResponse` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); const response = await client.prism.objects.contacts.upsert('value', { slug: 'slug' }); console.log(response.id); ``` #### Response ```json { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "default": { "foo": "bar" }, "list": {} } ``` ## Import objects `client.prism.objects.contacts.bulkCreate(ContactBulkCreateParamsparams, RequestOptionsoptions?): ContactBulkCreateResponse` **post** `/v2/prism/{teamId}/contact/import` Import multiple objects in batch. Properties are keyed by slug. Automatically routes based on size: small batches complete synchronously and return 200 with the final `ImportJob`; large batches start an async job, return 202 with `status: processing` and a `Location` header, and can be polled via `GET /v2/prism/{teamId}/imports/{jobId}`. ### Parameters - `params: ContactBulkCreateParams` - `teamId?: string` Path param - `objects: Array` Body param: Array of objects to import with property values keyed by slug - `default?: Record` Properties keyed by property slug. Values can be strings, numbers, booleans, arrays, or null. For select/multiselect properties, values may be option slugs or option UUIDs on write; option slugs are returned on read. - `list?: unknown` - `options?: Options` Body param - `caseInsensitive?: boolean` Whether deduplication should be case insensitive - `dedupe_by?: string` Property slug to deduplicate on - `list_id?: string` App/CRM ID for context (optional) - `idempotencyKey?: string` Header param: A unique key (UUID or any opaque string up to 255 chars) that identifies this logical request. The server caches the first response under this key for 24 hours and replays it on retry — safe to use on every POST/PUT/PATCH to make network retries deterministic. Reusing the same key with a different body returns 409 `idempotency_key_mismatch`. Replays include the `idempotent-replay: true` response header. ### Returns - `ContactBulkCreateResponse` Status snapshot of an import job. Same shape used by the POST /import response and by GET /imports/{jobId}. - `job_id: string | null` Null for sync imports (results inlined). Set for async imports. - `status: "complete" | "processing" | "failed"` - `"complete"` - `"processing"` - `"failed"` - `total: number` Total number of rows in the import. - `created_at?: string` - `error?: Error` Set when status=failed; describes the job-level failure (not per-row). - `code?: string` - `message?: string` - `expires_at?: string` - `failed?: number` - `processed?: number` Rows that have been attempted (succeeded + failed). - `results?: Array` Per-row outcomes. Always present for sync imports; populated for async imports once the job reaches `complete`. - `id?: string | null` - `created?: boolean` - `error?: Error` - `code?: string` - `message?: string` - `existing?: boolean` True if the row matched an existing record via the dedupe key. - `succeeded?: number` - `updated_at?: string` ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); const response = await client.prism.objects.contacts.bulkCreate({ objects: [{}] }); console.log(response.job_id); ``` #### Response ```json { "job_id": "job_id", "status": "complete", "total": 0, "created_at": "2019-12-27T18:11:19.117Z", "error": { "code": "code", "message": "message" }, "expires_at": "2019-12-27T18:11:19.117Z", "failed": 0, "processed": 0, "results": [ { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "created": true, "error": { "code": "code", "message": "message" }, "existing": true } ], "succeeded": 0, "updated_at": "2019-12-27T18:11:19.117Z" } ``` ## Bulk update records (partial success) `client.prism.objects.contacts.bulkUpdate(ContactBulkUpdateParamsparams, RequestOptionsoptions?): ContactBulkUpdateResponse` **post** `/v2/prism/{teamId}/contact/batch/update` Patch up to 100 records in a single call. Each item is attempted independently — failures don't abort the batch. Inspect `results[].status` per item. ### Parameters - `params: ContactBulkUpdateParams` - `teamId?: string` Path param - `items: Array` Body param - `id: string` - `idempotencyKey?: string` Header param: A unique key (UUID or any opaque string up to 255 chars) that identifies this logical request. The server caches the first response under this key for 24 hours and replays it on retry — safe to use on every POST/PUT/PATCH to make network retries deterministic. Reusing the same key with a different body returns 409 `idempotency_key_mismatch`. Replays include the `idempotent-replay: true` response header. ### Returns - `ContactBulkUpdateResponse` Partial-success bulk operation result. Inspect `results[].status` per item; the operation as a whole returns 200 even if some items failed. - `results: Array` - `id: string | null` Item ID, or null if the input was unparseable. - `status: "ok" | "error"` - `"ok"` - `"error"` - `error?: Error` - `code?: string` - `message?: string` - `record?: Record` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` - `summary: Summary` - `failed: number` - `succeeded: number` - `total: number` ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); const response = await client.prism.objects.contacts.bulkUpdate({ items: [{ id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e' }], }); console.log(response.results); ``` #### Response ```json { "results": [ { "id": "id", "status": "ok", "error": { "code": "code", "message": "message" }, "record": { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "default": { "foo": "bar" }, "list": {} } } ], "summary": { "failed": 0, "succeeded": 0, "total": 0 } } ``` ## Bulk delete records (partial success) `client.prism.objects.contacts.bulkDelete(ContactBulkDeleteParamsparams, RequestOptionsoptions?): ContactBulkDeleteResponse` **post** `/v2/prism/{teamId}/contact/batch/delete` Soft-delete up to 100 records in a single call. Same partial-success contract as batch/update. ### Parameters - `params: ContactBulkDeleteParams` - `teamId?: string` Path param - `ids: Array` Body param - `idempotencyKey?: string` Header param: A unique key (UUID or any opaque string up to 255 chars) that identifies this logical request. The server caches the first response under this key for 24 hours and replays it on retry — safe to use on every POST/PUT/PATCH to make network retries deterministic. Reusing the same key with a different body returns 409 `idempotency_key_mismatch`. Replays include the `idempotent-replay: true` response header. ### Returns - `ContactBulkDeleteResponse` Partial-success bulk operation result. Inspect `results[].status` per item; the operation as a whole returns 200 even if some items failed. - `results: Array` - `id: string | null` Item ID, or null if the input was unparseable. - `status: "ok" | "error"` - `"ok"` - `"error"` - `error?: Error` - `code?: string` - `message?: string` - `record?: Record` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` - `summary: Summary` - `failed: number` - `succeeded: number` - `total: number` ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); const response = await client.prism.objects.contacts.bulkDelete({ ids: ['182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e'], }); console.log(response.results); ``` #### Response ```json { "results": [ { "id": "id", "status": "ok", "error": { "code": "code", "message": "message" }, "record": { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "default": { "foo": "bar" }, "list": {} } } ], "summary": { "failed": 0, "succeeded": 0, "total": 0 } } ``` ## Duplicate object `client.prism.objects.contacts.duplicate(stringcontactID, ContactDuplicateParamsparams?, RequestOptionsoptions?): ContactDuplicateResponse` **post** `/v2/prism/{teamId}/contact/{contactId}/duplicate` Duplicate object ### Parameters - `contactID: string` - `params: ContactDuplicateParams` - `teamId?: string` Path param - `idempotencyKey?: string` Header param: A unique key (UUID or any opaque string up to 255 chars) that identifies this logical request. The server caches the first response under this key for 24 hours and replays it on retry — safe to use on every POST/PUT/PATCH to make network retries deterministic. Reusing the same key with a different body returns 409 `idempotency_key_mismatch`. Replays include the `idempotent-replay: true` response header. ### Returns - `ContactDuplicateResponse` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); const response = await client.prism.objects.contacts.duplicate( '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', ); console.log(response.id); ``` #### Response ```json { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "default": { "foo": "bar" }, "list": {} } ``` ## Restore object `client.prism.objects.contacts.restore(stringcontactID, ContactRestoreParamsparams?, RequestOptionsoptions?): ContactRestoreResponse` **post** `/v2/prism/{teamId}/contact/{contactId}/restore` Restore object ### Parameters - `contactID: string` - `params: ContactRestoreParams` - `teamId?: string` Path param - `idempotencyKey?: string` Header param: A unique key (UUID or any opaque string up to 255 chars) that identifies this logical request. The server caches the first response under this key for 24 hours and replays it on retry — safe to use on every POST/PUT/PATCH to make network retries deterministic. Reusing the same key with a different body returns 409 `idempotency_key_mismatch`. Replays include the `idempotent-replay: true` response header. ### Returns - `ContactRestoreResponse` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); const response = await client.prism.objects.contacts.restore( '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', ); console.log(response.id); ``` #### Response ```json { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "default": { "foo": "bar" }, "list": {} } ``` ## Domain Types ### Contact - `Contact` - `default?: Record` Properties keyed by property slug. Values can be strings, numbers, booleans, arrays, or null. For select/multiselect properties, values may be option slugs or option UUIDs on write; option slugs are returned on read. - `list?: unknown` ### Contact Create Response - `ContactCreateResponse` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` ### Contact List Response - `ContactListResponse` - `data: Array` - `id: string` - `is_user_object?: boolean` - `properties?: Record` Selected property values keyed by property slug. For select/multiselect properties, option slugs are returned. For reference properties, values are nested `{ id, properties }` objects. - `source?: string | null` - `has_more: boolean` Accurate end-of-data signal — false on the last page, never forces clients to overshoot. - `next_cursor?: string | null` - `total?: number | null` Populated only when `?include_total=true` was passed. ### Contact Get Response - `ContactGetResponse` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` ### Contact Update Response - `ContactUpdateResponse` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` ### Contact Query Response - `ContactQueryResponse` - `data: Array` - `id: string` - `is_user_object?: boolean` - `properties?: Record` Selected property values keyed by property slug. For select/multiselect properties, option slugs are returned. For reference properties, values are nested `{ id, properties }` objects. - `source?: string | null` - `has_more: boolean` Accurate end-of-data signal. False when this page contains the last record; true only when at least one more record exists. (Implementation note: the server fetches one extra row internally to determine this — clients never need to overshoot to discover the end.) - `next_cursor?: string | null` Opaque cursor pointing at the next page. Pass it back unchanged in the request body (`cursor`) of the next call. Null when `has_more` is false. - `total?: number | null` Only populated when the request set `include_total: true`. Total number of records matching the query, ignoring pagination. Opt-in because it costs an additional pass over the result set. ### Contact Count Response - `ContactCountResponse` - `total: number` Number of records matching the access scope. ### Contact Find Response - `ContactFindResponse` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` ### Contact Upsert Response - `ContactUpsertResponse` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` ### Contact Bulk Create Response - `ContactBulkCreateResponse` Status snapshot of an import job. Same shape used by the POST /import response and by GET /imports/{jobId}. - `job_id: string | null` Null for sync imports (results inlined). Set for async imports. - `status: "complete" | "processing" | "failed"` - `"complete"` - `"processing"` - `"failed"` - `total: number` Total number of rows in the import. - `created_at?: string` - `error?: Error` Set when status=failed; describes the job-level failure (not per-row). - `code?: string` - `message?: string` - `expires_at?: string` - `failed?: number` - `processed?: number` Rows that have been attempted (succeeded + failed). - `results?: Array` Per-row outcomes. Always present for sync imports; populated for async imports once the job reaches `complete`. - `id?: string | null` - `created?: boolean` - `error?: Error` - `code?: string` - `message?: string` - `existing?: boolean` True if the row matched an existing record via the dedupe key. - `succeeded?: number` - `updated_at?: string` ### Contact Bulk Update Response - `ContactBulkUpdateResponse` Partial-success bulk operation result. Inspect `results[].status` per item; the operation as a whole returns 200 even if some items failed. - `results: Array` - `id: string | null` Item ID, or null if the input was unparseable. - `status: "ok" | "error"` - `"ok"` - `"error"` - `error?: Error` - `code?: string` - `message?: string` - `record?: Record` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` - `summary: Summary` - `failed: number` - `succeeded: number` - `total: number` ### Contact Bulk Delete Response - `ContactBulkDeleteResponse` Partial-success bulk operation result. Inspect `results[].status` per item; the operation as a whole returns 200 even if some items failed. - `results: Array` - `id: string | null` Item ID, or null if the input was unparseable. - `status: "ok" | "error"` - `"ok"` - `"error"` - `error?: Error` - `code?: string` - `message?: string` - `record?: Record` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` - `summary: Summary` - `failed: number` - `succeeded: number` - `total: number` ### Contact Duplicate Response - `ContactDuplicateResponse` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` ### Contact Restore Response - `ContactRestoreResponse` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` # Organizations ## Create object `client.prism.objects.organizations.create(OrganizationCreateParamsparams?, RequestOptionsoptions?): OrganizationCreateResponse` **post** `/v2/prism/{teamId}/organization` Create object ### Parameters - `params: OrganizationCreateParams` - `teamId?: string` Path param - `_default?: Record` Body param: Properties keyed by property slug. Values can be strings, numbers, booleans, arrays, or null. For select/multiselect properties, values may be option slugs or option UUIDs on write; option slugs are returned on read. - `list?: unknown` Body param - `idempotencyKey?: string` Header param: A unique key (UUID or any opaque string up to 255 chars) that identifies this logical request. The server caches the first response under this key for 24 hours and replays it on retry — safe to use on every POST/PUT/PATCH to make network retries deterministic. Reusing the same key with a different body returns 409 `idempotency_key_mismatch`. Replays include the `idempotent-replay: true` response header. ### Returns - `OrganizationCreateResponse` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); const organization = await client.prism.objects.organizations.create(); console.log(organization.id); ``` #### Response ```json { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "default": { "foo": "bar" }, "list": {} } ``` ## List records of an object type `client.prism.objects.organizations.list(OrganizationListParamsparams?, RequestOptionsoptions?): OrganizationListResponse` **get** `/v2/prism/{teamId}/organization` Convenience list endpoint. Equivalent to `POST /v2/prism/{teamId}/{objectType}/query` with an empty body, plus query-string sugar for the common cases. Any unrecognized query parameter is interpreted as an equality filter on a property of that name; pass arrays for `in`. Values are received as strings, so non-string property filters via this endpoint may not work — use the `query` endpoint for typed comparisons or anything beyond simple equality. ### Parameters - `params: OrganizationListParams` - `teamId?: string` Path param - `cursor?: string` Query param: Opaque cursor from a previous response's `next_cursor`. Pass it back unchanged to fetch the next page. - `deleted?: boolean` Query param: Include soft-deleted records. Pass the literal string `true`. - `include_total?: boolean` Query param: When set to `true`, the response includes a `total` field with the unpaginated row count. Costs an extra pass; prefer `GET .../count` for the unfiltered total. - `limit?: number` Query param: Maximum number of rows to return. Capped server-side at 50. - `list_id?: string` Query param: Scope properties to a specific list/app. - `select?: string` Query param: Comma-separated property slugs to return. Use dot notation for relationships. `id` is always returned at the top level. Defaults to all properties. - `sort?: string` Query param: Comma-separated list of slugs. Prefix with `-` for descending. Example: `sort=-updated_at,name`. ### Returns - `OrganizationListResponse` - `data: Array` - `id: string` - `is_user_object?: boolean` - `properties?: Record` Selected property values keyed by property slug. For select/multiselect properties, option slugs are returned. For reference properties, values are nested `{ id, properties }` objects. - `source?: string | null` - `has_more: boolean` Accurate end-of-data signal — false on the last page, never forces clients to overshoot. - `next_cursor?: string | null` - `total?: number | null` Populated only when `?include_total=true` was passed. ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); const organizations = await client.prism.objects.organizations.list(); console.log(organizations.data); ``` #### Response ```json { "data": [ { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "is_user_object": true, "properties": { "foo": "bar" }, "source": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e" } ], "has_more": true, "next_cursor": "next_cursor", "total": 0 } ``` ## Get object `client.prism.objects.organizations.get(stringorganizationID, OrganizationGetParamsparams?, RequestOptionsoptions?): OrganizationGetResponse` **get** `/v2/prism/{teamId}/organization/{organizationId}` Get object ### Parameters - `organizationID: string` - `params: OrganizationGetParams` - `teamId?: string` Path param - `select?: string` Query param: Comma-separated property slugs to return. Use dot notation for relationships. `id` is always returned at the top level. Defaults to all properties. ### Returns - `OrganizationGetResponse` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); const organization = await client.prism.objects.organizations.get( '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', ); console.log(organization.id); ``` #### Response ```json { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "default": { "foo": "bar" }, "list": {} } ``` ## Patch object `client.prism.objects.organizations.update(stringorganizationID, OrganizationUpdateParamsparams, RequestOptionsoptions?): OrganizationUpdateResponse` **patch** `/v2/prism/{teamId}/organization/{organizationId}` Patch object ### Parameters - `organizationID: string` - `params: OrganizationUpdateParams` - `teamId?: string` Path param - `_default?: Record` Body param: Properties keyed by property slug. Values can be strings, numbers, booleans, arrays, or null. For select/multiselect properties, values may be option slugs or option UUIDs on write; option slugs are returned on read. - `list?: unknown` Body param - `idempotencyKey?: string` Header param: A unique key (UUID or any opaque string up to 255 chars) that identifies this logical request. The server caches the first response under this key for 24 hours and replays it on retry — safe to use on every POST/PUT/PATCH to make network retries deterministic. Reusing the same key with a different body returns 409 `idempotency_key_mismatch`. Replays include the `idempotent-replay: true` response header. - `ifMatch?: string` Header param: Optimistic concurrency. Pass back the `etag` header from a previous GET of this record; the write only proceeds if the record hasn't changed since. Mismatch → 412 `precondition_failed`. Use `*` to require the record exists (any ETag accepted). ### Returns - `OrganizationUpdateResponse` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); const organization = await client.prism.objects.organizations.update( '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', ); console.log(organization.id); ``` #### Response ```json { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "default": { "foo": "bar" }, "list": {} } ``` ## Delete object `client.prism.objects.organizations.delete(stringorganizationID, OrganizationDeleteParamsparams?, RequestOptionsoptions?): void` **delete** `/v2/prism/{teamId}/organization/{organizationId}` Delete object ### Parameters - `organizationID: string` - `params: OrganizationDeleteParams` - `teamId?: string` Path param - `ifMatch?: string` Header param: Optimistic concurrency. Pass back the `etag` header from a previous GET of this record; the write only proceeds if the record hasn't changed since. Mismatch → 412 `precondition_failed`. Use `*` to require the record exists (any ETag accepted). ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); await client.prism.objects.organizations.delete('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e'); ``` ## Query `client.prism.objects.organizations.query(OrganizationQueryParamsparams, RequestOptionsoptions?): OrganizationQueryResponse` **post** `/v2/prism/{teamId}/organization/query` Query ### Parameters - `params: OrganizationQueryParams` - `teamId?: string` Path param - `query: Query` Body param - `select: Array` Property slugs to select. Use dot notation for relationships (e.g. attendee.contact.first_name). `id` is always returned at the top level of each row and does not need to be selected. - `combinator?: "AND" | "OR"` Logical operator for combining filters - `"AND"` - `"OR"` - `cursor?: string` Opaque cursor from a previous response's `next_cursor`. Pass it back unchanged to fetch the next page. When set, `page` and `limit` are derived from the cursor and any explicit values are ignored. - `filter?: Array>` Filters as [{ slug: { operator: value } }]. For select/multiselect properties, values may be option slugs or option UUIDs. - `PrismQueryFilterEq` - `"=": string | boolean` - `string` - `boolean` - `PrismQueryFilterNe` - `"!=": string | boolean` - `string` - `boolean` - `PrismQueryFilterLt` - `"<": string` - `PrismQueryFilterGt` - `">": string` - `PrismQueryFilterLte` - `"<=": string` - `PrismQueryFilterGte` - `">=": string` - `Contains` - `contains: string | boolean | Array` - `string` - `boolean` - `Array` - `BeginsWith` - `begins_with: string` - `EndsWith` - `ends_with: string` - `NotContains` - `not_contains: string` - `Exists` - `exists: boolean` - `NotExists` - `not_exists: boolean` - `IsNull` - `is_null: string | boolean | Array` - `string` - `boolean` - `Array` - `IsNotNull` - `is_not_null: string | boolean | Array` - `string` - `boolean` - `Array` - `Between` - `between: string | boolean | Array` - `string` - `boolean` - `Array` - `In` - `in: Array` - `NotIn` - `not_in: Array` - `limit?: number` Maximum number of rows to return. Capped server-side at 50; requests above the cap are rejected. - `list_id?: string` - `page?: number` Page number (1-based). Prefer `cursor`. Page-number pagination drifts under concurrent writes; use it only for one-shot exports. - `sort?: Array>` Sort order as [{ slug: direction }]. Array order determines sort priority - `"asc"` - `"desc"` - `id?: string | Array` Body param - `string` - `Array` - `boxes?: Array` Body param - `cursor?: string` Body param: Alternative location for the opaque cursor (sibling of `query`). Use whichever feels more natural; if both are present, `query.cursor` wins. - `deleted?: boolean` Body param - `include_total?: boolean` Body param: When true, the response includes a `total` field with the unpaginated row count. Costs an additional pass over the result set — for unfiltered totals prefer `GET /v2/prism/{teamId}/{objectType}/count` instead. - `sources?: Array` Body param ### Returns - `OrganizationQueryResponse` - `data: Array` - `id: string` - `is_user_object?: boolean` - `properties?: Record` Selected property values keyed by property slug. For select/multiselect properties, option slugs are returned. For reference properties, values are nested `{ id, properties }` objects. - `source?: string | null` - `has_more: boolean` Accurate end-of-data signal. False when this page contains the last record; true only when at least one more record exists. (Implementation note: the server fetches one extra row internally to determine this — clients never need to overshoot to discover the end.) - `next_cursor?: string | null` Opaque cursor pointing at the next page. Pass it back unchanged in the request body (`cursor`) of the next call. Null when `has_more` is false. - `total?: number | null` Only populated when the request set `include_total: true`. Total number of records matching the query, ignoring pagination. Opt-in because it costs an additional pass over the result set. ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); const response = await client.prism.objects.organizations.query({ query: { select: ['string'] } }); console.log(response.data); ``` #### Response ```json { "data": [ { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "is_user_object": true, "properties": { "foo": "bar" }, "source": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e" } ], "has_more": true, "next_cursor": "next_cursor", "total": 0 } ``` ## Total record count for an object type `client.prism.objects.organizations.count(OrganizationCountParamsparams?, RequestOptionsoptions?): OrganizationCountResponse` **get** `/v2/prism/{teamId}/organization/count` Returns the total number of records of this object type that the caller can see. Avoids the page-overshoot anti-pattern — clients no longer need to keep paging until `has_more` flips false to discover the total. Currently does not apply query filters; for a filtered total, pass `include_total: true` in a POST `/query` body. ### Parameters - `params: OrganizationCountParams` - `teamId?: string` Path param - `list_id?: string` Query param: Scope the count to a specific list/app. ### Returns - `OrganizationCountResponse` - `total: number` Number of records matching the access scope. ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); const response = await client.prism.objects.organizations.count(); console.log(response.total); ``` #### Response ```json { "total": 0 } ``` ## Find a record by property value `client.prism.objects.organizations.find(stringvalue, OrganizationFindParamsparams, RequestOptionsoptions?): OrganizationFindResponse` **get** `/v2/prism/{teamId}/organization/by/{slug}/{value}` Returns the single record whose property `{slug}` equals `{value}`. 404 if nothing matches; 409 if more than one record matches. ### Parameters - `value: string` - `params: OrganizationFindParams` - `teamId?: string` Path param - `slug: string` Path param: Property slug to match (e.g. `email`). - `list_id?: string` Query param: Scope the lookup to a specific list/app. ### Returns - `OrganizationFindResponse` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); const response = await client.prism.objects.organizations.find('value', { slug: 'slug' }); console.log(response.id); ``` #### Response ```json { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "default": { "foo": "bar" }, "list": {} } ``` ## Upsert by property value `client.prism.objects.organizations.upsert(stringvalue, OrganizationUpsertParamsparams, RequestOptionsoptions?): OrganizationUpsertResponse` **put** `/v2/prism/{teamId}/organization/by/{slug}/{value}` Idempotent create-or-update keyed on `{slug}={value}`. If exactly one record matches, it is patched and 200 is returned. If none match, a new record is created (with the lookup property set if absent) and 201 is returned. If multiple records match, 409 is returned and you should patch by id instead. ### Parameters - `value: string` - `params: OrganizationUpsertParams` - `teamId?: string` Path param - `slug: string` Path param - `_default?: Record` Body param: Properties keyed by property slug. Values can be strings, numbers, booleans, arrays, or null. For select/multiselect properties, values may be option slugs or option UUIDs on write; option slugs are returned on read. - `list?: unknown` Body param - `idempotencyKey?: string` Header param: A unique key (UUID or any opaque string up to 255 chars) that identifies this logical request. The server caches the first response under this key for 24 hours and replays it on retry — safe to use on every POST/PUT/PATCH to make network retries deterministic. Reusing the same key with a different body returns 409 `idempotency_key_mismatch`. Replays include the `idempotent-replay: true` response header. ### Returns - `OrganizationUpsertResponse` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); const response = await client.prism.objects.organizations.upsert('value', { slug: 'slug' }); console.log(response.id); ``` #### Response ```json { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "default": { "foo": "bar" }, "list": {} } ``` ## Import objects `client.prism.objects.organizations.bulkCreate(OrganizationBulkCreateParamsparams, RequestOptionsoptions?): OrganizationBulkCreateResponse` **post** `/v2/prism/{teamId}/organization/import` Import multiple objects in batch. Properties are keyed by slug. Automatically routes based on size: small batches complete synchronously and return 200 with the final `ImportJob`; large batches start an async job, return 202 with `status: processing` and a `Location` header, and can be polled via `GET /v2/prism/{teamId}/imports/{jobId}`. ### Parameters - `params: OrganizationBulkCreateParams` - `teamId?: string` Path param - `objects: Array` Body param: Array of objects to import with property values keyed by slug - `default?: Record` Properties keyed by property slug. Values can be strings, numbers, booleans, arrays, or null. For select/multiselect properties, values may be option slugs or option UUIDs on write; option slugs are returned on read. - `list?: unknown` - `options?: Options` Body param - `caseInsensitive?: boolean` Whether deduplication should be case insensitive - `dedupe_by?: string` Property slug to deduplicate on - `list_id?: string` App/CRM ID for context (optional) - `idempotencyKey?: string` Header param: A unique key (UUID or any opaque string up to 255 chars) that identifies this logical request. The server caches the first response under this key for 24 hours and replays it on retry — safe to use on every POST/PUT/PATCH to make network retries deterministic. Reusing the same key with a different body returns 409 `idempotency_key_mismatch`. Replays include the `idempotent-replay: true` response header. ### Returns - `OrganizationBulkCreateResponse` Status snapshot of an import job. Same shape used by the POST /import response and by GET /imports/{jobId}. - `job_id: string | null` Null for sync imports (results inlined). Set for async imports. - `status: "complete" | "processing" | "failed"` - `"complete"` - `"processing"` - `"failed"` - `total: number` Total number of rows in the import. - `created_at?: string` - `error?: Error` Set when status=failed; describes the job-level failure (not per-row). - `code?: string` - `message?: string` - `expires_at?: string` - `failed?: number` - `processed?: number` Rows that have been attempted (succeeded + failed). - `results?: Array` Per-row outcomes. Always present for sync imports; populated for async imports once the job reaches `complete`. - `id?: string | null` - `created?: boolean` - `error?: Error` - `code?: string` - `message?: string` - `existing?: boolean` True if the row matched an existing record via the dedupe key. - `succeeded?: number` - `updated_at?: string` ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); const response = await client.prism.objects.organizations.bulkCreate({ objects: [{}] }); console.log(response.job_id); ``` #### Response ```json { "job_id": "job_id", "status": "complete", "total": 0, "created_at": "2019-12-27T18:11:19.117Z", "error": { "code": "code", "message": "message" }, "expires_at": "2019-12-27T18:11:19.117Z", "failed": 0, "processed": 0, "results": [ { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "created": true, "error": { "code": "code", "message": "message" }, "existing": true } ], "succeeded": 0, "updated_at": "2019-12-27T18:11:19.117Z" } ``` ## Bulk update records (partial success) `client.prism.objects.organizations.bulkUpdate(OrganizationBulkUpdateParamsparams, RequestOptionsoptions?): OrganizationBulkUpdateResponse` **post** `/v2/prism/{teamId}/organization/batch/update` Patch up to 100 records in a single call. Each item is attempted independently — failures don't abort the batch. Inspect `results[].status` per item. ### Parameters - `params: OrganizationBulkUpdateParams` - `teamId?: string` Path param - `items: Array` Body param - `id: string` - `idempotencyKey?: string` Header param: A unique key (UUID or any opaque string up to 255 chars) that identifies this logical request. The server caches the first response under this key for 24 hours and replays it on retry — safe to use on every POST/PUT/PATCH to make network retries deterministic. Reusing the same key with a different body returns 409 `idempotency_key_mismatch`. Replays include the `idempotent-replay: true` response header. ### Returns - `OrganizationBulkUpdateResponse` Partial-success bulk operation result. Inspect `results[].status` per item; the operation as a whole returns 200 even if some items failed. - `results: Array` - `id: string | null` Item ID, or null if the input was unparseable. - `status: "ok" | "error"` - `"ok"` - `"error"` - `error?: Error` - `code?: string` - `message?: string` - `record?: Record` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` - `summary: Summary` - `failed: number` - `succeeded: number` - `total: number` ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); const response = await client.prism.objects.organizations.bulkUpdate({ items: [{ id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e' }], }); console.log(response.results); ``` #### Response ```json { "results": [ { "id": "id", "status": "ok", "error": { "code": "code", "message": "message" }, "record": { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "default": { "foo": "bar" }, "list": {} } } ], "summary": { "failed": 0, "succeeded": 0, "total": 0 } } ``` ## Bulk delete records (partial success) `client.prism.objects.organizations.bulkDelete(OrganizationBulkDeleteParamsparams, RequestOptionsoptions?): OrganizationBulkDeleteResponse` **post** `/v2/prism/{teamId}/organization/batch/delete` Soft-delete up to 100 records in a single call. Same partial-success contract as batch/update. ### Parameters - `params: OrganizationBulkDeleteParams` - `teamId?: string` Path param - `ids: Array` Body param - `idempotencyKey?: string` Header param: A unique key (UUID or any opaque string up to 255 chars) that identifies this logical request. The server caches the first response under this key for 24 hours and replays it on retry — safe to use on every POST/PUT/PATCH to make network retries deterministic. Reusing the same key with a different body returns 409 `idempotency_key_mismatch`. Replays include the `idempotent-replay: true` response header. ### Returns - `OrganizationBulkDeleteResponse` Partial-success bulk operation result. Inspect `results[].status` per item; the operation as a whole returns 200 even if some items failed. - `results: Array` - `id: string | null` Item ID, or null if the input was unparseable. - `status: "ok" | "error"` - `"ok"` - `"error"` - `error?: Error` - `code?: string` - `message?: string` - `record?: Record` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` - `summary: Summary` - `failed: number` - `succeeded: number` - `total: number` ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); const response = await client.prism.objects.organizations.bulkDelete({ ids: ['182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e'], }); console.log(response.results); ``` #### Response ```json { "results": [ { "id": "id", "status": "ok", "error": { "code": "code", "message": "message" }, "record": { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "default": { "foo": "bar" }, "list": {} } } ], "summary": { "failed": 0, "succeeded": 0, "total": 0 } } ``` ## Duplicate object `client.prism.objects.organizations.duplicate(stringorganizationID, OrganizationDuplicateParamsparams?, RequestOptionsoptions?): OrganizationDuplicateResponse` **post** `/v2/prism/{teamId}/organization/{organizationId}/duplicate` Duplicate object ### Parameters - `organizationID: string` - `params: OrganizationDuplicateParams` - `teamId?: string` Path param - `idempotencyKey?: string` Header param: A unique key (UUID or any opaque string up to 255 chars) that identifies this logical request. The server caches the first response under this key for 24 hours and replays it on retry — safe to use on every POST/PUT/PATCH to make network retries deterministic. Reusing the same key with a different body returns 409 `idempotency_key_mismatch`. Replays include the `idempotent-replay: true` response header. ### Returns - `OrganizationDuplicateResponse` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); const response = await client.prism.objects.organizations.duplicate( '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', ); console.log(response.id); ``` #### Response ```json { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "default": { "foo": "bar" }, "list": {} } ``` ## Restore object `client.prism.objects.organizations.restore(stringorganizationID, OrganizationRestoreParamsparams?, RequestOptionsoptions?): OrganizationRestoreResponse` **post** `/v2/prism/{teamId}/organization/{organizationId}/restore` Restore object ### Parameters - `organizationID: string` - `params: OrganizationRestoreParams` - `teamId?: string` Path param - `idempotencyKey?: string` Header param: A unique key (UUID or any opaque string up to 255 chars) that identifies this logical request. The server caches the first response under this key for 24 hours and replays it on retry — safe to use on every POST/PUT/PATCH to make network retries deterministic. Reusing the same key with a different body returns 409 `idempotency_key_mismatch`. Replays include the `idempotent-replay: true` response header. ### Returns - `OrganizationRestoreResponse` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); const response = await client.prism.objects.organizations.restore( '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', ); console.log(response.id); ``` #### Response ```json { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "default": { "foo": "bar" }, "list": {} } ``` ## Domain Types ### Organization - `Organization` - `default?: Record` Properties keyed by property slug. Values can be strings, numbers, booleans, arrays, or null. For select/multiselect properties, values may be option slugs or option UUIDs on write; option slugs are returned on read. - `list?: unknown` ### Organization Create Response - `OrganizationCreateResponse` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` ### Organization List Response - `OrganizationListResponse` - `data: Array` - `id: string` - `is_user_object?: boolean` - `properties?: Record` Selected property values keyed by property slug. For select/multiselect properties, option slugs are returned. For reference properties, values are nested `{ id, properties }` objects. - `source?: string | null` - `has_more: boolean` Accurate end-of-data signal — false on the last page, never forces clients to overshoot. - `next_cursor?: string | null` - `total?: number | null` Populated only when `?include_total=true` was passed. ### Organization Get Response - `OrganizationGetResponse` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` ### Organization Update Response - `OrganizationUpdateResponse` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` ### Organization Query Response - `OrganizationQueryResponse` - `data: Array` - `id: string` - `is_user_object?: boolean` - `properties?: Record` Selected property values keyed by property slug. For select/multiselect properties, option slugs are returned. For reference properties, values are nested `{ id, properties }` objects. - `source?: string | null` - `has_more: boolean` Accurate end-of-data signal. False when this page contains the last record; true only when at least one more record exists. (Implementation note: the server fetches one extra row internally to determine this — clients never need to overshoot to discover the end.) - `next_cursor?: string | null` Opaque cursor pointing at the next page. Pass it back unchanged in the request body (`cursor`) of the next call. Null when `has_more` is false. - `total?: number | null` Only populated when the request set `include_total: true`. Total number of records matching the query, ignoring pagination. Opt-in because it costs an additional pass over the result set. ### Organization Count Response - `OrganizationCountResponse` - `total: number` Number of records matching the access scope. ### Organization Find Response - `OrganizationFindResponse` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` ### Organization Upsert Response - `OrganizationUpsertResponse` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` ### Organization Bulk Create Response - `OrganizationBulkCreateResponse` Status snapshot of an import job. Same shape used by the POST /import response and by GET /imports/{jobId}. - `job_id: string | null` Null for sync imports (results inlined). Set for async imports. - `status: "complete" | "processing" | "failed"` - `"complete"` - `"processing"` - `"failed"` - `total: number` Total number of rows in the import. - `created_at?: string` - `error?: Error` Set when status=failed; describes the job-level failure (not per-row). - `code?: string` - `message?: string` - `expires_at?: string` - `failed?: number` - `processed?: number` Rows that have been attempted (succeeded + failed). - `results?: Array` Per-row outcomes. Always present for sync imports; populated for async imports once the job reaches `complete`. - `id?: string | null` - `created?: boolean` - `error?: Error` - `code?: string` - `message?: string` - `existing?: boolean` True if the row matched an existing record via the dedupe key. - `succeeded?: number` - `updated_at?: string` ### Organization Bulk Update Response - `OrganizationBulkUpdateResponse` Partial-success bulk operation result. Inspect `results[].status` per item; the operation as a whole returns 200 even if some items failed. - `results: Array` - `id: string | null` Item ID, or null if the input was unparseable. - `status: "ok" | "error"` - `"ok"` - `"error"` - `error?: Error` - `code?: string` - `message?: string` - `record?: Record` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` - `summary: Summary` - `failed: number` - `succeeded: number` - `total: number` ### Organization Bulk Delete Response - `OrganizationBulkDeleteResponse` Partial-success bulk operation result. Inspect `results[].status` per item; the operation as a whole returns 200 even if some items failed. - `results: Array` - `id: string | null` Item ID, or null if the input was unparseable. - `status: "ok" | "error"` - `"ok"` - `"error"` - `error?: Error` - `code?: string` - `message?: string` - `record?: Record` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` - `summary: Summary` - `failed: number` - `succeeded: number` - `total: number` ### Organization Duplicate Response - `OrganizationDuplicateResponse` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` ### Organization Restore Response - `OrganizationRestoreResponse` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` # Identities ## Create object `client.prism.objects.identities.create(IdentityCreateParamsparams?, RequestOptionsoptions?): IdentityCreateResponse` **post** `/v2/prism/{teamId}/identity` Create object ### Parameters - `params: IdentityCreateParams` - `teamId?: string` Path param - `_default?: Record` Body param: Properties keyed by property slug. Values can be strings, numbers, booleans, arrays, or null. For select/multiselect properties, values may be option slugs or option UUIDs on write; option slugs are returned on read. - `list?: unknown` Body param - `idempotencyKey?: string` Header param: A unique key (UUID or any opaque string up to 255 chars) that identifies this logical request. The server caches the first response under this key for 24 hours and replays it on retry — safe to use on every POST/PUT/PATCH to make network retries deterministic. Reusing the same key with a different body returns 409 `idempotency_key_mismatch`. Replays include the `idempotent-replay: true` response header. ### Returns - `IdentityCreateResponse` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); const identity = await client.prism.objects.identities.create(); console.log(identity.id); ``` #### Response ```json { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "default": { "foo": "bar" }, "list": {} } ``` ## List records of an object type `client.prism.objects.identities.list(IdentityListParamsparams?, RequestOptionsoptions?): IdentityListResponse` **get** `/v2/prism/{teamId}/identity` Convenience list endpoint. Equivalent to `POST /v2/prism/{teamId}/{objectType}/query` with an empty body, plus query-string sugar for the common cases. Any unrecognized query parameter is interpreted as an equality filter on a property of that name; pass arrays for `in`. Values are received as strings, so non-string property filters via this endpoint may not work — use the `query` endpoint for typed comparisons or anything beyond simple equality. ### Parameters - `params: IdentityListParams` - `teamId?: string` Path param - `cursor?: string` Query param: Opaque cursor from a previous response's `next_cursor`. Pass it back unchanged to fetch the next page. - `deleted?: boolean` Query param: Include soft-deleted records. Pass the literal string `true`. - `include_total?: boolean` Query param: When set to `true`, the response includes a `total` field with the unpaginated row count. Costs an extra pass; prefer `GET .../count` for the unfiltered total. - `limit?: number` Query param: Maximum number of rows to return. Capped server-side at 50. - `list_id?: string` Query param: Scope properties to a specific list/app. - `select?: string` Query param: Comma-separated property slugs to return. Use dot notation for relationships. `id` is always returned at the top level. Defaults to all properties. - `sort?: string` Query param: Comma-separated list of slugs. Prefix with `-` for descending. Example: `sort=-updated_at,name`. ### Returns - `IdentityListResponse` - `data: Array` - `id: string` - `is_user_object?: boolean` - `properties?: Record` Selected property values keyed by property slug. For select/multiselect properties, option slugs are returned. For reference properties, values are nested `{ id, properties }` objects. - `source?: string | null` - `has_more: boolean` Accurate end-of-data signal — false on the last page, never forces clients to overshoot. - `next_cursor?: string | null` - `total?: number | null` Populated only when `?include_total=true` was passed. ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); const identities = await client.prism.objects.identities.list(); console.log(identities.data); ``` #### Response ```json { "data": [ { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "is_user_object": true, "properties": { "foo": "bar" }, "source": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e" } ], "has_more": true, "next_cursor": "next_cursor", "total": 0 } ``` ## Get object `client.prism.objects.identities.get(stringidentityID, IdentityGetParamsparams?, RequestOptionsoptions?): IdentityGetResponse` **get** `/v2/prism/{teamId}/identity/{identityId}` Get object ### Parameters - `identityID: string` - `params: IdentityGetParams` - `teamId?: string` Path param - `select?: string` Query param: Comma-separated property slugs to return. Use dot notation for relationships. `id` is always returned at the top level. Defaults to all properties. ### Returns - `IdentityGetResponse` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); const identity = await client.prism.objects.identities.get('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e'); console.log(identity.id); ``` #### Response ```json { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "default": { "foo": "bar" }, "list": {} } ``` ## Patch object `client.prism.objects.identities.update(stringidentityID, IdentityUpdateParamsparams, RequestOptionsoptions?): IdentityUpdateResponse` **patch** `/v2/prism/{teamId}/identity/{identityId}` Patch object ### Parameters - `identityID: string` - `params: IdentityUpdateParams` - `teamId?: string` Path param - `_default?: Record` Body param: Properties keyed by property slug. Values can be strings, numbers, booleans, arrays, or null. For select/multiselect properties, values may be option slugs or option UUIDs on write; option slugs are returned on read. - `list?: unknown` Body param - `idempotencyKey?: string` Header param: A unique key (UUID or any opaque string up to 255 chars) that identifies this logical request. The server caches the first response under this key for 24 hours and replays it on retry — safe to use on every POST/PUT/PATCH to make network retries deterministic. Reusing the same key with a different body returns 409 `idempotency_key_mismatch`. Replays include the `idempotent-replay: true` response header. - `ifMatch?: string` Header param: Optimistic concurrency. Pass back the `etag` header from a previous GET of this record; the write only proceeds if the record hasn't changed since. Mismatch → 412 `precondition_failed`. Use `*` to require the record exists (any ETag accepted). ### Returns - `IdentityUpdateResponse` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); const identity = await client.prism.objects.identities.update( '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', ); console.log(identity.id); ``` #### Response ```json { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "default": { "foo": "bar" }, "list": {} } ``` ## Delete object `client.prism.objects.identities.delete(stringidentityID, IdentityDeleteParamsparams?, RequestOptionsoptions?): void` **delete** `/v2/prism/{teamId}/identity/{identityId}` Delete object ### Parameters - `identityID: string` - `params: IdentityDeleteParams` - `teamId?: string` Path param - `ifMatch?: string` Header param: Optimistic concurrency. Pass back the `etag` header from a previous GET of this record; the write only proceeds if the record hasn't changed since. Mismatch → 412 `precondition_failed`. Use `*` to require the record exists (any ETag accepted). ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); await client.prism.objects.identities.delete('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e'); ``` ## Query `client.prism.objects.identities.query(IdentityQueryParamsparams, RequestOptionsoptions?): IdentityQueryResponse` **post** `/v2/prism/{teamId}/identity/query` Query ### Parameters - `params: IdentityQueryParams` - `teamId?: string` Path param - `query: Query` Body param - `select: Array` Property slugs to select. Use dot notation for relationships (e.g. attendee.contact.first_name). `id` is always returned at the top level of each row and does not need to be selected. - `combinator?: "AND" | "OR"` Logical operator for combining filters - `"AND"` - `"OR"` - `cursor?: string` Opaque cursor from a previous response's `next_cursor`. Pass it back unchanged to fetch the next page. When set, `page` and `limit` are derived from the cursor and any explicit values are ignored. - `filter?: Array>` Filters as [{ slug: { operator: value } }]. For select/multiselect properties, values may be option slugs or option UUIDs. - `PrismQueryFilterEq` - `"=": string | boolean` - `string` - `boolean` - `PrismQueryFilterNe` - `"!=": string | boolean` - `string` - `boolean` - `PrismQueryFilterLt` - `"<": string` - `PrismQueryFilterGt` - `">": string` - `PrismQueryFilterLte` - `"<=": string` - `PrismQueryFilterGte` - `">=": string` - `Contains` - `contains: string | boolean | Array` - `string` - `boolean` - `Array` - `BeginsWith` - `begins_with: string` - `EndsWith` - `ends_with: string` - `NotContains` - `not_contains: string` - `Exists` - `exists: boolean` - `NotExists` - `not_exists: boolean` - `IsNull` - `is_null: string | boolean | Array` - `string` - `boolean` - `Array` - `IsNotNull` - `is_not_null: string | boolean | Array` - `string` - `boolean` - `Array` - `Between` - `between: string | boolean | Array` - `string` - `boolean` - `Array` - `In` - `in: Array` - `NotIn` - `not_in: Array` - `limit?: number` Maximum number of rows to return. Capped server-side at 50; requests above the cap are rejected. - `list_id?: string` - `page?: number` Page number (1-based). Prefer `cursor`. Page-number pagination drifts under concurrent writes; use it only for one-shot exports. - `sort?: Array>` Sort order as [{ slug: direction }]. Array order determines sort priority - `"asc"` - `"desc"` - `id?: string | Array` Body param - `string` - `Array` - `boxes?: Array` Body param - `cursor?: string` Body param: Alternative location for the opaque cursor (sibling of `query`). Use whichever feels more natural; if both are present, `query.cursor` wins. - `deleted?: boolean` Body param - `include_total?: boolean` Body param: When true, the response includes a `total` field with the unpaginated row count. Costs an additional pass over the result set — for unfiltered totals prefer `GET /v2/prism/{teamId}/{objectType}/count` instead. - `sources?: Array` Body param ### Returns - `IdentityQueryResponse` - `data: Array` - `id: string` - `is_user_object?: boolean` - `properties?: Record` Selected property values keyed by property slug. For select/multiselect properties, option slugs are returned. For reference properties, values are nested `{ id, properties }` objects. - `source?: string | null` - `has_more: boolean` Accurate end-of-data signal. False when this page contains the last record; true only when at least one more record exists. (Implementation note: the server fetches one extra row internally to determine this — clients never need to overshoot to discover the end.) - `next_cursor?: string | null` Opaque cursor pointing at the next page. Pass it back unchanged in the request body (`cursor`) of the next call. Null when `has_more` is false. - `total?: number | null` Only populated when the request set `include_total: true`. Total number of records matching the query, ignoring pagination. Opt-in because it costs an additional pass over the result set. ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); const response = await client.prism.objects.identities.query({ query: { select: ['string'] } }); console.log(response.data); ``` #### Response ```json { "data": [ { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "is_user_object": true, "properties": { "foo": "bar" }, "source": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e" } ], "has_more": true, "next_cursor": "next_cursor", "total": 0 } ``` ## Total record count for an object type `client.prism.objects.identities.count(IdentityCountParamsparams?, RequestOptionsoptions?): IdentityCountResponse` **get** `/v2/prism/{teamId}/identity/count` Returns the total number of records of this object type that the caller can see. Avoids the page-overshoot anti-pattern — clients no longer need to keep paging until `has_more` flips false to discover the total. Currently does not apply query filters; for a filtered total, pass `include_total: true` in a POST `/query` body. ### Parameters - `params: IdentityCountParams` - `teamId?: string` Path param - `list_id?: string` Query param: Scope the count to a specific list/app. ### Returns - `IdentityCountResponse` - `total: number` Number of records matching the access scope. ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); const response = await client.prism.objects.identities.count(); console.log(response.total); ``` #### Response ```json { "total": 0 } ``` ## Find a record by property value `client.prism.objects.identities.find(stringvalue, IdentityFindParamsparams, RequestOptionsoptions?): IdentityFindResponse` **get** `/v2/prism/{teamId}/identity/by/{slug}/{value}` Returns the single record whose property `{slug}` equals `{value}`. 404 if nothing matches; 409 if more than one record matches. ### Parameters - `value: string` - `params: IdentityFindParams` - `teamId?: string` Path param - `slug: string` Path param: Property slug to match (e.g. `email`). - `list_id?: string` Query param: Scope the lookup to a specific list/app. ### Returns - `IdentityFindResponse` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); const response = await client.prism.objects.identities.find('value', { slug: 'slug' }); console.log(response.id); ``` #### Response ```json { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "default": { "foo": "bar" }, "list": {} } ``` ## Upsert by property value `client.prism.objects.identities.upsert(stringvalue, IdentityUpsertParamsparams, RequestOptionsoptions?): IdentityUpsertResponse` **put** `/v2/prism/{teamId}/identity/by/{slug}/{value}` Idempotent create-or-update keyed on `{slug}={value}`. If exactly one record matches, it is patched and 200 is returned. If none match, a new record is created (with the lookup property set if absent) and 201 is returned. If multiple records match, 409 is returned and you should patch by id instead. ### Parameters - `value: string` - `params: IdentityUpsertParams` - `teamId?: string` Path param - `slug: string` Path param - `_default?: Record` Body param: Properties keyed by property slug. Values can be strings, numbers, booleans, arrays, or null. For select/multiselect properties, values may be option slugs or option UUIDs on write; option slugs are returned on read. - `list?: unknown` Body param - `idempotencyKey?: string` Header param: A unique key (UUID or any opaque string up to 255 chars) that identifies this logical request. The server caches the first response under this key for 24 hours and replays it on retry — safe to use on every POST/PUT/PATCH to make network retries deterministic. Reusing the same key with a different body returns 409 `idempotency_key_mismatch`. Replays include the `idempotent-replay: true` response header. ### Returns - `IdentityUpsertResponse` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); const response = await client.prism.objects.identities.upsert('value', { slug: 'slug' }); console.log(response.id); ``` #### Response ```json { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "default": { "foo": "bar" }, "list": {} } ``` ## Import objects `client.prism.objects.identities.bulkCreate(IdentityBulkCreateParamsparams, RequestOptionsoptions?): IdentityBulkCreateResponse` **post** `/v2/prism/{teamId}/identity/import` Import multiple objects in batch. Properties are keyed by slug. Automatically routes based on size: small batches complete synchronously and return 200 with the final `ImportJob`; large batches start an async job, return 202 with `status: processing` and a `Location` header, and can be polled via `GET /v2/prism/{teamId}/imports/{jobId}`. ### Parameters - `params: IdentityBulkCreateParams` - `teamId?: string` Path param - `objects: Array` Body param: Array of objects to import with property values keyed by slug - `default?: Record` Properties keyed by property slug. Values can be strings, numbers, booleans, arrays, or null. For select/multiselect properties, values may be option slugs or option UUIDs on write; option slugs are returned on read. - `list?: unknown` - `options?: Options` Body param - `caseInsensitive?: boolean` Whether deduplication should be case insensitive - `dedupe_by?: string` Property slug to deduplicate on - `list_id?: string` App/CRM ID for context (optional) - `idempotencyKey?: string` Header param: A unique key (UUID or any opaque string up to 255 chars) that identifies this logical request. The server caches the first response under this key for 24 hours and replays it on retry — safe to use on every POST/PUT/PATCH to make network retries deterministic. Reusing the same key with a different body returns 409 `idempotency_key_mismatch`. Replays include the `idempotent-replay: true` response header. ### Returns - `IdentityBulkCreateResponse` Status snapshot of an import job. Same shape used by the POST /import response and by GET /imports/{jobId}. - `job_id: string | null` Null for sync imports (results inlined). Set for async imports. - `status: "complete" | "processing" | "failed"` - `"complete"` - `"processing"` - `"failed"` - `total: number` Total number of rows in the import. - `created_at?: string` - `error?: Error` Set when status=failed; describes the job-level failure (not per-row). - `code?: string` - `message?: string` - `expires_at?: string` - `failed?: number` - `processed?: number` Rows that have been attempted (succeeded + failed). - `results?: Array` Per-row outcomes. Always present for sync imports; populated for async imports once the job reaches `complete`. - `id?: string | null` - `created?: boolean` - `error?: Error` - `code?: string` - `message?: string` - `existing?: boolean` True if the row matched an existing record via the dedupe key. - `succeeded?: number` - `updated_at?: string` ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); const response = await client.prism.objects.identities.bulkCreate({ objects: [{}] }); console.log(response.job_id); ``` #### Response ```json { "job_id": "job_id", "status": "complete", "total": 0, "created_at": "2019-12-27T18:11:19.117Z", "error": { "code": "code", "message": "message" }, "expires_at": "2019-12-27T18:11:19.117Z", "failed": 0, "processed": 0, "results": [ { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "created": true, "error": { "code": "code", "message": "message" }, "existing": true } ], "succeeded": 0, "updated_at": "2019-12-27T18:11:19.117Z" } ``` ## Bulk update records (partial success) `client.prism.objects.identities.bulkUpdate(IdentityBulkUpdateParamsparams, RequestOptionsoptions?): IdentityBulkUpdateResponse` **post** `/v2/prism/{teamId}/identity/batch/update` Patch up to 100 records in a single call. Each item is attempted independently — failures don't abort the batch. Inspect `results[].status` per item. ### Parameters - `params: IdentityBulkUpdateParams` - `teamId?: string` Path param - `items: Array` Body param - `id: string` - `idempotencyKey?: string` Header param: A unique key (UUID or any opaque string up to 255 chars) that identifies this logical request. The server caches the first response under this key for 24 hours and replays it on retry — safe to use on every POST/PUT/PATCH to make network retries deterministic. Reusing the same key with a different body returns 409 `idempotency_key_mismatch`. Replays include the `idempotent-replay: true` response header. ### Returns - `IdentityBulkUpdateResponse` Partial-success bulk operation result. Inspect `results[].status` per item; the operation as a whole returns 200 even if some items failed. - `results: Array` - `id: string | null` Item ID, or null if the input was unparseable. - `status: "ok" | "error"` - `"ok"` - `"error"` - `error?: Error` - `code?: string` - `message?: string` - `record?: Record` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` - `summary: Summary` - `failed: number` - `succeeded: number` - `total: number` ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); const response = await client.prism.objects.identities.bulkUpdate({ items: [{ id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e' }], }); console.log(response.results); ``` #### Response ```json { "results": [ { "id": "id", "status": "ok", "error": { "code": "code", "message": "message" }, "record": { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "default": { "foo": "bar" }, "list": {} } } ], "summary": { "failed": 0, "succeeded": 0, "total": 0 } } ``` ## Bulk delete records (partial success) `client.prism.objects.identities.bulkDelete(IdentityBulkDeleteParamsparams, RequestOptionsoptions?): IdentityBulkDeleteResponse` **post** `/v2/prism/{teamId}/identity/batch/delete` Soft-delete up to 100 records in a single call. Same partial-success contract as batch/update. ### Parameters - `params: IdentityBulkDeleteParams` - `teamId?: string` Path param - `ids: Array` Body param - `idempotencyKey?: string` Header param: A unique key (UUID or any opaque string up to 255 chars) that identifies this logical request. The server caches the first response under this key for 24 hours and replays it on retry — safe to use on every POST/PUT/PATCH to make network retries deterministic. Reusing the same key with a different body returns 409 `idempotency_key_mismatch`. Replays include the `idempotent-replay: true` response header. ### Returns - `IdentityBulkDeleteResponse` Partial-success bulk operation result. Inspect `results[].status` per item; the operation as a whole returns 200 even if some items failed. - `results: Array` - `id: string | null` Item ID, or null if the input was unparseable. - `status: "ok" | "error"` - `"ok"` - `"error"` - `error?: Error` - `code?: string` - `message?: string` - `record?: Record` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` - `summary: Summary` - `failed: number` - `succeeded: number` - `total: number` ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); const response = await client.prism.objects.identities.bulkDelete({ ids: ['182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e'], }); console.log(response.results); ``` #### Response ```json { "results": [ { "id": "id", "status": "ok", "error": { "code": "code", "message": "message" }, "record": { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "default": { "foo": "bar" }, "list": {} } } ], "summary": { "failed": 0, "succeeded": 0, "total": 0 } } ``` ## Duplicate object `client.prism.objects.identities.duplicate(stringidentityID, IdentityDuplicateParamsparams?, RequestOptionsoptions?): IdentityDuplicateResponse` **post** `/v2/prism/{teamId}/identity/{identityId}/duplicate` Duplicate object ### Parameters - `identityID: string` - `params: IdentityDuplicateParams` - `teamId?: string` Path param - `idempotencyKey?: string` Header param: A unique key (UUID or any opaque string up to 255 chars) that identifies this logical request. The server caches the first response under this key for 24 hours and replays it on retry — safe to use on every POST/PUT/PATCH to make network retries deterministic. Reusing the same key with a different body returns 409 `idempotency_key_mismatch`. Replays include the `idempotent-replay: true` response header. ### Returns - `IdentityDuplicateResponse` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); const response = await client.prism.objects.identities.duplicate( '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', ); console.log(response.id); ``` #### Response ```json { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "default": { "foo": "bar" }, "list": {} } ``` ## Restore object `client.prism.objects.identities.restore(stringidentityID, IdentityRestoreParamsparams?, RequestOptionsoptions?): IdentityRestoreResponse` **post** `/v2/prism/{teamId}/identity/{identityId}/restore` Restore object ### Parameters - `identityID: string` - `params: IdentityRestoreParams` - `teamId?: string` Path param - `idempotencyKey?: string` Header param: A unique key (UUID or any opaque string up to 255 chars) that identifies this logical request. The server caches the first response under this key for 24 hours and replays it on retry — safe to use on every POST/PUT/PATCH to make network retries deterministic. Reusing the same key with a different body returns 409 `idempotency_key_mismatch`. Replays include the `idempotent-replay: true` response header. ### Returns - `IdentityRestoreResponse` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); const response = await client.prism.objects.identities.restore( '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', ); console.log(response.id); ``` #### Response ```json { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "default": { "foo": "bar" }, "list": {} } ``` ## Domain Types ### Identity - `Identity` - `default?: Record` Properties keyed by property slug. Values can be strings, numbers, booleans, arrays, or null. For select/multiselect properties, values may be option slugs or option UUIDs on write; option slugs are returned on read. - `list?: unknown` ### Identity Create Response - `IdentityCreateResponse` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` ### Identity List Response - `IdentityListResponse` - `data: Array` - `id: string` - `is_user_object?: boolean` - `properties?: Record` Selected property values keyed by property slug. For select/multiselect properties, option slugs are returned. For reference properties, values are nested `{ id, properties }` objects. - `source?: string | null` - `has_more: boolean` Accurate end-of-data signal — false on the last page, never forces clients to overshoot. - `next_cursor?: string | null` - `total?: number | null` Populated only when `?include_total=true` was passed. ### Identity Get Response - `IdentityGetResponse` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` ### Identity Update Response - `IdentityUpdateResponse` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` ### Identity Query Response - `IdentityQueryResponse` - `data: Array` - `id: string` - `is_user_object?: boolean` - `properties?: Record` Selected property values keyed by property slug. For select/multiselect properties, option slugs are returned. For reference properties, values are nested `{ id, properties }` objects. - `source?: string | null` - `has_more: boolean` Accurate end-of-data signal. False when this page contains the last record; true only when at least one more record exists. (Implementation note: the server fetches one extra row internally to determine this — clients never need to overshoot to discover the end.) - `next_cursor?: string | null` Opaque cursor pointing at the next page. Pass it back unchanged in the request body (`cursor`) of the next call. Null when `has_more` is false. - `total?: number | null` Only populated when the request set `include_total: true`. Total number of records matching the query, ignoring pagination. Opt-in because it costs an additional pass over the result set. ### Identity Count Response - `IdentityCountResponse` - `total: number` Number of records matching the access scope. ### Identity Find Response - `IdentityFindResponse` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` ### Identity Upsert Response - `IdentityUpsertResponse` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` ### Identity Bulk Create Response - `IdentityBulkCreateResponse` Status snapshot of an import job. Same shape used by the POST /import response and by GET /imports/{jobId}. - `job_id: string | null` Null for sync imports (results inlined). Set for async imports. - `status: "complete" | "processing" | "failed"` - `"complete"` - `"processing"` - `"failed"` - `total: number` Total number of rows in the import. - `created_at?: string` - `error?: Error` Set when status=failed; describes the job-level failure (not per-row). - `code?: string` - `message?: string` - `expires_at?: string` - `failed?: number` - `processed?: number` Rows that have been attempted (succeeded + failed). - `results?: Array` Per-row outcomes. Always present for sync imports; populated for async imports once the job reaches `complete`. - `id?: string | null` - `created?: boolean` - `error?: Error` - `code?: string` - `message?: string` - `existing?: boolean` True if the row matched an existing record via the dedupe key. - `succeeded?: number` - `updated_at?: string` ### Identity Bulk Update Response - `IdentityBulkUpdateResponse` Partial-success bulk operation result. Inspect `results[].status` per item; the operation as a whole returns 200 even if some items failed. - `results: Array` - `id: string | null` Item ID, or null if the input was unparseable. - `status: "ok" | "error"` - `"ok"` - `"error"` - `error?: Error` - `code?: string` - `message?: string` - `record?: Record` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` - `summary: Summary` - `failed: number` - `succeeded: number` - `total: number` ### Identity Bulk Delete Response - `IdentityBulkDeleteResponse` Partial-success bulk operation result. Inspect `results[].status` per item; the operation as a whole returns 200 even if some items failed. - `results: Array` - `id: string | null` Item ID, or null if the input was unparseable. - `status: "ok" | "error"` - `"ok"` - `"error"` - `error?: Error` - `code?: string` - `message?: string` - `record?: Record` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` - `summary: Summary` - `failed: number` - `succeeded: number` - `total: number` ### Identity Duplicate Response - `IdentityDuplicateResponse` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` ### Identity Restore Response - `IdentityRestoreResponse` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` # Deals ## Create object `client.prism.objects.deals.create(DealCreateParamsparams?, RequestOptionsoptions?): DealCreateResponse` **post** `/v2/prism/{teamId}/deal` Create object ### Parameters - `params: DealCreateParams` - `teamId?: string` Path param - `_default?: Record` Body param: Properties keyed by property slug. Values can be strings, numbers, booleans, arrays, or null. For select/multiselect properties, values may be option slugs or option UUIDs on write; option slugs are returned on read. - `list?: unknown` Body param - `idempotencyKey?: string` Header param: A unique key (UUID or any opaque string up to 255 chars) that identifies this logical request. The server caches the first response under this key for 24 hours and replays it on retry — safe to use on every POST/PUT/PATCH to make network retries deterministic. Reusing the same key with a different body returns 409 `idempotency_key_mismatch`. Replays include the `idempotent-replay: true` response header. ### Returns - `DealCreateResponse` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); const deal = await client.prism.objects.deals.create(); console.log(deal.id); ``` #### Response ```json { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "default": { "foo": "bar" }, "list": {} } ``` ## List records of an object type `client.prism.objects.deals.list(DealListParamsparams?, RequestOptionsoptions?): DealListResponse` **get** `/v2/prism/{teamId}/deal` Convenience list endpoint. Equivalent to `POST /v2/prism/{teamId}/{objectType}/query` with an empty body, plus query-string sugar for the common cases. Any unrecognized query parameter is interpreted as an equality filter on a property of that name; pass arrays for `in`. Values are received as strings, so non-string property filters via this endpoint may not work — use the `query` endpoint for typed comparisons or anything beyond simple equality. ### Parameters - `params: DealListParams` - `teamId?: string` Path param - `cursor?: string` Query param: Opaque cursor from a previous response's `next_cursor`. Pass it back unchanged to fetch the next page. - `deleted?: boolean` Query param: Include soft-deleted records. Pass the literal string `true`. - `include_total?: boolean` Query param: When set to `true`, the response includes a `total` field with the unpaginated row count. Costs an extra pass; prefer `GET .../count` for the unfiltered total. - `limit?: number` Query param: Maximum number of rows to return. Capped server-side at 50. - `list_id?: string` Query param: Scope properties to a specific list/app. - `select?: string` Query param: Comma-separated property slugs to return. Use dot notation for relationships. `id` is always returned at the top level. Defaults to all properties. - `sort?: string` Query param: Comma-separated list of slugs. Prefix with `-` for descending. Example: `sort=-updated_at,name`. ### Returns - `DealListResponse` - `data: Array` - `id: string` - `is_user_object?: boolean` - `properties?: Record` Selected property values keyed by property slug. For select/multiselect properties, option slugs are returned. For reference properties, values are nested `{ id, properties }` objects. - `source?: string | null` - `has_more: boolean` Accurate end-of-data signal — false on the last page, never forces clients to overshoot. - `next_cursor?: string | null` - `total?: number | null` Populated only when `?include_total=true` was passed. ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); const deals = await client.prism.objects.deals.list(); console.log(deals.data); ``` #### Response ```json { "data": [ { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "is_user_object": true, "properties": { "foo": "bar" }, "source": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e" } ], "has_more": true, "next_cursor": "next_cursor", "total": 0 } ``` ## Get object `client.prism.objects.deals.get(stringdealID, DealGetParamsparams?, RequestOptionsoptions?): DealGetResponse` **get** `/v2/prism/{teamId}/deal/{dealId}` Get object ### Parameters - `dealID: string` - `params: DealGetParams` - `teamId?: string` Path param - `select?: string` Query param: Comma-separated property slugs to return. Use dot notation for relationships. `id` is always returned at the top level. Defaults to all properties. ### Returns - `DealGetResponse` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); const deal = await client.prism.objects.deals.get('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e'); console.log(deal.id); ``` #### Response ```json { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "default": { "foo": "bar" }, "list": {} } ``` ## Patch object `client.prism.objects.deals.update(stringdealID, DealUpdateParamsparams, RequestOptionsoptions?): DealUpdateResponse` **patch** `/v2/prism/{teamId}/deal/{dealId}` Patch object ### Parameters - `dealID: string` - `params: DealUpdateParams` - `teamId?: string` Path param - `_default?: Record` Body param: Properties keyed by property slug. Values can be strings, numbers, booleans, arrays, or null. For select/multiselect properties, values may be option slugs or option UUIDs on write; option slugs are returned on read. - `list?: unknown` Body param - `idempotencyKey?: string` Header param: A unique key (UUID or any opaque string up to 255 chars) that identifies this logical request. The server caches the first response under this key for 24 hours and replays it on retry — safe to use on every POST/PUT/PATCH to make network retries deterministic. Reusing the same key with a different body returns 409 `idempotency_key_mismatch`. Replays include the `idempotent-replay: true` response header. - `ifMatch?: string` Header param: Optimistic concurrency. Pass back the `etag` header from a previous GET of this record; the write only proceeds if the record hasn't changed since. Mismatch → 412 `precondition_failed`. Use `*` to require the record exists (any ETag accepted). ### Returns - `DealUpdateResponse` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); const deal = await client.prism.objects.deals.update('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e'); console.log(deal.id); ``` #### Response ```json { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "default": { "foo": "bar" }, "list": {} } ``` ## Delete object `client.prism.objects.deals.delete(stringdealID, DealDeleteParamsparams?, RequestOptionsoptions?): void` **delete** `/v2/prism/{teamId}/deal/{dealId}` Delete object ### Parameters - `dealID: string` - `params: DealDeleteParams` - `teamId?: string` Path param - `ifMatch?: string` Header param: Optimistic concurrency. Pass back the `etag` header from a previous GET of this record; the write only proceeds if the record hasn't changed since. Mismatch → 412 `precondition_failed`. Use `*` to require the record exists (any ETag accepted). ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); await client.prism.objects.deals.delete('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e'); ``` ## Query `client.prism.objects.deals.query(DealQueryParamsparams, RequestOptionsoptions?): DealQueryResponse` **post** `/v2/prism/{teamId}/deal/query` Query ### Parameters - `params: DealQueryParams` - `teamId?: string` Path param - `query: Query` Body param - `select: Array` Property slugs to select. Use dot notation for relationships (e.g. attendee.contact.first_name). `id` is always returned at the top level of each row and does not need to be selected. - `combinator?: "AND" | "OR"` Logical operator for combining filters - `"AND"` - `"OR"` - `cursor?: string` Opaque cursor from a previous response's `next_cursor`. Pass it back unchanged to fetch the next page. When set, `page` and `limit` are derived from the cursor and any explicit values are ignored. - `filter?: Array>` Filters as [{ slug: { operator: value } }]. For select/multiselect properties, values may be option slugs or option UUIDs. - `PrismQueryFilterEq` - `"=": string | boolean` - `string` - `boolean` - `PrismQueryFilterNe` - `"!=": string | boolean` - `string` - `boolean` - `PrismQueryFilterLt` - `"<": string` - `PrismQueryFilterGt` - `">": string` - `PrismQueryFilterLte` - `"<=": string` - `PrismQueryFilterGte` - `">=": string` - `Contains` - `contains: string | boolean | Array` - `string` - `boolean` - `Array` - `BeginsWith` - `begins_with: string` - `EndsWith` - `ends_with: string` - `NotContains` - `not_contains: string` - `Exists` - `exists: boolean` - `NotExists` - `not_exists: boolean` - `IsNull` - `is_null: string | boolean | Array` - `string` - `boolean` - `Array` - `IsNotNull` - `is_not_null: string | boolean | Array` - `string` - `boolean` - `Array` - `Between` - `between: string | boolean | Array` - `string` - `boolean` - `Array` - `In` - `in: Array` - `NotIn` - `not_in: Array` - `limit?: number` Maximum number of rows to return. Capped server-side at 50; requests above the cap are rejected. - `list_id?: string` - `page?: number` Page number (1-based). Prefer `cursor`. Page-number pagination drifts under concurrent writes; use it only for one-shot exports. - `sort?: Array>` Sort order as [{ slug: direction }]. Array order determines sort priority - `"asc"` - `"desc"` - `id?: string | Array` Body param - `string` - `Array` - `boxes?: Array` Body param - `cursor?: string` Body param: Alternative location for the opaque cursor (sibling of `query`). Use whichever feels more natural; if both are present, `query.cursor` wins. - `deleted?: boolean` Body param - `include_total?: boolean` Body param: When true, the response includes a `total` field with the unpaginated row count. Costs an additional pass over the result set — for unfiltered totals prefer `GET /v2/prism/{teamId}/{objectType}/count` instead. - `sources?: Array` Body param ### Returns - `DealQueryResponse` - `data: Array` - `id: string` - `is_user_object?: boolean` - `properties?: Record` Selected property values keyed by property slug. For select/multiselect properties, option slugs are returned. For reference properties, values are nested `{ id, properties }` objects. - `source?: string | null` - `has_more: boolean` Accurate end-of-data signal. False when this page contains the last record; true only when at least one more record exists. (Implementation note: the server fetches one extra row internally to determine this — clients never need to overshoot to discover the end.) - `next_cursor?: string | null` Opaque cursor pointing at the next page. Pass it back unchanged in the request body (`cursor`) of the next call. Null when `has_more` is false. - `total?: number | null` Only populated when the request set `include_total: true`. Total number of records matching the query, ignoring pagination. Opt-in because it costs an additional pass over the result set. ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); const response = await client.prism.objects.deals.query({ query: { select: ['string'] } }); console.log(response.data); ``` #### Response ```json { "data": [ { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "is_user_object": true, "properties": { "foo": "bar" }, "source": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e" } ], "has_more": true, "next_cursor": "next_cursor", "total": 0 } ``` ## Total record count for an object type `client.prism.objects.deals.count(DealCountParamsparams?, RequestOptionsoptions?): DealCountResponse` **get** `/v2/prism/{teamId}/deal/count` Returns the total number of records of this object type that the caller can see. Avoids the page-overshoot anti-pattern — clients no longer need to keep paging until `has_more` flips false to discover the total. Currently does not apply query filters; for a filtered total, pass `include_total: true` in a POST `/query` body. ### Parameters - `params: DealCountParams` - `teamId?: string` Path param - `list_id?: string` Query param: Scope the count to a specific list/app. ### Returns - `DealCountResponse` - `total: number` Number of records matching the access scope. ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); const response = await client.prism.objects.deals.count(); console.log(response.total); ``` #### Response ```json { "total": 0 } ``` ## Find a record by property value `client.prism.objects.deals.find(stringvalue, DealFindParamsparams, RequestOptionsoptions?): DealFindResponse` **get** `/v2/prism/{teamId}/deal/by/{slug}/{value}` Returns the single record whose property `{slug}` equals `{value}`. 404 if nothing matches; 409 if more than one record matches. ### Parameters - `value: string` - `params: DealFindParams` - `teamId?: string` Path param - `slug: string` Path param: Property slug to match (e.g. `email`). - `list_id?: string` Query param: Scope the lookup to a specific list/app. ### Returns - `DealFindResponse` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); const response = await client.prism.objects.deals.find('value', { slug: 'slug' }); console.log(response.id); ``` #### Response ```json { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "default": { "foo": "bar" }, "list": {} } ``` ## Upsert by property value `client.prism.objects.deals.upsert(stringvalue, DealUpsertParamsparams, RequestOptionsoptions?): DealUpsertResponse` **put** `/v2/prism/{teamId}/deal/by/{slug}/{value}` Idempotent create-or-update keyed on `{slug}={value}`. If exactly one record matches, it is patched and 200 is returned. If none match, a new record is created (with the lookup property set if absent) and 201 is returned. If multiple records match, 409 is returned and you should patch by id instead. ### Parameters - `value: string` - `params: DealUpsertParams` - `teamId?: string` Path param - `slug: string` Path param - `_default?: Record` Body param: Properties keyed by property slug. Values can be strings, numbers, booleans, arrays, or null. For select/multiselect properties, values may be option slugs or option UUIDs on write; option slugs are returned on read. - `list?: unknown` Body param - `idempotencyKey?: string` Header param: A unique key (UUID or any opaque string up to 255 chars) that identifies this logical request. The server caches the first response under this key for 24 hours and replays it on retry — safe to use on every POST/PUT/PATCH to make network retries deterministic. Reusing the same key with a different body returns 409 `idempotency_key_mismatch`. Replays include the `idempotent-replay: true` response header. ### Returns - `DealUpsertResponse` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); const response = await client.prism.objects.deals.upsert('value', { slug: 'slug' }); console.log(response.id); ``` #### Response ```json { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "default": { "foo": "bar" }, "list": {} } ``` ## Import objects `client.prism.objects.deals.bulkCreate(DealBulkCreateParamsparams, RequestOptionsoptions?): DealBulkCreateResponse` **post** `/v2/prism/{teamId}/deal/import` Import multiple objects in batch. Properties are keyed by slug. Automatically routes based on size: small batches complete synchronously and return 200 with the final `ImportJob`; large batches start an async job, return 202 with `status: processing` and a `Location` header, and can be polled via `GET /v2/prism/{teamId}/imports/{jobId}`. ### Parameters - `params: DealBulkCreateParams` - `teamId?: string` Path param - `objects: Array` Body param: Array of objects to import with property values keyed by slug - `default?: Record` Properties keyed by property slug. Values can be strings, numbers, booleans, arrays, or null. For select/multiselect properties, values may be option slugs or option UUIDs on write; option slugs are returned on read. - `list?: unknown` - `options?: Options` Body param - `caseInsensitive?: boolean` Whether deduplication should be case insensitive - `dedupe_by?: string` Property slug to deduplicate on - `list_id?: string` App/CRM ID for context (optional) - `idempotencyKey?: string` Header param: A unique key (UUID or any opaque string up to 255 chars) that identifies this logical request. The server caches the first response under this key for 24 hours and replays it on retry — safe to use on every POST/PUT/PATCH to make network retries deterministic. Reusing the same key with a different body returns 409 `idempotency_key_mismatch`. Replays include the `idempotent-replay: true` response header. ### Returns - `DealBulkCreateResponse` Status snapshot of an import job. Same shape used by the POST /import response and by GET /imports/{jobId}. - `job_id: string | null` Null for sync imports (results inlined). Set for async imports. - `status: "complete" | "processing" | "failed"` - `"complete"` - `"processing"` - `"failed"` - `total: number` Total number of rows in the import. - `created_at?: string` - `error?: Error` Set when status=failed; describes the job-level failure (not per-row). - `code?: string` - `message?: string` - `expires_at?: string` - `failed?: number` - `processed?: number` Rows that have been attempted (succeeded + failed). - `results?: Array` Per-row outcomes. Always present for sync imports; populated for async imports once the job reaches `complete`. - `id?: string | null` - `created?: boolean` - `error?: Error` - `code?: string` - `message?: string` - `existing?: boolean` True if the row matched an existing record via the dedupe key. - `succeeded?: number` - `updated_at?: string` ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); const response = await client.prism.objects.deals.bulkCreate({ objects: [{}] }); console.log(response.job_id); ``` #### Response ```json { "job_id": "job_id", "status": "complete", "total": 0, "created_at": "2019-12-27T18:11:19.117Z", "error": { "code": "code", "message": "message" }, "expires_at": "2019-12-27T18:11:19.117Z", "failed": 0, "processed": 0, "results": [ { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "created": true, "error": { "code": "code", "message": "message" }, "existing": true } ], "succeeded": 0, "updated_at": "2019-12-27T18:11:19.117Z" } ``` ## Bulk update records (partial success) `client.prism.objects.deals.bulkUpdate(DealBulkUpdateParamsparams, RequestOptionsoptions?): DealBulkUpdateResponse` **post** `/v2/prism/{teamId}/deal/batch/update` Patch up to 100 records in a single call. Each item is attempted independently — failures don't abort the batch. Inspect `results[].status` per item. ### Parameters - `params: DealBulkUpdateParams` - `teamId?: string` Path param - `items: Array` Body param - `id: string` - `idempotencyKey?: string` Header param: A unique key (UUID or any opaque string up to 255 chars) that identifies this logical request. The server caches the first response under this key for 24 hours and replays it on retry — safe to use on every POST/PUT/PATCH to make network retries deterministic. Reusing the same key with a different body returns 409 `idempotency_key_mismatch`. Replays include the `idempotent-replay: true` response header. ### Returns - `DealBulkUpdateResponse` Partial-success bulk operation result. Inspect `results[].status` per item; the operation as a whole returns 200 even if some items failed. - `results: Array` - `id: string | null` Item ID, or null if the input was unparseable. - `status: "ok" | "error"` - `"ok"` - `"error"` - `error?: Error` - `code?: string` - `message?: string` - `record?: Record` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` - `summary: Summary` - `failed: number` - `succeeded: number` - `total: number` ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); const response = await client.prism.objects.deals.bulkUpdate({ items: [{ id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e' }], }); console.log(response.results); ``` #### Response ```json { "results": [ { "id": "id", "status": "ok", "error": { "code": "code", "message": "message" }, "record": { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "default": { "foo": "bar" }, "list": {} } } ], "summary": { "failed": 0, "succeeded": 0, "total": 0 } } ``` ## Bulk delete records (partial success) `client.prism.objects.deals.bulkDelete(DealBulkDeleteParamsparams, RequestOptionsoptions?): DealBulkDeleteResponse` **post** `/v2/prism/{teamId}/deal/batch/delete` Soft-delete up to 100 records in a single call. Same partial-success contract as batch/update. ### Parameters - `params: DealBulkDeleteParams` - `teamId?: string` Path param - `ids: Array` Body param - `idempotencyKey?: string` Header param: A unique key (UUID or any opaque string up to 255 chars) that identifies this logical request. The server caches the first response under this key for 24 hours and replays it on retry — safe to use on every POST/PUT/PATCH to make network retries deterministic. Reusing the same key with a different body returns 409 `idempotency_key_mismatch`. Replays include the `idempotent-replay: true` response header. ### Returns - `DealBulkDeleteResponse` Partial-success bulk operation result. Inspect `results[].status` per item; the operation as a whole returns 200 even if some items failed. - `results: Array` - `id: string | null` Item ID, or null if the input was unparseable. - `status: "ok" | "error"` - `"ok"` - `"error"` - `error?: Error` - `code?: string` - `message?: string` - `record?: Record` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` - `summary: Summary` - `failed: number` - `succeeded: number` - `total: number` ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); const response = await client.prism.objects.deals.bulkDelete({ ids: ['182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e'], }); console.log(response.results); ``` #### Response ```json { "results": [ { "id": "id", "status": "ok", "error": { "code": "code", "message": "message" }, "record": { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "default": { "foo": "bar" }, "list": {} } } ], "summary": { "failed": 0, "succeeded": 0, "total": 0 } } ``` ## Duplicate object `client.prism.objects.deals.duplicate(stringdealID, DealDuplicateParamsparams?, RequestOptionsoptions?): DealDuplicateResponse` **post** `/v2/prism/{teamId}/deal/{dealId}/duplicate` Duplicate object ### Parameters - `dealID: string` - `params: DealDuplicateParams` - `teamId?: string` Path param - `idempotencyKey?: string` Header param: A unique key (UUID or any opaque string up to 255 chars) that identifies this logical request. The server caches the first response under this key for 24 hours and replays it on retry — safe to use on every POST/PUT/PATCH to make network retries deterministic. Reusing the same key with a different body returns 409 `idempotency_key_mismatch`. Replays include the `idempotent-replay: true` response header. ### Returns - `DealDuplicateResponse` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); const response = await client.prism.objects.deals.duplicate('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e'); console.log(response.id); ``` #### Response ```json { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "default": { "foo": "bar" }, "list": {} } ``` ## Restore object `client.prism.objects.deals.restore(stringdealID, DealRestoreParamsparams?, RequestOptionsoptions?): DealRestoreResponse` **post** `/v2/prism/{teamId}/deal/{dealId}/restore` Restore object ### Parameters - `dealID: string` - `params: DealRestoreParams` - `teamId?: string` Path param - `idempotencyKey?: string` Header param: A unique key (UUID or any opaque string up to 255 chars) that identifies this logical request. The server caches the first response under this key for 24 hours and replays it on retry — safe to use on every POST/PUT/PATCH to make network retries deterministic. Reusing the same key with a different body returns 409 `idempotency_key_mismatch`. Replays include the `idempotent-replay: true` response header. ### Returns - `DealRestoreResponse` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); const response = await client.prism.objects.deals.restore('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e'); console.log(response.id); ``` #### Response ```json { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "default": { "foo": "bar" }, "list": {} } ``` ## Domain Types ### Deal - `Deal` - `default?: Record` Properties keyed by property slug. Values can be strings, numbers, booleans, arrays, or null. For select/multiselect properties, values may be option slugs or option UUIDs on write; option slugs are returned on read. - `list?: unknown` ### Deal Create Response - `DealCreateResponse` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` ### Deal List Response - `DealListResponse` - `data: Array` - `id: string` - `is_user_object?: boolean` - `properties?: Record` Selected property values keyed by property slug. For select/multiselect properties, option slugs are returned. For reference properties, values are nested `{ id, properties }` objects. - `source?: string | null` - `has_more: boolean` Accurate end-of-data signal — false on the last page, never forces clients to overshoot. - `next_cursor?: string | null` - `total?: number | null` Populated only when `?include_total=true` was passed. ### Deal Get Response - `DealGetResponse` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` ### Deal Update Response - `DealUpdateResponse` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` ### Deal Query Response - `DealQueryResponse` - `data: Array` - `id: string` - `is_user_object?: boolean` - `properties?: Record` Selected property values keyed by property slug. For select/multiselect properties, option slugs are returned. For reference properties, values are nested `{ id, properties }` objects. - `source?: string | null` - `has_more: boolean` Accurate end-of-data signal. False when this page contains the last record; true only when at least one more record exists. (Implementation note: the server fetches one extra row internally to determine this — clients never need to overshoot to discover the end.) - `next_cursor?: string | null` Opaque cursor pointing at the next page. Pass it back unchanged in the request body (`cursor`) of the next call. Null when `has_more` is false. - `total?: number | null` Only populated when the request set `include_total: true`. Total number of records matching the query, ignoring pagination. Opt-in because it costs an additional pass over the result set. ### Deal Count Response - `DealCountResponse` - `total: number` Number of records matching the access scope. ### Deal Find Response - `DealFindResponse` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` ### Deal Upsert Response - `DealUpsertResponse` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` ### Deal Bulk Create Response - `DealBulkCreateResponse` Status snapshot of an import job. Same shape used by the POST /import response and by GET /imports/{jobId}. - `job_id: string | null` Null for sync imports (results inlined). Set for async imports. - `status: "complete" | "processing" | "failed"` - `"complete"` - `"processing"` - `"failed"` - `total: number` Total number of rows in the import. - `created_at?: string` - `error?: Error` Set when status=failed; describes the job-level failure (not per-row). - `code?: string` - `message?: string` - `expires_at?: string` - `failed?: number` - `processed?: number` Rows that have been attempted (succeeded + failed). - `results?: Array` Per-row outcomes. Always present for sync imports; populated for async imports once the job reaches `complete`. - `id?: string | null` - `created?: boolean` - `error?: Error` - `code?: string` - `message?: string` - `existing?: boolean` True if the row matched an existing record via the dedupe key. - `succeeded?: number` - `updated_at?: string` ### Deal Bulk Update Response - `DealBulkUpdateResponse` Partial-success bulk operation result. Inspect `results[].status` per item; the operation as a whole returns 200 even if some items failed. - `results: Array` - `id: string | null` Item ID, or null if the input was unparseable. - `status: "ok" | "error"` - `"ok"` - `"error"` - `error?: Error` - `code?: string` - `message?: string` - `record?: Record` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` - `summary: Summary` - `failed: number` - `succeeded: number` - `total: number` ### Deal Bulk Delete Response - `DealBulkDeleteResponse` Partial-success bulk operation result. Inspect `results[].status` per item; the operation as a whole returns 200 even if some items failed. - `results: Array` - `id: string | null` Item ID, or null if the input was unparseable. - `status: "ok" | "error"` - `"ok"` - `"error"` - `error?: Error` - `code?: string` - `message?: string` - `record?: Record` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` - `summary: Summary` - `failed: number` - `succeeded: number` - `total: number` ### Deal Duplicate Response - `DealDuplicateResponse` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` ### Deal Restore Response - `DealRestoreResponse` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` # Grant ## Get grant `client.prism.objects.deals.grant.get(stringdealID, GrantGetParamsparams?, RequestOptionsoptions?): GrantGetResponse` **get** `/v2/prism/{teamId}/deal/{dealId}/grant` Get grant ### Parameters - `dealID: string` - `params: GrantGetParams` - `teamId?: string` ### Returns - `GrantGetResponse` - `team_group_id?: Array>` - `"a"` - `"r"` - `"w"` - `team_id?: Record` - `"a"` - `"r"` - `"w"` - `user_id?: Array>` - `"a"` - `"r"` - `"w"` ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); const grant = await client.prism.objects.deals.grant.get('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e'); console.log(grant.team_group_id); ``` #### Response ```json { "team_group_id": [ { "foo": "a" } ], "team_id": { "foo": "a" }, "user_id": [ { "foo": "a" } ] } ``` ## Update grant `client.prism.objects.deals.grant.update(stringdealID, GrantUpdateParamsparams, RequestOptionsoptions?): GrantUpdateResponse` **put** `/v2/prism/{teamId}/deal/{dealId}/grant` Update grant ### Parameters - `dealID: string` - `params: GrantUpdateParams` - `teamId?: string` Path param - `team_group_id?: Array>` Body param - `"a"` - `"r"` - `"w"` - `team_id?: Record` Body param - `"a"` - `"r"` - `"w"` - `user_id?: Array>` Body param - `"a"` - `"r"` - `"w"` - `idempotencyKey?: string` Header param: A unique key (UUID or any opaque string up to 255 chars) that identifies this logical request. The server caches the first response under this key for 24 hours and replays it on retry — safe to use on every POST/PUT/PATCH to make network retries deterministic. Reusing the same key with a different body returns 409 `idempotency_key_mismatch`. Replays include the `idempotent-replay: true` response header. ### Returns - `GrantUpdateResponse` - `team_group_id?: Array>` - `"a"` - `"r"` - `"w"` - `team_id?: Record` - `"a"` - `"r"` - `"w"` - `user_id?: Array>` - `"a"` - `"r"` - `"w"` ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); const grant = await client.prism.objects.deals.grant.update('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e'); console.log(grant.team_group_id); ``` #### Response ```json { "team_group_id": [ { "foo": "a" } ], "team_id": { "foo": "a" }, "user_id": [ { "foo": "a" } ] } ``` ## Domain Types ### Grant Get Response - `GrantGetResponse` - `team_group_id?: Array>` - `"a"` - `"r"` - `"w"` - `team_id?: Record` - `"a"` - `"r"` - `"w"` - `user_id?: Array>` - `"a"` - `"r"` - `"w"` ### Grant Update Response - `GrantUpdateResponse` - `team_group_id?: Array>` - `"a"` - `"r"` - `"w"` - `team_id?: Record` - `"a"` - `"r"` - `"w"` - `user_id?: Array>` - `"a"` - `"r"` - `"w"` # Actions ## Create object `client.prism.objects.actions.create(ActionCreateParamsparams?, RequestOptionsoptions?): ActionCreateResponse` **post** `/v2/prism/{teamId}/action` Create object ### Parameters - `params: ActionCreateParams` - `teamId?: string` Path param - `_default?: Record` Body param: Properties keyed by property slug. Values can be strings, numbers, booleans, arrays, or null. For select/multiselect properties, values may be option slugs or option UUIDs on write; option slugs are returned on read. - `list?: unknown` Body param - `idempotencyKey?: string` Header param: A unique key (UUID or any opaque string up to 255 chars) that identifies this logical request. The server caches the first response under this key for 24 hours and replays it on retry — safe to use on every POST/PUT/PATCH to make network retries deterministic. Reusing the same key with a different body returns 409 `idempotency_key_mismatch`. Replays include the `idempotent-replay: true` response header. ### Returns - `ActionCreateResponse` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); const action = await client.prism.objects.actions.create(); console.log(action.id); ``` #### Response ```json { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "default": { "foo": "bar" }, "list": {} } ``` ## List records of an object type `client.prism.objects.actions.list(ActionListParamsparams?, RequestOptionsoptions?): ActionListResponse` **get** `/v2/prism/{teamId}/action` Convenience list endpoint. Equivalent to `POST /v2/prism/{teamId}/{objectType}/query` with an empty body, plus query-string sugar for the common cases. Any unrecognized query parameter is interpreted as an equality filter on a property of that name; pass arrays for `in`. Values are received as strings, so non-string property filters via this endpoint may not work — use the `query` endpoint for typed comparisons or anything beyond simple equality. ### Parameters - `params: ActionListParams` - `teamId?: string` Path param - `cursor?: string` Query param: Opaque cursor from a previous response's `next_cursor`. Pass it back unchanged to fetch the next page. - `deleted?: boolean` Query param: Include soft-deleted records. Pass the literal string `true`. - `include_total?: boolean` Query param: When set to `true`, the response includes a `total` field with the unpaginated row count. Costs an extra pass; prefer `GET .../count` for the unfiltered total. - `limit?: number` Query param: Maximum number of rows to return. Capped server-side at 50. - `list_id?: string` Query param: Scope properties to a specific list/app. - `select?: string` Query param: Comma-separated property slugs to return. Use dot notation for relationships. `id` is always returned at the top level. Defaults to all properties. - `sort?: string` Query param: Comma-separated list of slugs. Prefix with `-` for descending. Example: `sort=-updated_at,name`. ### Returns - `ActionListResponse` - `data: Array` - `id: string` - `is_user_object?: boolean` - `properties?: Record` Selected property values keyed by property slug. For select/multiselect properties, option slugs are returned. For reference properties, values are nested `{ id, properties }` objects. - `source?: string | null` - `has_more: boolean` Accurate end-of-data signal — false on the last page, never forces clients to overshoot. - `next_cursor?: string | null` - `total?: number | null` Populated only when `?include_total=true` was passed. ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); const actions = await client.prism.objects.actions.list(); console.log(actions.data); ``` #### Response ```json { "data": [ { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "is_user_object": true, "properties": { "foo": "bar" }, "source": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e" } ], "has_more": true, "next_cursor": "next_cursor", "total": 0 } ``` ## Get object `client.prism.objects.actions.get(stringactionID, ActionGetParamsparams?, RequestOptionsoptions?): ActionGetResponse` **get** `/v2/prism/{teamId}/action/{actionId}` Get object ### Parameters - `actionID: string` - `params: ActionGetParams` - `teamId?: string` Path param - `select?: string` Query param: Comma-separated property slugs to return. Use dot notation for relationships. `id` is always returned at the top level. Defaults to all properties. ### Returns - `ActionGetResponse` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); const action = await client.prism.objects.actions.get('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e'); console.log(action.id); ``` #### Response ```json { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "default": { "foo": "bar" }, "list": {} } ``` ## Patch object `client.prism.objects.actions.update(stringactionID, ActionUpdateParamsparams, RequestOptionsoptions?): ActionUpdateResponse` **patch** `/v2/prism/{teamId}/action/{actionId}` Patch object ### Parameters - `actionID: string` - `params: ActionUpdateParams` - `teamId?: string` Path param - `_default?: Record` Body param: Properties keyed by property slug. Values can be strings, numbers, booleans, arrays, or null. For select/multiselect properties, values may be option slugs or option UUIDs on write; option slugs are returned on read. - `list?: unknown` Body param - `idempotencyKey?: string` Header param: A unique key (UUID or any opaque string up to 255 chars) that identifies this logical request. The server caches the first response under this key for 24 hours and replays it on retry — safe to use on every POST/PUT/PATCH to make network retries deterministic. Reusing the same key with a different body returns 409 `idempotency_key_mismatch`. Replays include the `idempotent-replay: true` response header. - `ifMatch?: string` Header param: Optimistic concurrency. Pass back the `etag` header from a previous GET of this record; the write only proceeds if the record hasn't changed since. Mismatch → 412 `precondition_failed`. Use `*` to require the record exists (any ETag accepted). ### Returns - `ActionUpdateResponse` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); const action = await client.prism.objects.actions.update('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e'); console.log(action.id); ``` #### Response ```json { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "default": { "foo": "bar" }, "list": {} } ``` ## Delete object `client.prism.objects.actions.delete(stringactionID, ActionDeleteParamsparams?, RequestOptionsoptions?): void` **delete** `/v2/prism/{teamId}/action/{actionId}` Delete object ### Parameters - `actionID: string` - `params: ActionDeleteParams` - `teamId?: string` Path param - `ifMatch?: string` Header param: Optimistic concurrency. Pass back the `etag` header from a previous GET of this record; the write only proceeds if the record hasn't changed since. Mismatch → 412 `precondition_failed`. Use `*` to require the record exists (any ETag accepted). ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); await client.prism.objects.actions.delete('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e'); ``` ## Query `client.prism.objects.actions.query(ActionQueryParamsparams, RequestOptionsoptions?): ActionQueryResponse` **post** `/v2/prism/{teamId}/action/query` Query ### Parameters - `params: ActionQueryParams` - `teamId?: string` Path param - `query: Query` Body param - `select: Array` Property slugs to select. Use dot notation for relationships (e.g. attendee.contact.first_name). `id` is always returned at the top level of each row and does not need to be selected. - `combinator?: "AND" | "OR"` Logical operator for combining filters - `"AND"` - `"OR"` - `cursor?: string` Opaque cursor from a previous response's `next_cursor`. Pass it back unchanged to fetch the next page. When set, `page` and `limit` are derived from the cursor and any explicit values are ignored. - `filter?: Array>` Filters as [{ slug: { operator: value } }]. For select/multiselect properties, values may be option slugs or option UUIDs. - `PrismQueryFilterEq` - `"=": string | boolean` - `string` - `boolean` - `PrismQueryFilterNe` - `"!=": string | boolean` - `string` - `boolean` - `PrismQueryFilterLt` - `"<": string` - `PrismQueryFilterGt` - `">": string` - `PrismQueryFilterLte` - `"<=": string` - `PrismQueryFilterGte` - `">=": string` - `Contains` - `contains: string | boolean | Array` - `string` - `boolean` - `Array` - `BeginsWith` - `begins_with: string` - `EndsWith` - `ends_with: string` - `NotContains` - `not_contains: string` - `Exists` - `exists: boolean` - `NotExists` - `not_exists: boolean` - `IsNull` - `is_null: string | boolean | Array` - `string` - `boolean` - `Array` - `IsNotNull` - `is_not_null: string | boolean | Array` - `string` - `boolean` - `Array` - `Between` - `between: string | boolean | Array` - `string` - `boolean` - `Array` - `In` - `in: Array` - `NotIn` - `not_in: Array` - `limit?: number` Maximum number of rows to return. Capped server-side at 50; requests above the cap are rejected. - `list_id?: string` - `page?: number` Page number (1-based). Prefer `cursor`. Page-number pagination drifts under concurrent writes; use it only for one-shot exports. - `sort?: Array>` Sort order as [{ slug: direction }]. Array order determines sort priority - `"asc"` - `"desc"` - `id?: string | Array` Body param - `string` - `Array` - `boxes?: Array` Body param - `cursor?: string` Body param: Alternative location for the opaque cursor (sibling of `query`). Use whichever feels more natural; if both are present, `query.cursor` wins. - `deleted?: boolean` Body param - `include_total?: boolean` Body param: When true, the response includes a `total` field with the unpaginated row count. Costs an additional pass over the result set — for unfiltered totals prefer `GET /v2/prism/{teamId}/{objectType}/count` instead. - `sources?: Array` Body param ### Returns - `ActionQueryResponse` - `data: Array` - `id: string` - `is_user_object?: boolean` - `properties?: Record` Selected property values keyed by property slug. For select/multiselect properties, option slugs are returned. For reference properties, values are nested `{ id, properties }` objects. - `source?: string | null` - `has_more: boolean` Accurate end-of-data signal. False when this page contains the last record; true only when at least one more record exists. (Implementation note: the server fetches one extra row internally to determine this — clients never need to overshoot to discover the end.) - `next_cursor?: string | null` Opaque cursor pointing at the next page. Pass it back unchanged in the request body (`cursor`) of the next call. Null when `has_more` is false. - `total?: number | null` Only populated when the request set `include_total: true`. Total number of records matching the query, ignoring pagination. Opt-in because it costs an additional pass over the result set. ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); const response = await client.prism.objects.actions.query({ query: { select: ['string'] } }); console.log(response.data); ``` #### Response ```json { "data": [ { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "is_user_object": true, "properties": { "foo": "bar" }, "source": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e" } ], "has_more": true, "next_cursor": "next_cursor", "total": 0 } ``` ## Total record count for an object type `client.prism.objects.actions.count(ActionCountParamsparams?, RequestOptionsoptions?): ActionCountResponse` **get** `/v2/prism/{teamId}/action/count` Returns the total number of records of this object type that the caller can see. Avoids the page-overshoot anti-pattern — clients no longer need to keep paging until `has_more` flips false to discover the total. Currently does not apply query filters; for a filtered total, pass `include_total: true` in a POST `/query` body. ### Parameters - `params: ActionCountParams` - `teamId?: string` Path param - `list_id?: string` Query param: Scope the count to a specific list/app. ### Returns - `ActionCountResponse` - `total: number` Number of records matching the access scope. ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); const response = await client.prism.objects.actions.count(); console.log(response.total); ``` #### Response ```json { "total": 0 } ``` ## Find a record by property value `client.prism.objects.actions.find(stringvalue, ActionFindParamsparams, RequestOptionsoptions?): ActionFindResponse` **get** `/v2/prism/{teamId}/action/by/{slug}/{value}` Returns the single record whose property `{slug}` equals `{value}`. 404 if nothing matches; 409 if more than one record matches. ### Parameters - `value: string` - `params: ActionFindParams` - `teamId?: string` Path param - `slug: string` Path param: Property slug to match (e.g. `email`). - `list_id?: string` Query param: Scope the lookup to a specific list/app. ### Returns - `ActionFindResponse` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); const response = await client.prism.objects.actions.find('value', { slug: 'slug' }); console.log(response.id); ``` #### Response ```json { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "default": { "foo": "bar" }, "list": {} } ``` ## Upsert by property value `client.prism.objects.actions.upsert(stringvalue, ActionUpsertParamsparams, RequestOptionsoptions?): ActionUpsertResponse` **put** `/v2/prism/{teamId}/action/by/{slug}/{value}` Idempotent create-or-update keyed on `{slug}={value}`. If exactly one record matches, it is patched and 200 is returned. If none match, a new record is created (with the lookup property set if absent) and 201 is returned. If multiple records match, 409 is returned and you should patch by id instead. ### Parameters - `value: string` - `params: ActionUpsertParams` - `teamId?: string` Path param - `slug: string` Path param - `_default?: Record` Body param: Properties keyed by property slug. Values can be strings, numbers, booleans, arrays, or null. For select/multiselect properties, values may be option slugs or option UUIDs on write; option slugs are returned on read. - `list?: unknown` Body param - `idempotencyKey?: string` Header param: A unique key (UUID or any opaque string up to 255 chars) that identifies this logical request. The server caches the first response under this key for 24 hours and replays it on retry — safe to use on every POST/PUT/PATCH to make network retries deterministic. Reusing the same key with a different body returns 409 `idempotency_key_mismatch`. Replays include the `idempotent-replay: true` response header. ### Returns - `ActionUpsertResponse` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); const response = await client.prism.objects.actions.upsert('value', { slug: 'slug' }); console.log(response.id); ``` #### Response ```json { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "default": { "foo": "bar" }, "list": {} } ``` ## Import objects `client.prism.objects.actions.bulkCreate(ActionBulkCreateParamsparams, RequestOptionsoptions?): ActionBulkCreateResponse` **post** `/v2/prism/{teamId}/action/import` Import multiple objects in batch. Properties are keyed by slug. Automatically routes based on size: small batches complete synchronously and return 200 with the final `ImportJob`; large batches start an async job, return 202 with `status: processing` and a `Location` header, and can be polled via `GET /v2/prism/{teamId}/imports/{jobId}`. ### Parameters - `params: ActionBulkCreateParams` - `teamId?: string` Path param - `objects: Array` Body param: Array of objects to import with property values keyed by slug - `default?: Record` Properties keyed by property slug. Values can be strings, numbers, booleans, arrays, or null. For select/multiselect properties, values may be option slugs or option UUIDs on write; option slugs are returned on read. - `list?: unknown` - `options?: Options` Body param - `caseInsensitive?: boolean` Whether deduplication should be case insensitive - `dedupe_by?: string` Property slug to deduplicate on - `list_id?: string` App/CRM ID for context (optional) - `idempotencyKey?: string` Header param: A unique key (UUID or any opaque string up to 255 chars) that identifies this logical request. The server caches the first response under this key for 24 hours and replays it on retry — safe to use on every POST/PUT/PATCH to make network retries deterministic. Reusing the same key with a different body returns 409 `idempotency_key_mismatch`. Replays include the `idempotent-replay: true` response header. ### Returns - `ActionBulkCreateResponse` Status snapshot of an import job. Same shape used by the POST /import response and by GET /imports/{jobId}. - `job_id: string | null` Null for sync imports (results inlined). Set for async imports. - `status: "complete" | "processing" | "failed"` - `"complete"` - `"processing"` - `"failed"` - `total: number` Total number of rows in the import. - `created_at?: string` - `error?: Error` Set when status=failed; describes the job-level failure (not per-row). - `code?: string` - `message?: string` - `expires_at?: string` - `failed?: number` - `processed?: number` Rows that have been attempted (succeeded + failed). - `results?: Array` Per-row outcomes. Always present for sync imports; populated for async imports once the job reaches `complete`. - `id?: string | null` - `created?: boolean` - `error?: Error` - `code?: string` - `message?: string` - `existing?: boolean` True if the row matched an existing record via the dedupe key. - `succeeded?: number` - `updated_at?: string` ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); const response = await client.prism.objects.actions.bulkCreate({ objects: [{}] }); console.log(response.job_id); ``` #### Response ```json { "job_id": "job_id", "status": "complete", "total": 0, "created_at": "2019-12-27T18:11:19.117Z", "error": { "code": "code", "message": "message" }, "expires_at": "2019-12-27T18:11:19.117Z", "failed": 0, "processed": 0, "results": [ { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "created": true, "error": { "code": "code", "message": "message" }, "existing": true } ], "succeeded": 0, "updated_at": "2019-12-27T18:11:19.117Z" } ``` ## Bulk update records (partial success) `client.prism.objects.actions.bulkUpdate(ActionBulkUpdateParamsparams, RequestOptionsoptions?): ActionBulkUpdateResponse` **post** `/v2/prism/{teamId}/action/batch/update` Patch up to 100 records in a single call. Each item is attempted independently — failures don't abort the batch. Inspect `results[].status` per item. ### Parameters - `params: ActionBulkUpdateParams` - `teamId?: string` Path param - `items: Array` Body param - `id: string` - `idempotencyKey?: string` Header param: A unique key (UUID or any opaque string up to 255 chars) that identifies this logical request. The server caches the first response under this key for 24 hours and replays it on retry — safe to use on every POST/PUT/PATCH to make network retries deterministic. Reusing the same key with a different body returns 409 `idempotency_key_mismatch`. Replays include the `idempotent-replay: true` response header. ### Returns - `ActionBulkUpdateResponse` Partial-success bulk operation result. Inspect `results[].status` per item; the operation as a whole returns 200 even if some items failed. - `results: Array` - `id: string | null` Item ID, or null if the input was unparseable. - `status: "ok" | "error"` - `"ok"` - `"error"` - `error?: Error` - `code?: string` - `message?: string` - `record?: Record` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` - `summary: Summary` - `failed: number` - `succeeded: number` - `total: number` ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); const response = await client.prism.objects.actions.bulkUpdate({ items: [{ id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e' }], }); console.log(response.results); ``` #### Response ```json { "results": [ { "id": "id", "status": "ok", "error": { "code": "code", "message": "message" }, "record": { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "default": { "foo": "bar" }, "list": {} } } ], "summary": { "failed": 0, "succeeded": 0, "total": 0 } } ``` ## Bulk delete records (partial success) `client.prism.objects.actions.bulkDelete(ActionBulkDeleteParamsparams, RequestOptionsoptions?): ActionBulkDeleteResponse` **post** `/v2/prism/{teamId}/action/batch/delete` Soft-delete up to 100 records in a single call. Same partial-success contract as batch/update. ### Parameters - `params: ActionBulkDeleteParams` - `teamId?: string` Path param - `ids: Array` Body param - `idempotencyKey?: string` Header param: A unique key (UUID or any opaque string up to 255 chars) that identifies this logical request. The server caches the first response under this key for 24 hours and replays it on retry — safe to use on every POST/PUT/PATCH to make network retries deterministic. Reusing the same key with a different body returns 409 `idempotency_key_mismatch`. Replays include the `idempotent-replay: true` response header. ### Returns - `ActionBulkDeleteResponse` Partial-success bulk operation result. Inspect `results[].status` per item; the operation as a whole returns 200 even if some items failed. - `results: Array` - `id: string | null` Item ID, or null if the input was unparseable. - `status: "ok" | "error"` - `"ok"` - `"error"` - `error?: Error` - `code?: string` - `message?: string` - `record?: Record` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` - `summary: Summary` - `failed: number` - `succeeded: number` - `total: number` ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); const response = await client.prism.objects.actions.bulkDelete({ ids: ['182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e'], }); console.log(response.results); ``` #### Response ```json { "results": [ { "id": "id", "status": "ok", "error": { "code": "code", "message": "message" }, "record": { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "default": { "foo": "bar" }, "list": {} } } ], "summary": { "failed": 0, "succeeded": 0, "total": 0 } } ``` ## Duplicate object `client.prism.objects.actions.duplicate(stringactionID, ActionDuplicateParamsparams?, RequestOptionsoptions?): ActionDuplicateResponse` **post** `/v2/prism/{teamId}/action/{actionId}/duplicate` Duplicate object ### Parameters - `actionID: string` - `params: ActionDuplicateParams` - `teamId?: string` Path param - `idempotencyKey?: string` Header param: A unique key (UUID or any opaque string up to 255 chars) that identifies this logical request. The server caches the first response under this key for 24 hours and replays it on retry — safe to use on every POST/PUT/PATCH to make network retries deterministic. Reusing the same key with a different body returns 409 `idempotency_key_mismatch`. Replays include the `idempotent-replay: true` response header. ### Returns - `ActionDuplicateResponse` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); const response = await client.prism.objects.actions.duplicate( '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', ); console.log(response.id); ``` #### Response ```json { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "default": { "foo": "bar" }, "list": {} } ``` ## Restore object `client.prism.objects.actions.restore(stringactionID, ActionRestoreParamsparams?, RequestOptionsoptions?): ActionRestoreResponse` **post** `/v2/prism/{teamId}/action/{actionId}/restore` Restore object ### Parameters - `actionID: string` - `params: ActionRestoreParams` - `teamId?: string` Path param - `idempotencyKey?: string` Header param: A unique key (UUID or any opaque string up to 255 chars) that identifies this logical request. The server caches the first response under this key for 24 hours and replays it on retry — safe to use on every POST/PUT/PATCH to make network retries deterministic. Reusing the same key with a different body returns 409 `idempotency_key_mismatch`. Replays include the `idempotent-replay: true` response header. ### Returns - `ActionRestoreResponse` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); const response = await client.prism.objects.actions.restore('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e'); console.log(response.id); ``` #### Response ```json { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "default": { "foo": "bar" }, "list": {} } ``` ## Domain Types ### Action - `Action` - `default?: Record` Properties keyed by property slug. Values can be strings, numbers, booleans, arrays, or null. For select/multiselect properties, values may be option slugs or option UUIDs on write; option slugs are returned on read. - `list?: unknown` ### Action Create Response - `ActionCreateResponse` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` ### Action List Response - `ActionListResponse` - `data: Array` - `id: string` - `is_user_object?: boolean` - `properties?: Record` Selected property values keyed by property slug. For select/multiselect properties, option slugs are returned. For reference properties, values are nested `{ id, properties }` objects. - `source?: string | null` - `has_more: boolean` Accurate end-of-data signal — false on the last page, never forces clients to overshoot. - `next_cursor?: string | null` - `total?: number | null` Populated only when `?include_total=true` was passed. ### Action Get Response - `ActionGetResponse` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` ### Action Update Response - `ActionUpdateResponse` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` ### Action Query Response - `ActionQueryResponse` - `data: Array` - `id: string` - `is_user_object?: boolean` - `properties?: Record` Selected property values keyed by property slug. For select/multiselect properties, option slugs are returned. For reference properties, values are nested `{ id, properties }` objects. - `source?: string | null` - `has_more: boolean` Accurate end-of-data signal. False when this page contains the last record; true only when at least one more record exists. (Implementation note: the server fetches one extra row internally to determine this — clients never need to overshoot to discover the end.) - `next_cursor?: string | null` Opaque cursor pointing at the next page. Pass it back unchanged in the request body (`cursor`) of the next call. Null when `has_more` is false. - `total?: number | null` Only populated when the request set `include_total: true`. Total number of records matching the query, ignoring pagination. Opt-in because it costs an additional pass over the result set. ### Action Count Response - `ActionCountResponse` - `total: number` Number of records matching the access scope. ### Action Find Response - `ActionFindResponse` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` ### Action Upsert Response - `ActionUpsertResponse` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` ### Action Bulk Create Response - `ActionBulkCreateResponse` Status snapshot of an import job. Same shape used by the POST /import response and by GET /imports/{jobId}. - `job_id: string | null` Null for sync imports (results inlined). Set for async imports. - `status: "complete" | "processing" | "failed"` - `"complete"` - `"processing"` - `"failed"` - `total: number` Total number of rows in the import. - `created_at?: string` - `error?: Error` Set when status=failed; describes the job-level failure (not per-row). - `code?: string` - `message?: string` - `expires_at?: string` - `failed?: number` - `processed?: number` Rows that have been attempted (succeeded + failed). - `results?: Array` Per-row outcomes. Always present for sync imports; populated for async imports once the job reaches `complete`. - `id?: string | null` - `created?: boolean` - `error?: Error` - `code?: string` - `message?: string` - `existing?: boolean` True if the row matched an existing record via the dedupe key. - `succeeded?: number` - `updated_at?: string` ### Action Bulk Update Response - `ActionBulkUpdateResponse` Partial-success bulk operation result. Inspect `results[].status` per item; the operation as a whole returns 200 even if some items failed. - `results: Array` - `id: string | null` Item ID, or null if the input was unparseable. - `status: "ok" | "error"` - `"ok"` - `"error"` - `error?: Error` - `code?: string` - `message?: string` - `record?: Record` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` - `summary: Summary` - `failed: number` - `succeeded: number` - `total: number` ### Action Bulk Delete Response - `ActionBulkDeleteResponse` Partial-success bulk operation result. Inspect `results[].status` per item; the operation as a whole returns 200 even if some items failed. - `results: Array` - `id: string | null` Item ID, or null if the input was unparseable. - `status: "ok" | "error"` - `"ok"` - `"error"` - `error?: Error` - `code?: string` - `message?: string` - `record?: Record` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` - `summary: Summary` - `failed: number` - `succeeded: number` - `total: number` ### Action Duplicate Response - `ActionDuplicateResponse` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` ### Action Restore Response - `ActionRestoreResponse` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` # Grant ## Get grant `client.prism.objects.actions.grant.get(stringactionID, GrantGetParamsparams?, RequestOptionsoptions?): GrantGetResponse` **get** `/v2/prism/{teamId}/action/{actionId}/grant` Get grant ### Parameters - `actionID: string` - `params: GrantGetParams` - `teamId?: string` ### Returns - `GrantGetResponse` - `team_group_id?: Array>` - `"a"` - `"r"` - `"w"` - `team_id?: Record` - `"a"` - `"r"` - `"w"` - `user_id?: Array>` - `"a"` - `"r"` - `"w"` ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); const grant = await client.prism.objects.actions.grant.get('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e'); console.log(grant.team_group_id); ``` #### Response ```json { "team_group_id": [ { "foo": "a" } ], "team_id": { "foo": "a" }, "user_id": [ { "foo": "a" } ] } ``` ## Update grant `client.prism.objects.actions.grant.update(stringactionID, GrantUpdateParamsparams, RequestOptionsoptions?): GrantUpdateResponse` **put** `/v2/prism/{teamId}/action/{actionId}/grant` Update grant ### Parameters - `actionID: string` - `params: GrantUpdateParams` - `teamId?: string` Path param - `team_group_id?: Array>` Body param - `"a"` - `"r"` - `"w"` - `team_id?: Record` Body param - `"a"` - `"r"` - `"w"` - `user_id?: Array>` Body param - `"a"` - `"r"` - `"w"` - `idempotencyKey?: string` Header param: A unique key (UUID or any opaque string up to 255 chars) that identifies this logical request. The server caches the first response under this key for 24 hours and replays it on retry — safe to use on every POST/PUT/PATCH to make network retries deterministic. Reusing the same key with a different body returns 409 `idempotency_key_mismatch`. Replays include the `idempotent-replay: true` response header. ### Returns - `GrantUpdateResponse` - `team_group_id?: Array>` - `"a"` - `"r"` - `"w"` - `team_id?: Record` - `"a"` - `"r"` - `"w"` - `user_id?: Array>` - `"a"` - `"r"` - `"w"` ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); const grant = await client.prism.objects.actions.grant.update( '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', ); console.log(grant.team_group_id); ``` #### Response ```json { "team_group_id": [ { "foo": "a" } ], "team_id": { "foo": "a" }, "user_id": [ { "foo": "a" } ] } ``` ## Domain Types ### Grant Get Response - `GrantGetResponse` - `team_group_id?: Array>` - `"a"` - `"r"` - `"w"` - `team_id?: Record` - `"a"` - `"r"` - `"w"` - `user_id?: Array>` - `"a"` - `"r"` - `"w"` ### Grant Update Response - `GrantUpdateResponse` - `team_group_id?: Array>` - `"a"` - `"r"` - `"w"` - `team_id?: Record` - `"a"` - `"r"` - `"w"` - `user_id?: Array>` - `"a"` - `"r"` - `"w"` # Documents ## Create object `client.prism.objects.documents.create(DocumentCreateParamsparams?, RequestOptionsoptions?): DocumentCreateResponse` **post** `/v2/prism/{teamId}/document` Create object ### Parameters - `params: DocumentCreateParams` - `teamId?: string` Path param - `_default?: Record` Body param: Properties keyed by property slug. Values can be strings, numbers, booleans, arrays, or null. For select/multiselect properties, values may be option slugs or option UUIDs on write; option slugs are returned on read. - `list?: unknown` Body param - `idempotencyKey?: string` Header param: A unique key (UUID or any opaque string up to 255 chars) that identifies this logical request. The server caches the first response under this key for 24 hours and replays it on retry — safe to use on every POST/PUT/PATCH to make network retries deterministic. Reusing the same key with a different body returns 409 `idempotency_key_mismatch`. Replays include the `idempotent-replay: true` response header. ### Returns - `DocumentCreateResponse` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); const document = await client.prism.objects.documents.create(); console.log(document.id); ``` #### Response ```json { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "default": { "foo": "bar" }, "list": {} } ``` ## List records of an object type `client.prism.objects.documents.list(DocumentListParamsparams?, RequestOptionsoptions?): DocumentListResponse` **get** `/v2/prism/{teamId}/document` Convenience list endpoint. Equivalent to `POST /v2/prism/{teamId}/{objectType}/query` with an empty body, plus query-string sugar for the common cases. Any unrecognized query parameter is interpreted as an equality filter on a property of that name; pass arrays for `in`. Values are received as strings, so non-string property filters via this endpoint may not work — use the `query` endpoint for typed comparisons or anything beyond simple equality. ### Parameters - `params: DocumentListParams` - `teamId?: string` Path param - `cursor?: string` Query param: Opaque cursor from a previous response's `next_cursor`. Pass it back unchanged to fetch the next page. - `deleted?: boolean` Query param: Include soft-deleted records. Pass the literal string `true`. - `include_total?: boolean` Query param: When set to `true`, the response includes a `total` field with the unpaginated row count. Costs an extra pass; prefer `GET .../count` for the unfiltered total. - `limit?: number` Query param: Maximum number of rows to return. Capped server-side at 50. - `list_id?: string` Query param: Scope properties to a specific list/app. - `select?: string` Query param: Comma-separated property slugs to return. Use dot notation for relationships. `id` is always returned at the top level. Defaults to all properties. - `sort?: string` Query param: Comma-separated list of slugs. Prefix with `-` for descending. Example: `sort=-updated_at,name`. ### Returns - `DocumentListResponse` - `data: Array` - `id: string` - `is_user_object?: boolean` - `properties?: Record` Selected property values keyed by property slug. For select/multiselect properties, option slugs are returned. For reference properties, values are nested `{ id, properties }` objects. - `source?: string | null` - `has_more: boolean` Accurate end-of-data signal — false on the last page, never forces clients to overshoot. - `next_cursor?: string | null` - `total?: number | null` Populated only when `?include_total=true` was passed. ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); const documents = await client.prism.objects.documents.list(); console.log(documents.data); ``` #### Response ```json { "data": [ { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "is_user_object": true, "properties": { "foo": "bar" }, "source": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e" } ], "has_more": true, "next_cursor": "next_cursor", "total": 0 } ``` ## Get object `client.prism.objects.documents.get(stringdocumentID, DocumentGetParamsparams?, RequestOptionsoptions?): DocumentGetResponse` **get** `/v2/prism/{teamId}/document/{documentId}` Get object ### Parameters - `documentID: string` - `params: DocumentGetParams` - `teamId?: string` Path param - `select?: string` Query param: Comma-separated property slugs to return. Use dot notation for relationships. `id` is always returned at the top level. Defaults to all properties. ### Returns - `DocumentGetResponse` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); const document = await client.prism.objects.documents.get('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e'); console.log(document.id); ``` #### Response ```json { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "default": { "foo": "bar" }, "list": {} } ``` ## Patch object `client.prism.objects.documents.update(stringdocumentID, DocumentUpdateParamsparams, RequestOptionsoptions?): DocumentUpdateResponse` **patch** `/v2/prism/{teamId}/document/{documentId}` Patch object ### Parameters - `documentID: string` - `params: DocumentUpdateParams` - `teamId?: string` Path param - `_default?: Record` Body param: Properties keyed by property slug. Values can be strings, numbers, booleans, arrays, or null. For select/multiselect properties, values may be option slugs or option UUIDs on write; option slugs are returned on read. - `list?: unknown` Body param - `idempotencyKey?: string` Header param: A unique key (UUID or any opaque string up to 255 chars) that identifies this logical request. The server caches the first response under this key for 24 hours and replays it on retry — safe to use on every POST/PUT/PATCH to make network retries deterministic. Reusing the same key with a different body returns 409 `idempotency_key_mismatch`. Replays include the `idempotent-replay: true` response header. - `ifMatch?: string` Header param: Optimistic concurrency. Pass back the `etag` header from a previous GET of this record; the write only proceeds if the record hasn't changed since. Mismatch → 412 `precondition_failed`. Use `*` to require the record exists (any ETag accepted). ### Returns - `DocumentUpdateResponse` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); const document = await client.prism.objects.documents.update( '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', ); console.log(document.id); ``` #### Response ```json { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "default": { "foo": "bar" }, "list": {} } ``` ## Delete object `client.prism.objects.documents.delete(stringdocumentID, DocumentDeleteParamsparams?, RequestOptionsoptions?): void` **delete** `/v2/prism/{teamId}/document/{documentId}` Delete object ### Parameters - `documentID: string` - `params: DocumentDeleteParams` - `teamId?: string` Path param - `ifMatch?: string` Header param: Optimistic concurrency. Pass back the `etag` header from a previous GET of this record; the write only proceeds if the record hasn't changed since. Mismatch → 412 `precondition_failed`. Use `*` to require the record exists (any ETag accepted). ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); await client.prism.objects.documents.delete('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e'); ``` ## Query `client.prism.objects.documents.query(DocumentQueryParamsparams, RequestOptionsoptions?): DocumentQueryResponse` **post** `/v2/prism/{teamId}/document/query` Query ### Parameters - `params: DocumentQueryParams` - `teamId?: string` Path param - `query: Query` Body param - `select: Array` Property slugs to select. Use dot notation for relationships (e.g. attendee.contact.first_name). `id` is always returned at the top level of each row and does not need to be selected. - `combinator?: "AND" | "OR"` Logical operator for combining filters - `"AND"` - `"OR"` - `cursor?: string` Opaque cursor from a previous response's `next_cursor`. Pass it back unchanged to fetch the next page. When set, `page` and `limit` are derived from the cursor and any explicit values are ignored. - `filter?: Array>` Filters as [{ slug: { operator: value } }]. For select/multiselect properties, values may be option slugs or option UUIDs. - `PrismQueryFilterEq` - `"=": string | boolean` - `string` - `boolean` - `PrismQueryFilterNe` - `"!=": string | boolean` - `string` - `boolean` - `PrismQueryFilterLt` - `"<": string` - `PrismQueryFilterGt` - `">": string` - `PrismQueryFilterLte` - `"<=": string` - `PrismQueryFilterGte` - `">=": string` - `Contains` - `contains: string | boolean | Array` - `string` - `boolean` - `Array` - `BeginsWith` - `begins_with: string` - `EndsWith` - `ends_with: string` - `NotContains` - `not_contains: string` - `Exists` - `exists: boolean` - `NotExists` - `not_exists: boolean` - `IsNull` - `is_null: string | boolean | Array` - `string` - `boolean` - `Array` - `IsNotNull` - `is_not_null: string | boolean | Array` - `string` - `boolean` - `Array` - `Between` - `between: string | boolean | Array` - `string` - `boolean` - `Array` - `In` - `in: Array` - `NotIn` - `not_in: Array` - `limit?: number` Maximum number of rows to return. Capped server-side at 50; requests above the cap are rejected. - `list_id?: string` - `page?: number` Page number (1-based). Prefer `cursor`. Page-number pagination drifts under concurrent writes; use it only for one-shot exports. - `sort?: Array>` Sort order as [{ slug: direction }]. Array order determines sort priority - `"asc"` - `"desc"` - `id?: string | Array` Body param - `string` - `Array` - `boxes?: Array` Body param - `cursor?: string` Body param: Alternative location for the opaque cursor (sibling of `query`). Use whichever feels more natural; if both are present, `query.cursor` wins. - `deleted?: boolean` Body param - `include_total?: boolean` Body param: When true, the response includes a `total` field with the unpaginated row count. Costs an additional pass over the result set — for unfiltered totals prefer `GET /v2/prism/{teamId}/{objectType}/count` instead. - `sources?: Array` Body param ### Returns - `DocumentQueryResponse` - `data: Array` - `id: string` - `is_user_object?: boolean` - `properties?: Record` Selected property values keyed by property slug. For select/multiselect properties, option slugs are returned. For reference properties, values are nested `{ id, properties }` objects. - `source?: string | null` - `has_more: boolean` Accurate end-of-data signal. False when this page contains the last record; true only when at least one more record exists. (Implementation note: the server fetches one extra row internally to determine this — clients never need to overshoot to discover the end.) - `next_cursor?: string | null` Opaque cursor pointing at the next page. Pass it back unchanged in the request body (`cursor`) of the next call. Null when `has_more` is false. - `total?: number | null` Only populated when the request set `include_total: true`. Total number of records matching the query, ignoring pagination. Opt-in because it costs an additional pass over the result set. ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); const response = await client.prism.objects.documents.query({ query: { select: ['string'] } }); console.log(response.data); ``` #### Response ```json { "data": [ { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "is_user_object": true, "properties": { "foo": "bar" }, "source": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e" } ], "has_more": true, "next_cursor": "next_cursor", "total": 0 } ``` ## Total record count for an object type `client.prism.objects.documents.count(DocumentCountParamsparams?, RequestOptionsoptions?): DocumentCountResponse` **get** `/v2/prism/{teamId}/document/count` Returns the total number of records of this object type that the caller can see. Avoids the page-overshoot anti-pattern — clients no longer need to keep paging until `has_more` flips false to discover the total. Currently does not apply query filters; for a filtered total, pass `include_total: true` in a POST `/query` body. ### Parameters - `params: DocumentCountParams` - `teamId?: string` Path param - `list_id?: string` Query param: Scope the count to a specific list/app. ### Returns - `DocumentCountResponse` - `total: number` Number of records matching the access scope. ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); const response = await client.prism.objects.documents.count(); console.log(response.total); ``` #### Response ```json { "total": 0 } ``` ## Find a record by property value `client.prism.objects.documents.find(stringvalue, DocumentFindParamsparams, RequestOptionsoptions?): DocumentFindResponse` **get** `/v2/prism/{teamId}/document/by/{slug}/{value}` Returns the single record whose property `{slug}` equals `{value}`. 404 if nothing matches; 409 if more than one record matches. ### Parameters - `value: string` - `params: DocumentFindParams` - `teamId?: string` Path param - `slug: string` Path param: Property slug to match (e.g. `email`). - `list_id?: string` Query param: Scope the lookup to a specific list/app. ### Returns - `DocumentFindResponse` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); const response = await client.prism.objects.documents.find('value', { slug: 'slug' }); console.log(response.id); ``` #### Response ```json { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "default": { "foo": "bar" }, "list": {} } ``` ## Upsert by property value `client.prism.objects.documents.upsert(stringvalue, DocumentUpsertParamsparams, RequestOptionsoptions?): DocumentUpsertResponse` **put** `/v2/prism/{teamId}/document/by/{slug}/{value}` Idempotent create-or-update keyed on `{slug}={value}`. If exactly one record matches, it is patched and 200 is returned. If none match, a new record is created (with the lookup property set if absent) and 201 is returned. If multiple records match, 409 is returned and you should patch by id instead. ### Parameters - `value: string` - `params: DocumentUpsertParams` - `teamId?: string` Path param - `slug: string` Path param - `_default?: Record` Body param: Properties keyed by property slug. Values can be strings, numbers, booleans, arrays, or null. For select/multiselect properties, values may be option slugs or option UUIDs on write; option slugs are returned on read. - `list?: unknown` Body param - `idempotencyKey?: string` Header param: A unique key (UUID or any opaque string up to 255 chars) that identifies this logical request. The server caches the first response under this key for 24 hours and replays it on retry — safe to use on every POST/PUT/PATCH to make network retries deterministic. Reusing the same key with a different body returns 409 `idempotency_key_mismatch`. Replays include the `idempotent-replay: true` response header. ### Returns - `DocumentUpsertResponse` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); const response = await client.prism.objects.documents.upsert('value', { slug: 'slug' }); console.log(response.id); ``` #### Response ```json { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "default": { "foo": "bar" }, "list": {} } ``` ## Import objects `client.prism.objects.documents.bulkCreate(DocumentBulkCreateParamsparams, RequestOptionsoptions?): DocumentBulkCreateResponse` **post** `/v2/prism/{teamId}/document/import` Import multiple objects in batch. Properties are keyed by slug. Automatically routes based on size: small batches complete synchronously and return 200 with the final `ImportJob`; large batches start an async job, return 202 with `status: processing` and a `Location` header, and can be polled via `GET /v2/prism/{teamId}/imports/{jobId}`. ### Parameters - `params: DocumentBulkCreateParams` - `teamId?: string` Path param - `objects: Array` Body param: Array of objects to import with property values keyed by slug - `default?: Record` Properties keyed by property slug. Values can be strings, numbers, booleans, arrays, or null. For select/multiselect properties, values may be option slugs or option UUIDs on write; option slugs are returned on read. - `list?: unknown` - `options?: Options` Body param - `caseInsensitive?: boolean` Whether deduplication should be case insensitive - `dedupe_by?: string` Property slug to deduplicate on - `list_id?: string` App/CRM ID for context (optional) - `idempotencyKey?: string` Header param: A unique key (UUID or any opaque string up to 255 chars) that identifies this logical request. The server caches the first response under this key for 24 hours and replays it on retry — safe to use on every POST/PUT/PATCH to make network retries deterministic. Reusing the same key with a different body returns 409 `idempotency_key_mismatch`. Replays include the `idempotent-replay: true` response header. ### Returns - `DocumentBulkCreateResponse` Status snapshot of an import job. Same shape used by the POST /import response and by GET /imports/{jobId}. - `job_id: string | null` Null for sync imports (results inlined). Set for async imports. - `status: "complete" | "processing" | "failed"` - `"complete"` - `"processing"` - `"failed"` - `total: number` Total number of rows in the import. - `created_at?: string` - `error?: Error` Set when status=failed; describes the job-level failure (not per-row). - `code?: string` - `message?: string` - `expires_at?: string` - `failed?: number` - `processed?: number` Rows that have been attempted (succeeded + failed). - `results?: Array` Per-row outcomes. Always present for sync imports; populated for async imports once the job reaches `complete`. - `id?: string | null` - `created?: boolean` - `error?: Error` - `code?: string` - `message?: string` - `existing?: boolean` True if the row matched an existing record via the dedupe key. - `succeeded?: number` - `updated_at?: string` ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); const response = await client.prism.objects.documents.bulkCreate({ objects: [{}] }); console.log(response.job_id); ``` #### Response ```json { "job_id": "job_id", "status": "complete", "total": 0, "created_at": "2019-12-27T18:11:19.117Z", "error": { "code": "code", "message": "message" }, "expires_at": "2019-12-27T18:11:19.117Z", "failed": 0, "processed": 0, "results": [ { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "created": true, "error": { "code": "code", "message": "message" }, "existing": true } ], "succeeded": 0, "updated_at": "2019-12-27T18:11:19.117Z" } ``` ## Bulk update records (partial success) `client.prism.objects.documents.bulkUpdate(DocumentBulkUpdateParamsparams, RequestOptionsoptions?): DocumentBulkUpdateResponse` **post** `/v2/prism/{teamId}/document/batch/update` Patch up to 100 records in a single call. Each item is attempted independently — failures don't abort the batch. Inspect `results[].status` per item. ### Parameters - `params: DocumentBulkUpdateParams` - `teamId?: string` Path param - `items: Array` Body param - `id: string` - `idempotencyKey?: string` Header param: A unique key (UUID or any opaque string up to 255 chars) that identifies this logical request. The server caches the first response under this key for 24 hours and replays it on retry — safe to use on every POST/PUT/PATCH to make network retries deterministic. Reusing the same key with a different body returns 409 `idempotency_key_mismatch`. Replays include the `idempotent-replay: true` response header. ### Returns - `DocumentBulkUpdateResponse` Partial-success bulk operation result. Inspect `results[].status` per item; the operation as a whole returns 200 even if some items failed. - `results: Array` - `id: string | null` Item ID, or null if the input was unparseable. - `status: "ok" | "error"` - `"ok"` - `"error"` - `error?: Error` - `code?: string` - `message?: string` - `record?: Record` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` - `summary: Summary` - `failed: number` - `succeeded: number` - `total: number` ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); const response = await client.prism.objects.documents.bulkUpdate({ items: [{ id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e' }], }); console.log(response.results); ``` #### Response ```json { "results": [ { "id": "id", "status": "ok", "error": { "code": "code", "message": "message" }, "record": { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "default": { "foo": "bar" }, "list": {} } } ], "summary": { "failed": 0, "succeeded": 0, "total": 0 } } ``` ## Bulk delete records (partial success) `client.prism.objects.documents.bulkDelete(DocumentBulkDeleteParamsparams, RequestOptionsoptions?): DocumentBulkDeleteResponse` **post** `/v2/prism/{teamId}/document/batch/delete` Soft-delete up to 100 records in a single call. Same partial-success contract as batch/update. ### Parameters - `params: DocumentBulkDeleteParams` - `teamId?: string` Path param - `ids: Array` Body param - `idempotencyKey?: string` Header param: A unique key (UUID or any opaque string up to 255 chars) that identifies this logical request. The server caches the first response under this key for 24 hours and replays it on retry — safe to use on every POST/PUT/PATCH to make network retries deterministic. Reusing the same key with a different body returns 409 `idempotency_key_mismatch`. Replays include the `idempotent-replay: true` response header. ### Returns - `DocumentBulkDeleteResponse` Partial-success bulk operation result. Inspect `results[].status` per item; the operation as a whole returns 200 even if some items failed. - `results: Array` - `id: string | null` Item ID, or null if the input was unparseable. - `status: "ok" | "error"` - `"ok"` - `"error"` - `error?: Error` - `code?: string` - `message?: string` - `record?: Record` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` - `summary: Summary` - `failed: number` - `succeeded: number` - `total: number` ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); const response = await client.prism.objects.documents.bulkDelete({ ids: ['182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e'], }); console.log(response.results); ``` #### Response ```json { "results": [ { "id": "id", "status": "ok", "error": { "code": "code", "message": "message" }, "record": { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "default": { "foo": "bar" }, "list": {} } } ], "summary": { "failed": 0, "succeeded": 0, "total": 0 } } ``` ## Duplicate object `client.prism.objects.documents.duplicate(stringdocumentID, DocumentDuplicateParamsparams?, RequestOptionsoptions?): DocumentDuplicateResponse` **post** `/v2/prism/{teamId}/document/{documentId}/duplicate` Duplicate object ### Parameters - `documentID: string` - `params: DocumentDuplicateParams` - `teamId?: string` Path param - `idempotencyKey?: string` Header param: A unique key (UUID or any opaque string up to 255 chars) that identifies this logical request. The server caches the first response under this key for 24 hours and replays it on retry — safe to use on every POST/PUT/PATCH to make network retries deterministic. Reusing the same key with a different body returns 409 `idempotency_key_mismatch`. Replays include the `idempotent-replay: true` response header. ### Returns - `DocumentDuplicateResponse` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); const response = await client.prism.objects.documents.duplicate( '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', ); console.log(response.id); ``` #### Response ```json { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "default": { "foo": "bar" }, "list": {} } ``` ## Restore object `client.prism.objects.documents.restore(stringdocumentID, DocumentRestoreParamsparams?, RequestOptionsoptions?): DocumentRestoreResponse` **post** `/v2/prism/{teamId}/document/{documentId}/restore` Restore object ### Parameters - `documentID: string` - `params: DocumentRestoreParams` - `teamId?: string` Path param - `idempotencyKey?: string` Header param: A unique key (UUID or any opaque string up to 255 chars) that identifies this logical request. The server caches the first response under this key for 24 hours and replays it on retry — safe to use on every POST/PUT/PATCH to make network retries deterministic. Reusing the same key with a different body returns 409 `idempotency_key_mismatch`. Replays include the `idempotent-replay: true` response header. ### Returns - `DocumentRestoreResponse` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); const response = await client.prism.objects.documents.restore( '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', ); console.log(response.id); ``` #### Response ```json { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "default": { "foo": "bar" }, "list": {} } ``` ## Domain Types ### Document - `Document` - `default?: Record` Properties keyed by property slug. Values can be strings, numbers, booleans, arrays, or null. For select/multiselect properties, values may be option slugs or option UUIDs on write; option slugs are returned on read. - `list?: unknown` ### Document Create Response - `DocumentCreateResponse` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` ### Document List Response - `DocumentListResponse` - `data: Array` - `id: string` - `is_user_object?: boolean` - `properties?: Record` Selected property values keyed by property slug. For select/multiselect properties, option slugs are returned. For reference properties, values are nested `{ id, properties }` objects. - `source?: string | null` - `has_more: boolean` Accurate end-of-data signal — false on the last page, never forces clients to overshoot. - `next_cursor?: string | null` - `total?: number | null` Populated only when `?include_total=true` was passed. ### Document Get Response - `DocumentGetResponse` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` ### Document Update Response - `DocumentUpdateResponse` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` ### Document Query Response - `DocumentQueryResponse` - `data: Array` - `id: string` - `is_user_object?: boolean` - `properties?: Record` Selected property values keyed by property slug. For select/multiselect properties, option slugs are returned. For reference properties, values are nested `{ id, properties }` objects. - `source?: string | null` - `has_more: boolean` Accurate end-of-data signal. False when this page contains the last record; true only when at least one more record exists. (Implementation note: the server fetches one extra row internally to determine this — clients never need to overshoot to discover the end.) - `next_cursor?: string | null` Opaque cursor pointing at the next page. Pass it back unchanged in the request body (`cursor`) of the next call. Null when `has_more` is false. - `total?: number | null` Only populated when the request set `include_total: true`. Total number of records matching the query, ignoring pagination. Opt-in because it costs an additional pass over the result set. ### Document Count Response - `DocumentCountResponse` - `total: number` Number of records matching the access scope. ### Document Find Response - `DocumentFindResponse` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` ### Document Upsert Response - `DocumentUpsertResponse` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` ### Document Bulk Create Response - `DocumentBulkCreateResponse` Status snapshot of an import job. Same shape used by the POST /import response and by GET /imports/{jobId}. - `job_id: string | null` Null for sync imports (results inlined). Set for async imports. - `status: "complete" | "processing" | "failed"` - `"complete"` - `"processing"` - `"failed"` - `total: number` Total number of rows in the import. - `created_at?: string` - `error?: Error` Set when status=failed; describes the job-level failure (not per-row). - `code?: string` - `message?: string` - `expires_at?: string` - `failed?: number` - `processed?: number` Rows that have been attempted (succeeded + failed). - `results?: Array` Per-row outcomes. Always present for sync imports; populated for async imports once the job reaches `complete`. - `id?: string | null` - `created?: boolean` - `error?: Error` - `code?: string` - `message?: string` - `existing?: boolean` True if the row matched an existing record via the dedupe key. - `succeeded?: number` - `updated_at?: string` ### Document Bulk Update Response - `DocumentBulkUpdateResponse` Partial-success bulk operation result. Inspect `results[].status` per item; the operation as a whole returns 200 even if some items failed. - `results: Array` - `id: string | null` Item ID, or null if the input was unparseable. - `status: "ok" | "error"` - `"ok"` - `"error"` - `error?: Error` - `code?: string` - `message?: string` - `record?: Record` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` - `summary: Summary` - `failed: number` - `succeeded: number` - `total: number` ### Document Bulk Delete Response - `DocumentBulkDeleteResponse` Partial-success bulk operation result. Inspect `results[].status` per item; the operation as a whole returns 200 even if some items failed. - `results: Array` - `id: string | null` Item ID, or null if the input was unparseable. - `status: "ok" | "error"` - `"ok"` - `"error"` - `error?: Error` - `code?: string` - `message?: string` - `record?: Record` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` - `summary: Summary` - `failed: number` - `succeeded: number` - `total: number` ### Document Duplicate Response - `DocumentDuplicateResponse` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` ### Document Restore Response - `DocumentRestoreResponse` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` # Grant ## Get grant `client.prism.objects.documents.grant.get(stringdocumentID, GrantGetParamsparams?, RequestOptionsoptions?): GrantGetResponse` **get** `/v2/prism/{teamId}/document/{documentId}/grant` Get grant ### Parameters - `documentID: string` - `params: GrantGetParams` - `teamId?: string` ### Returns - `GrantGetResponse` - `team_group_id?: Array>` - `"a"` - `"r"` - `"w"` - `team_id?: Record` - `"a"` - `"r"` - `"w"` - `user_id?: Array>` - `"a"` - `"r"` - `"w"` ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); const grant = await client.prism.objects.documents.grant.get( '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', ); console.log(grant.team_group_id); ``` #### Response ```json { "team_group_id": [ { "foo": "a" } ], "team_id": { "foo": "a" }, "user_id": [ { "foo": "a" } ] } ``` ## Update grant `client.prism.objects.documents.grant.update(stringdocumentID, GrantUpdateParamsparams, RequestOptionsoptions?): GrantUpdateResponse` **put** `/v2/prism/{teamId}/document/{documentId}/grant` Update grant ### Parameters - `documentID: string` - `params: GrantUpdateParams` - `teamId?: string` Path param - `team_group_id?: Array>` Body param - `"a"` - `"r"` - `"w"` - `team_id?: Record` Body param - `"a"` - `"r"` - `"w"` - `user_id?: Array>` Body param - `"a"` - `"r"` - `"w"` - `idempotencyKey?: string` Header param: A unique key (UUID or any opaque string up to 255 chars) that identifies this logical request. The server caches the first response under this key for 24 hours and replays it on retry — safe to use on every POST/PUT/PATCH to make network retries deterministic. Reusing the same key with a different body returns 409 `idempotency_key_mismatch`. Replays include the `idempotent-replay: true` response header. ### Returns - `GrantUpdateResponse` - `team_group_id?: Array>` - `"a"` - `"r"` - `"w"` - `team_id?: Record` - `"a"` - `"r"` - `"w"` - `user_id?: Array>` - `"a"` - `"r"` - `"w"` ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); const grant = await client.prism.objects.documents.grant.update( '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', ); console.log(grant.team_group_id); ``` #### Response ```json { "team_group_id": [ { "foo": "a" } ], "team_id": { "foo": "a" }, "user_id": [ { "foo": "a" } ] } ``` ## Domain Types ### Grant Get Response - `GrantGetResponse` - `team_group_id?: Array>` - `"a"` - `"r"` - `"w"` - `team_id?: Record` - `"a"` - `"r"` - `"w"` - `user_id?: Array>` - `"a"` - `"r"` - `"w"` ### Grant Update Response - `GrantUpdateResponse` - `team_group_id?: Array>` - `"a"` - `"r"` - `"w"` - `team_id?: Record` - `"a"` - `"r"` - `"w"` - `user_id?: Array>` - `"a"` - `"r"` - `"w"` # Events ## List records of an object type `client.prism.objects.events.list(EventListParamsparams?, RequestOptionsoptions?): EventListResponse` **get** `/v2/prism/{teamId}/event` Convenience list endpoint. Equivalent to `POST /v2/prism/{teamId}/{objectType}/query` with an empty body, plus query-string sugar for the common cases. Any unrecognized query parameter is interpreted as an equality filter on a property of that name; pass arrays for `in`. Values are received as strings, so non-string property filters via this endpoint may not work — use the `query` endpoint for typed comparisons or anything beyond simple equality. ### Parameters - `params: EventListParams` - `teamId?: string` Path param - `cursor?: string` Query param: Opaque cursor from a previous response's `next_cursor`. Pass it back unchanged to fetch the next page. - `deleted?: boolean` Query param: Include soft-deleted records. Pass the literal string `true`. - `include_total?: boolean` Query param: When set to `true`, the response includes a `total` field with the unpaginated row count. Costs an extra pass; prefer `GET .../count` for the unfiltered total. - `limit?: number` Query param: Maximum number of rows to return. Capped server-side at 50. - `list_id?: string` Query param: Scope properties to a specific list/app. - `select?: string` Query param: Comma-separated property slugs to return. Use dot notation for relationships. `id` is always returned at the top level. Defaults to all properties. - `sort?: string` Query param: Comma-separated list of slugs. Prefix with `-` for descending. Example: `sort=-updated_at,name`. ### Returns - `EventListResponse` - `data: Array` - `id: string` - `is_user_object?: boolean` - `properties?: Record` Selected property values keyed by property slug. For select/multiselect properties, option slugs are returned. For reference properties, values are nested `{ id, properties }` objects. - `source?: string | null` - `has_more: boolean` Accurate end-of-data signal — false on the last page, never forces clients to overshoot. - `next_cursor?: string | null` - `total?: number | null` Populated only when `?include_total=true` was passed. ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); const events = await client.prism.objects.events.list(); console.log(events.data); ``` #### Response ```json { "data": [ { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "is_user_object": true, "properties": { "foo": "bar" }, "source": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e" } ], "has_more": true, "next_cursor": "next_cursor", "total": 0 } ``` ## Get object `client.prism.objects.events.get(stringeventID, EventGetParamsparams?, RequestOptionsoptions?): EventGetResponse` **get** `/v2/prism/{teamId}/event/{eventId}` Get object ### Parameters - `eventID: string` - `params: EventGetParams` - `teamId?: string` Path param - `select?: string` Query param: Comma-separated property slugs to return. Use dot notation for relationships. `id` is always returned at the top level. Defaults to all properties. ### Returns - `EventGetResponse` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); const event = await client.prism.objects.events.get('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e'); console.log(event.id); ``` #### Response ```json { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "default": { "foo": "bar" }, "list": {} } ``` ## Query `client.prism.objects.events.query(EventQueryParamsparams, RequestOptionsoptions?): EventQueryResponse` **post** `/v2/prism/{teamId}/event/query` Query ### Parameters - `params: EventQueryParams` - `teamId?: string` Path param - `query: Query` Body param - `select: Array` Property slugs to select. Use dot notation for relationships (e.g. attendee.contact.first_name). `id` is always returned at the top level of each row and does not need to be selected. - `combinator?: "AND" | "OR"` Logical operator for combining filters - `"AND"` - `"OR"` - `cursor?: string` Opaque cursor from a previous response's `next_cursor`. Pass it back unchanged to fetch the next page. When set, `page` and `limit` are derived from the cursor and any explicit values are ignored. - `filter?: Array>` Filters as [{ slug: { operator: value } }]. For select/multiselect properties, values may be option slugs or option UUIDs. - `PrismQueryFilterEq` - `"=": string | boolean` - `string` - `boolean` - `PrismQueryFilterNe` - `"!=": string | boolean` - `string` - `boolean` - `PrismQueryFilterLt` - `"<": string` - `PrismQueryFilterGt` - `">": string` - `PrismQueryFilterLte` - `"<=": string` - `PrismQueryFilterGte` - `">=": string` - `Contains` - `contains: string | boolean | Array` - `string` - `boolean` - `Array` - `BeginsWith` - `begins_with: string` - `EndsWith` - `ends_with: string` - `NotContains` - `not_contains: string` - `Exists` - `exists: boolean` - `NotExists` - `not_exists: boolean` - `IsNull` - `is_null: string | boolean | Array` - `string` - `boolean` - `Array` - `IsNotNull` - `is_not_null: string | boolean | Array` - `string` - `boolean` - `Array` - `Between` - `between: string | boolean | Array` - `string` - `boolean` - `Array` - `In` - `in: Array` - `NotIn` - `not_in: Array` - `limit?: number` Maximum number of rows to return. Capped server-side at 50; requests above the cap are rejected. - `list_id?: string` - `page?: number` Page number (1-based). Prefer `cursor`. Page-number pagination drifts under concurrent writes; use it only for one-shot exports. - `sort?: Array>` Sort order as [{ slug: direction }]. Array order determines sort priority - `"asc"` - `"desc"` - `id?: string | Array` Body param - `string` - `Array` - `boxes?: Array` Body param - `cursor?: string` Body param: Alternative location for the opaque cursor (sibling of `query`). Use whichever feels more natural; if both are present, `query.cursor` wins. - `deleted?: boolean` Body param - `include_total?: boolean` Body param: When true, the response includes a `total` field with the unpaginated row count. Costs an additional pass over the result set — for unfiltered totals prefer `GET /v2/prism/{teamId}/{objectType}/count` instead. - `sources?: Array` Body param ### Returns - `EventQueryResponse` - `data: Array` - `id: string` - `is_user_object?: boolean` - `properties?: Record` Selected property values keyed by property slug. For select/multiselect properties, option slugs are returned. For reference properties, values are nested `{ id, properties }` objects. - `source?: string | null` - `has_more: boolean` Accurate end-of-data signal. False when this page contains the last record; true only when at least one more record exists. (Implementation note: the server fetches one extra row internally to determine this — clients never need to overshoot to discover the end.) - `next_cursor?: string | null` Opaque cursor pointing at the next page. Pass it back unchanged in the request body (`cursor`) of the next call. Null when `has_more` is false. - `total?: number | null` Only populated when the request set `include_total: true`. Total number of records matching the query, ignoring pagination. Opt-in because it costs an additional pass over the result set. ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); const response = await client.prism.objects.events.query({ query: { select: ['string'] } }); console.log(response.data); ``` #### Response ```json { "data": [ { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "is_user_object": true, "properties": { "foo": "bar" }, "source": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e" } ], "has_more": true, "next_cursor": "next_cursor", "total": 0 } ``` ## Total record count for an object type `client.prism.objects.events.count(EventCountParamsparams?, RequestOptionsoptions?): EventCountResponse` **get** `/v2/prism/{teamId}/event/count` Returns the total number of records of this object type that the caller can see. Avoids the page-overshoot anti-pattern — clients no longer need to keep paging until `has_more` flips false to discover the total. Currently does not apply query filters; for a filtered total, pass `include_total: true` in a POST `/query` body. ### Parameters - `params: EventCountParams` - `teamId?: string` Path param - `list_id?: string` Query param: Scope the count to a specific list/app. ### Returns - `EventCountResponse` - `total: number` Number of records matching the access scope. ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); const response = await client.prism.objects.events.count(); console.log(response.total); ``` #### Response ```json { "total": 0 } ``` ## Find a record by property value `client.prism.objects.events.find(stringvalue, EventFindParamsparams, RequestOptionsoptions?): EventFindResponse` **get** `/v2/prism/{teamId}/event/by/{slug}/{value}` Returns the single record whose property `{slug}` equals `{value}`. 404 if nothing matches; 409 if more than one record matches. ### Parameters - `value: string` - `params: EventFindParams` - `teamId?: string` Path param - `slug: string` Path param: Property slug to match (e.g. `email`). - `list_id?: string` Query param: Scope the lookup to a specific list/app. ### Returns - `EventFindResponse` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); const response = await client.prism.objects.events.find('value', { slug: 'slug' }); console.log(response.id); ``` #### Response ```json { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "default": { "foo": "bar" }, "list": {} } ``` ## Domain Types ### Event - `Event` - `default?: Record` Properties keyed by property slug. Values can be strings, numbers, booleans, arrays, or null. For select/multiselect properties, values may be option slugs or option UUIDs on write; option slugs are returned on read. - `list?: unknown` ### Event List Response - `EventListResponse` - `data: Array` - `id: string` - `is_user_object?: boolean` - `properties?: Record` Selected property values keyed by property slug. For select/multiselect properties, option slugs are returned. For reference properties, values are nested `{ id, properties }` objects. - `source?: string | null` - `has_more: boolean` Accurate end-of-data signal — false on the last page, never forces clients to overshoot. - `next_cursor?: string | null` - `total?: number | null` Populated only when `?include_total=true` was passed. ### Event Get Response - `EventGetResponse` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` ### Event Query Response - `EventQueryResponse` - `data: Array` - `id: string` - `is_user_object?: boolean` - `properties?: Record` Selected property values keyed by property slug. For select/multiselect properties, option slugs are returned. For reference properties, values are nested `{ id, properties }` objects. - `source?: string | null` - `has_more: boolean` Accurate end-of-data signal. False when this page contains the last record; true only when at least one more record exists. (Implementation note: the server fetches one extra row internally to determine this — clients never need to overshoot to discover the end.) - `next_cursor?: string | null` Opaque cursor pointing at the next page. Pass it back unchanged in the request body (`cursor`) of the next call. Null when `has_more` is false. - `total?: number | null` Only populated when the request set `include_total: true`. Total number of records matching the query, ignoring pagination. Opt-in because it costs an additional pass over the result set. ### Event Count Response - `EventCountResponse` - `total: number` Number of records matching the access scope. ### Event Find Response - `EventFindResponse` Object returned by reads (get/create/patch/restore). id is always present. - `id: string` - `default?: Record` Properties keyed by property slug. - `list?: unknown` # Grant ## Get grant `client.prism.objects.events.grant.get(stringeventID, GrantGetParamsparams?, RequestOptionsoptions?): GrantGetResponse` **get** `/v2/prism/{teamId}/event/{eventId}/grant` Get grant ### Parameters - `eventID: string` - `params: GrantGetParams` - `teamId?: string` ### Returns - `GrantGetResponse` - `team_group_id?: Array>` - `"a"` - `"r"` - `"w"` - `team_id?: Record` - `"a"` - `"r"` - `"w"` - `user_id?: Array>` - `"a"` - `"r"` - `"w"` ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); const grant = await client.prism.objects.events.grant.get('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e'); console.log(grant.team_group_id); ``` #### Response ```json { "team_group_id": [ { "foo": "a" } ], "team_id": { "foo": "a" }, "user_id": [ { "foo": "a" } ] } ``` ## Update grant `client.prism.objects.events.grant.update(stringeventID, GrantUpdateParamsparams, RequestOptionsoptions?): GrantUpdateResponse` **put** `/v2/prism/{teamId}/event/{eventId}/grant` Update grant ### Parameters - `eventID: string` - `params: GrantUpdateParams` - `teamId?: string` Path param - `team_group_id?: Array>` Body param - `"a"` - `"r"` - `"w"` - `team_id?: Record` Body param - `"a"` - `"r"` - `"w"` - `user_id?: Array>` Body param - `"a"` - `"r"` - `"w"` - `idempotencyKey?: string` Header param: A unique key (UUID or any opaque string up to 255 chars) that identifies this logical request. The server caches the first response under this key for 24 hours and replays it on retry — safe to use on every POST/PUT/PATCH to make network retries deterministic. Reusing the same key with a different body returns 409 `idempotency_key_mismatch`. Replays include the `idempotent-replay: true` response header. ### Returns - `GrantUpdateResponse` - `team_group_id?: Array>` - `"a"` - `"r"` - `"w"` - `team_id?: Record` - `"a"` - `"r"` - `"w"` - `user_id?: Array>` - `"a"` - `"r"` - `"w"` ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); const grant = await client.prism.objects.events.grant.update( '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', ); console.log(grant.team_group_id); ``` #### Response ```json { "team_group_id": [ { "foo": "a" } ], "team_id": { "foo": "a" }, "user_id": [ { "foo": "a" } ] } ``` ## Domain Types ### Grant Get Response - `GrantGetResponse` - `team_group_id?: Array>` - `"a"` - `"r"` - `"w"` - `team_id?: Record` - `"a"` - `"r"` - `"w"` - `user_id?: Array>` - `"a"` - `"r"` - `"w"` ### Grant Update Response - `GrantUpdateResponse` - `team_group_id?: Array>` - `"a"` - `"r"` - `"w"` - `team_id?: Record` - `"a"` - `"r"` - `"w"` - `user_id?: Array>` - `"a"` - `"r"` - `"w"`