archastro.platform.v1.resources.custom_objects
1# Copyright (c) 2026 ArchAstro Inc. Licensed under the MIT License. 2# This file is auto-generated by @archastro/sdk-generator. Do not edit. 3# Content hash: c863576cd3e0 4 5from __future__ import annotations 6 7import builtins 8from datetime import datetime 9from typing import Any, Required, TypedDict 10 11from pydantic import BaseModel, Field 12 13from ...runtime.http_client import HttpClient, SyncHttpClient 14from ...types.common import CustomObject, CustomObjectListResponse 15 16 17class CustomObjectCreateInputAclAddItem(TypedDict, total=False): 18 actions: Required[list[str]] 19 'Array of action strings the principal is permitted to perform, e.g. `["read", "write"]`. Must contain at least one entry.' 20 principal: str | None 21 'The identifier of the principal. A string ID for `"user"`, `"team"`, `"org"`, and `"agent"` types; one of `"admin"`, `"member"`, or `"viewer"` for `"org_role"`; omit entirely when `principal_type` is `"everyone"`.' 22 principal_type: Required[str] 23 'The kind of principal receiving the grant. One of `"user"`, `"team"`, `"org"`, `"org_role"`, `"agent"`, or `"everyone"`.' 24 25 26class CustomObjectCreateInputAclGrantsItem(TypedDict, total=False): 27 actions: Required[list[str]] 28 'Array of action strings the principal is permitted to perform, e.g. `["read", "write"]`. Must contain at least one entry.' 29 principal: str | None 30 'The identifier of the principal. A string ID for `"user"`, `"team"`, `"org"`, and `"agent"` types; one of `"admin"`, `"member"`, or `"viewer"` for `"org_role"`; omit entirely when `principal_type` is `"everyone"`.' 31 principal_type: Required[str] 32 'The kind of principal receiving the grant. One of `"user"`, `"team"`, `"org"`, `"org_role"`, `"agent"`, or `"everyone"`.' 33 34 35class CustomObjectCreateInputAclRemoveItem(TypedDict, total=False): 36 principal: str | None 37 'The identifier of the principal to remove. A string ID for `"user"`, `"team"`, `"org"`, and `"agent"` types; one of `"admin"`, `"member"`, or `"viewer"` for `"org_role"`. Omit when `principal_type` is `"everyone"`.' 38 principal_type: Required[str] 39 'The kind of principal to remove. One of `"user"`, `"team"`, `"org"`, `"org_role"`, `"agent"`, or `"everyone"`.' 40 41 42class CustomObjectCreateInputAcl(TypedDict, total=False): 43 add: list[CustomObjectCreateInputAclAddItem] | None 44 "Patch mode: grants to add or merge into the existing list. Cannot be combined with `grants`." 45 grants: list[CustomObjectCreateInputAclGrantsItem] | None 46 "Replace mode: the complete new list of grants that replaces all existing entries. Send an empty array (`[]`) to clear all grants. Cannot be combined with `add` or `remove`." 47 remove: list[CustomObjectCreateInputAclRemoveItem] | None 48 "Patch mode: principals whose grants should be removed from the existing list. Cannot be combined with `grants`." 49 50 51class CustomObjectCreateInput(TypedDict, total=False): 52 "Create a custom object" 53 54 acl: CustomObjectCreateInputAcl | None 55 "Access control list for the custom object. Supports explicit `read` and `write` grants to users, teams, organizations, organization roles, agents, or everyone." 56 agent: str | None 57 "Agent user ID to set as the object owner. Used when neither `team` nor `user` is supplied." 58 config: str | None 59 "Config ID (`cfg_...`) that resolves to the target schema. Provide one of `type`, `schema_key`, or `config`." 60 fields: dict[str, Any] | None 61 "Key-value map of field values for the new object. Must conform to the schema's field definitions. Omit to create an object with all fields at their default or null values." 62 org: str | None 63 "Organization ID (`org_...`) to associate with the object. Typically required for system-owned objects." 64 schema_key: str | None 65 "Legacy alias for `type` (schema `lookup_key`). Prefer `type` on new clients. Provide one of `type`, `schema_key`, or `config`." 66 system: bool | None 67 "When `true`, creates a system-owned object with no team, user, or agent owner. Requires elevated API credentials; returns 403 if the caller lacks permission." 68 team: str | None 69 "Team ID (`team_...`) to set as the object owner. When supplied, takes priority over `user` and `agent`." 70 type: str | None 71 "Schema type identifier (`lookup_key`) that defines the object's shape and validation rules. Preferred over the legacy `schema_key` / `config` aliases." 72 upsert: bool | None 73 "When `true` and the schema declares a `row_key`, updates the existing object at that key for the same owner instead of returning 409 Conflict. Returns HTTP 200 on update and 201 on create." 74 user: str | None 75 "User ID (`user_...`) to set as the object owner. Used when neither `team` nor a higher-priority owner is set." 76 77 78class CustomObjectReplaceInputAclAddItem(TypedDict, total=False): 79 actions: Required[list[str]] 80 'Array of action strings the principal is permitted to perform, e.g. `["read", "write"]`. Must contain at least one entry.' 81 principal: str | None 82 'The identifier of the principal. A string ID for `"user"`, `"team"`, `"org"`, and `"agent"` types; one of `"admin"`, `"member"`, or `"viewer"` for `"org_role"`; omit entirely when `principal_type` is `"everyone"`.' 83 principal_type: Required[str] 84 'The kind of principal receiving the grant. One of `"user"`, `"team"`, `"org"`, `"org_role"`, `"agent"`, or `"everyone"`.' 85 86 87class CustomObjectReplaceInputAclGrantsItem(TypedDict, total=False): 88 actions: Required[list[str]] 89 'Array of action strings the principal is permitted to perform, e.g. `["read", "write"]`. Must contain at least one entry.' 90 principal: str | None 91 'The identifier of the principal. A string ID for `"user"`, `"team"`, `"org"`, and `"agent"` types; one of `"admin"`, `"member"`, or `"viewer"` for `"org_role"`; omit entirely when `principal_type` is `"everyone"`.' 92 principal_type: Required[str] 93 'The kind of principal receiving the grant. One of `"user"`, `"team"`, `"org"`, `"org_role"`, `"agent"`, or `"everyone"`.' 94 95 96class CustomObjectReplaceInputAclRemoveItem(TypedDict, total=False): 97 principal: str | None 98 'The identifier of the principal to remove. A string ID for `"user"`, `"team"`, `"org"`, and `"agent"` types; one of `"admin"`, `"member"`, or `"viewer"` for `"org_role"`. Omit when `principal_type` is `"everyone"`.' 99 principal_type: Required[str] 100 'The kind of principal to remove. One of `"user"`, `"team"`, `"org"`, `"org_role"`, `"agent"`, or `"everyone"`.' 101 102 103class CustomObjectReplaceInputAcl(TypedDict, total=False): 104 add: list[CustomObjectReplaceInputAclAddItem] | None 105 "Patch mode: grants to add or merge into the existing list. Cannot be combined with `grants`." 106 grants: list[CustomObjectReplaceInputAclGrantsItem] | None 107 "Replace mode: the complete new list of grants that replaces all existing entries. Send an empty array (`[]`) to clear all grants. Cannot be combined with `add` or `remove`." 108 remove: list[CustomObjectReplaceInputAclRemoveItem] | None 109 "Patch mode: principals whose grants should be removed from the existing list. Cannot be combined with `grants`." 110 111 112class CustomObjectReplaceInput(TypedDict, total=False): 113 "Update a custom object" 114 115 acl: CustomObjectReplaceInputAcl | None 116 "Updated access control list. Supports full replacement via `grants` or targeted `add`/`remove` operations." 117 field_ops: dict[str, Any] | None 118 "Granular array operations to apply per field (e.g. append, prepend, remove). A field must not appear in both `fields` and `field_ops`." 119 fields: dict[str, Any] | None 120 "Key-value map of field values to merge into the object. Only the supplied keys are affected." 121 type: str | None 122 "Schema type identifier (`lookup_key`) of the object. Optional; used for routing context only." 123 124 125class CustomObjectDeleteResponse(BaseModel): 126 """ 127 Successful response 128 """ 129 130 deleted: bool = Field(..., description="Always `true` when the deletion succeeds.") 131 id: str = Field(..., description="ID of the deleted custom object (`cobj_...`).") 132 133 134class CustomObjectReplaceResponseDataAclAddItem(BaseModel): 135 actions: list[str] = Field( 136 ..., 137 description='Array of action strings the principal is permitted to perform, e.g. `["read", "write"]`. Must contain at least one entry.', 138 ) 139 principal: str | None = Field( 140 default=None, 141 description='The identifier of the principal. A string ID for `"user"`, `"team"`, `"org"`, and `"agent"` types; one of `"admin"`, `"member"`, or `"viewer"` for `"org_role"`; omit entirely when `principal_type` is `"everyone"`.', 142 ) 143 principal_type: str = Field( 144 ..., 145 description='The kind of principal receiving the grant. One of `"user"`, `"team"`, `"org"`, `"org_role"`, `"agent"`, or `"everyone"`.', 146 ) 147 148 149class CustomObjectReplaceResponseDataAclGrantsItem(BaseModel): 150 actions: list[str] = Field( 151 ..., 152 description='Array of action strings the principal is permitted to perform, e.g. `["read", "write"]`. Must contain at least one entry.', 153 ) 154 principal: str | None = Field( 155 default=None, 156 description='The identifier of the principal. A string ID for `"user"`, `"team"`, `"org"`, and `"agent"` types; one of `"admin"`, `"member"`, or `"viewer"` for `"org_role"`; omit entirely when `principal_type` is `"everyone"`.', 157 ) 158 principal_type: str = Field( 159 ..., 160 description='The kind of principal receiving the grant. One of `"user"`, `"team"`, `"org"`, `"org_role"`, `"agent"`, or `"everyone"`.', 161 ) 162 163 164class CustomObjectReplaceResponseDataAclRemoveItem(BaseModel): 165 principal: str | None = Field( 166 default=None, 167 description='The identifier of the principal to remove. A string ID for `"user"`, `"team"`, `"org"`, and `"agent"` types; one of `"admin"`, `"member"`, or `"viewer"` for `"org_role"`. Omit when `principal_type` is `"everyone"`.', 168 ) 169 principal_type: str = Field( 170 ..., 171 description='The kind of principal to remove. One of `"user"`, `"team"`, `"org"`, `"org_role"`, `"agent"`, or `"everyone"`.', 172 ) 173 174 175class CustomObjectReplaceResponseDataAcl(BaseModel): 176 add: list[CustomObjectReplaceResponseDataAclAddItem] | None = Field( 177 default=None, 178 description="Patch mode: grants to add or merge into the existing list. Cannot be combined with `grants`.", 179 ) 180 grants: list[CustomObjectReplaceResponseDataAclGrantsItem] | None = Field( 181 default=None, 182 description="Replace mode: the complete new list of grants that replaces all existing entries. Send an empty array (`[]`) to clear all grants. Cannot be combined with `add` or `remove`.", 183 ) 184 remove: list[CustomObjectReplaceResponseDataAclRemoveItem] | None = Field( 185 default=None, 186 description="Patch mode: principals whose grants should be removed from the existing list. Cannot be combined with `grants`.", 187 ) 188 189 190class CustomObjectReplaceResponseData(BaseModel): 191 acl: CustomObjectReplaceResponseDataAcl | None = Field( 192 default=None, 193 description="Access control list governing read and write access to this custom object. Only returned to resource owners and privileged or organization-admin viewers; `null` for everyone else.", 194 ) 195 created_at: datetime | None = Field( 196 default=None, description="When the custom object was created (ISO 8601)." 197 ) 198 fields: dict[str, Any] | None = Field( 199 default=None, 200 description="Map of field names to their current values as defined by the object's schema type.", 201 ) 202 id: str = Field(..., description="Unique identifier for the custom object (`cobj_...`).") 203 org: str | None = Field( 204 default=None, description="ID of the organization this object belongs to (`org_...`)." 205 ) 206 row_key: str | None = Field( 207 default=None, 208 description="An optional stable key used to identify this object by a caller-controlled string rather than its generated ID. `null` if not set.", 209 ) 210 sandbox: str | None = Field( 211 default=None, 212 description="ID of the sandbox environment this object is scoped to (`dsb_...`). `null` for production objects.", 213 ) 214 schema_type: str | None = Field( 215 default=None, 216 description="The lookup key of the schema type that defines this object's field structure. `null` if the schema type has not been set.", 217 ) 218 team: str | None = Field( 219 default=None, 220 description="ID of the team that owns this object (`tem_...`). `null` if the object is not team-scoped.", 221 ) 222 updated_at: datetime | None = Field( 223 default=None, 224 description="When the custom object was last modified (ISO 8601). `null` if the object has never been updated after creation.", 225 ) 226 user: str | None = Field( 227 default=None, 228 description="ID of the user that owns this object (`usr_...`). `null` if the object is not user-scoped.", 229 ) 230 version: int | None = Field( 231 default=None, 232 description="Optimistic concurrency version of the object. Increments with each successful update; pass this value in write operations to detect conflicting changes.", 233 ) 234 235 236class CustomObjectReplaceResponse(BaseModel): 237 """ 238 Successful response 239 """ 240 241 data: CustomObjectReplaceResponseData = Field( 242 ..., description="The custom object after the update has been applied." 243 ) 244 meta: dict[str, Any] | None = Field( 245 default=None, description="Version metadata for the updated object." 246 ) 247 248 249class AsyncCustomObjectResource: 250 def __init__(self, http: HttpClient): 251 self._http = http 252 253 async def list( 254 self, 255 *, 256 type: str | None = None, 257 schema_key: str | None = None, 258 row_key: str | None = None, 259 sort_key: builtins.list[str] | None = None, 260 team: builtins.list[str] | None = None, 261 user: builtins.list[str] | None = None, 262 agent: builtins.list[str] | None = None, 263 org: builtins.list[str] | None = None, 264 query: str | None = None, 265 search: str | None = None, 266 page: int | None = None, 267 page_size: int | None = None, 268 ) -> CustomObjectListResponse: 269 """ 270 List custom objects 271 Returns a paginated list of custom objects visible to the authenticated 272 viewer, ordered by creation time descending. Results span all ownership 273 types (team-owned, user-owned, agent-owned, and system-owned) that the 274 viewer has access to. 275 Filter by schema type with `type` (preferred) or the legacy alias 276 `schema_key`. Use the `row_key` param to perform an exact-match partition 277 lookup. You may additionally supply `sort_key` to narrow within that 278 partition `sort_key` requires `row_key` and the request returns 400 if 279 `sort_key` is provided alone. Owner filters (`team`, `user`, `agent`, 280 `org`) are additive: each accepts an array of IDs (or a single ID, which 281 is wrapped) and returns objects matching any of the supplied values. 282 When `query` is supplied, results are ranked by full-text relevance 283 (descending `ts_rank`) rather than creation time. The legacy `search` 284 param performs a case-insensitive substring match and is retained for 285 developer-namespace clients. 286 287 Args: 288 type: Schema type identifier (`lookup_key`) to filter by. Only objects of this type are returned. Alias of `schema_key`; either name is accepted. 289 schema_key: Legacy alias for `type`. Prefer `type` on new clients. When both are supplied, `type` wins. 290 row_key: Exact `row_key` value to match. When supplied, only objects with this partition key are returned. 291 sort_key: One or more `sort_key` values to match within the `row_key` partition. Requires `row_key` to be set. 292 team: One or more team IDs (`team_...`) to filter by owning team. Returns objects owned by any of the supplied teams. 293 user: One or more user IDs (`user_...`) to filter by owning user. Returns objects owned by any of the supplied users. 294 agent: One or more agent IDs to filter by owning agent. Returns objects owned by any of the supplied agents. 295 org: One or more organization IDs (`org_...`) to filter by. Typically used by admins to query system-owned objects in a specific org. 296 query: Full-text search string matched against the schema's configured search fields. When supplied, results are ordered by relevance score descending instead of creation time descending. 297 search: Case-insensitive substring search applied across the schema type and serialized field values. Deprecated prefer `query` for full-text search. Retained for developer-namespace clients. 298 page: Page number to retrieve (1-indexed). Defaults to `1`. 299 page_size: Number of objects per page. Defaults to `25`; maximum is `100`. 300 301 Returns: 302 Paginated list of custom objects matching the supplied filters. 303 """ 304 query: dict[str, object] = {} 305 if type is not None: 306 query["type"] = type 307 if schema_key is not None: 308 query["schema_key"] = schema_key 309 if row_key is not None: 310 query["row_key"] = row_key 311 if sort_key is not None: 312 query["sort_key"] = sort_key 313 if team is not None: 314 query["team"] = team 315 if user is not None: 316 query["user"] = user 317 if agent is not None: 318 query["agent"] = agent 319 if org is not None: 320 query["org"] = org 321 if query is not None: 322 query["query"] = query 323 if search is not None: 324 query["search"] = search 325 if page is not None: 326 query["page"] = page 327 if page_size is not None: 328 query["page_size"] = page_size 329 return await self._http.request( 330 "/api/v1/custom_objects", 331 query=query, 332 response_type=CustomObjectListResponse, 333 ) 334 335 async def create(self, input: CustomObjectCreateInput) -> CustomObject: 336 """ 337 Create a custom object 338 Creates a new custom object of the given schema type and returns the 339 persisted object. The caller must be authenticated and authorized to create 340 objects of the specified type. 341 Identify the schema with `type` (preferred), or the legacy aliases 342 `schema_key` (lookup key) / `config` (config ID). Exactly one identifier is 343 required; when more than one is supplied, `type` wins over `schema_key`, 344 which wins over `config`. 345 Owner resolution follows a priority order: if `team` is supplied the object 346 is team-owned; if `user` is supplied it is owned by that user; if `agent` is 347 supplied it is agent-owned; otherwise the object is owned by the authenticated 348 user. Pass `system: true` explicitly to force system ownership this requires 349 elevated API credentials and returns 403 if the caller lacks permission. 350 If the schema declares a `row_key` (and optionally a `sort_key`), you may 351 pass `upsert: true` to update an existing object at that key instead of 352 receiving a 409 Conflict. The response status is `200` on an update and 353 `201` on a new create. 354 355 Args: 356 input: Request body. 357 input.acl: Access control list for the custom object. Supports explicit `read` and `write` grants to users, teams, organizations, organization roles, agents, or everyone. 358 input.agent: Agent user ID to set as the object owner. Used when neither `team` nor `user` is supplied. 359 input.config: Config ID (`cfg_...`) that resolves to the target schema. Provide one of `type`, `schema_key`, or `config`. 360 input.fields: Key-value map of field values for the new object. Must conform to the schema's field definitions. Omit to create an object with all fields at their default or null values. 361 input.org: Organization ID (`org_...`) to associate with the object. Typically required for system-owned objects. 362 input.schema_key: Legacy alias for `type` (schema `lookup_key`). Prefer `type` on new clients. Provide one of `type`, `schema_key`, or `config`. 363 input.system: When `true`, creates a system-owned object with no team, user, or agent owner. Requires elevated API credentials; returns 403 if the caller lacks permission. 364 input.team: Team ID (`team_...`) to set as the object owner. When supplied, takes priority over `user` and `agent`. 365 input.type: Schema type identifier (`lookup_key`) that defines the object's shape and validation rules. Preferred over the legacy `schema_key` / `config` aliases. 366 input.upsert: When `true` and the schema declares a `row_key`, updates the existing object at that key for the same owner instead of returning 409 Conflict. Returns HTTP 200 on update and 201 on create. 367 input.user: User ID (`user_...`) to set as the object owner. Used when neither `team` nor a higher-priority owner is set. 368 369 Returns: 370 The created (or upserted) custom object. 371 """ 372 return await self._http.request( 373 "/api/v1/custom_objects", 374 method="POST", 375 body=input, 376 response_type=CustomObject, 377 ) 378 379 async def delete(self, object: str) -> CustomObjectDeleteResponse: 380 """ 381 Delete a custom object 382 Permanently deletes the custom object identified by `object`. The caller 383 must be authenticated and have permission to delete the object. 384 On success, returns a confirmation payload containing the deleted object's 385 ID so callers can confirm the deletion without a follow-up fetch. 386 Attempting to delete an object that does not exist or has already been 387 deleted returns 404. 388 389 Args: 390 object: Custom object ID (`cobj_...`) of the object to delete. 391 392 Returns: 393 Successful response 394 """ 395 return await self._http.request( 396 f"/api/v1/custom_objects/{object}", 397 method="DELETE", 398 response_type=CustomObjectDeleteResponse, 399 ) 400 401 async def get(self, object: str, *, type: str | None = None) -> CustomObject: 402 """ 403 Retrieve a custom object 404 Returns a single custom object identified by its ID. The authenticated viewer 405 must have visibility access to the object. 406 Returns 404 if the object does not exist, has been deleted, or is not 407 visible to the viewer. 408 409 Args: 410 object: Custom object ID (`cobj_...`) to retrieve. 411 type: Schema type identifier (`lookup_key`) of the object. Optional; used for routing context only. 412 413 Returns: 414 The requested custom object. 415 """ 416 query: dict[str, object] = {} 417 if type is not None: 418 query["type"] = type 419 return await self._http.request( 420 f"/api/v1/custom_objects/{object}", 421 query=query, 422 response_type=CustomObject, 423 ) 424 425 async def replace( 426 self, object: str, input: CustomObjectReplaceInput 427 ) -> CustomObjectReplaceResponse: 428 """ 429 Update a custom object 430 Updates the fields of an existing custom object and returns the updated 431 object along with its new version number. The authenticated viewer must have 432 permission to modify the object. 433 You may supply `fields` (a full or partial key-value map to merge into the 434 object), `field_ops` (granular array operations per field), `acl`, or any 435 compatible combination. The same field name must not appear in both 436 `fields` and `field_ops`, which returns 422. Returns 404 if the object does 437 not exist or has been deleted. 438 439 Args: 440 object: Custom object ID (`cobj_...`) to update. 441 input: Request body. 442 input.acl: Updated access control list. Supports full replacement via `grants` or targeted `add`/`remove` operations. 443 input.field_ops: Granular array operations to apply per field (e.g. append, prepend, remove). A field must not appear in both `fields` and `field_ops`. 444 input.fields: Key-value map of field values to merge into the object. Only the supplied keys are affected. 445 input.type: Schema type identifier (`lookup_key`) of the object. Optional; used for routing context only. 446 447 Returns: 448 Successful response 449 """ 450 return await self._http.request( 451 f"/api/v1/custom_objects/{object}", 452 method="PUT", 453 body=input, 454 response_type=CustomObjectReplaceResponse, 455 ) 456 457 458class CustomObjectResource: 459 def __init__(self, http: SyncHttpClient): 460 self._http = http 461 462 def list( 463 self, 464 *, 465 type: str | None = None, 466 schema_key: str | None = None, 467 row_key: str | None = None, 468 sort_key: builtins.list[str] | None = None, 469 team: builtins.list[str] | None = None, 470 user: builtins.list[str] | None = None, 471 agent: builtins.list[str] | None = None, 472 org: builtins.list[str] | None = None, 473 query: str | None = None, 474 search: str | None = None, 475 page: int | None = None, 476 page_size: int | None = None, 477 ) -> CustomObjectListResponse: 478 """ 479 List custom objects 480 Returns a paginated list of custom objects visible to the authenticated 481 viewer, ordered by creation time descending. Results span all ownership 482 types (team-owned, user-owned, agent-owned, and system-owned) that the 483 viewer has access to. 484 Filter by schema type with `type` (preferred) or the legacy alias 485 `schema_key`. Use the `row_key` param to perform an exact-match partition 486 lookup. You may additionally supply `sort_key` to narrow within that 487 partition `sort_key` requires `row_key` and the request returns 400 if 488 `sort_key` is provided alone. Owner filters (`team`, `user`, `agent`, 489 `org`) are additive: each accepts an array of IDs (or a single ID, which 490 is wrapped) and returns objects matching any of the supplied values. 491 When `query` is supplied, results are ranked by full-text relevance 492 (descending `ts_rank`) rather than creation time. The legacy `search` 493 param performs a case-insensitive substring match and is retained for 494 developer-namespace clients. 495 496 Args: 497 type: Schema type identifier (`lookup_key`) to filter by. Only objects of this type are returned. Alias of `schema_key`; either name is accepted. 498 schema_key: Legacy alias for `type`. Prefer `type` on new clients. When both are supplied, `type` wins. 499 row_key: Exact `row_key` value to match. When supplied, only objects with this partition key are returned. 500 sort_key: One or more `sort_key` values to match within the `row_key` partition. Requires `row_key` to be set. 501 team: One or more team IDs (`team_...`) to filter by owning team. Returns objects owned by any of the supplied teams. 502 user: One or more user IDs (`user_...`) to filter by owning user. Returns objects owned by any of the supplied users. 503 agent: One or more agent IDs to filter by owning agent. Returns objects owned by any of the supplied agents. 504 org: One or more organization IDs (`org_...`) to filter by. Typically used by admins to query system-owned objects in a specific org. 505 query: Full-text search string matched against the schema's configured search fields. When supplied, results are ordered by relevance score descending instead of creation time descending. 506 search: Case-insensitive substring search applied across the schema type and serialized field values. Deprecated prefer `query` for full-text search. Retained for developer-namespace clients. 507 page: Page number to retrieve (1-indexed). Defaults to `1`. 508 page_size: Number of objects per page. Defaults to `25`; maximum is `100`. 509 510 Returns: 511 Paginated list of custom objects matching the supplied filters. 512 """ 513 query: dict[str, object] = {} 514 if type is not None: 515 query["type"] = type 516 if schema_key is not None: 517 query["schema_key"] = schema_key 518 if row_key is not None: 519 query["row_key"] = row_key 520 if sort_key is not None: 521 query["sort_key"] = sort_key 522 if team is not None: 523 query["team"] = team 524 if user is not None: 525 query["user"] = user 526 if agent is not None: 527 query["agent"] = agent 528 if org is not None: 529 query["org"] = org 530 if query is not None: 531 query["query"] = query 532 if search is not None: 533 query["search"] = search 534 if page is not None: 535 query["page"] = page 536 if page_size is not None: 537 query["page_size"] = page_size 538 return self._http.request( 539 "/api/v1/custom_objects", 540 query=query, 541 response_type=CustomObjectListResponse, 542 ) 543 544 def create(self, input: CustomObjectCreateInput) -> CustomObject: 545 """ 546 Create a custom object 547 Creates a new custom object of the given schema type and returns the 548 persisted object. The caller must be authenticated and authorized to create 549 objects of the specified type. 550 Identify the schema with `type` (preferred), or the legacy aliases 551 `schema_key` (lookup key) / `config` (config ID). Exactly one identifier is 552 required; when more than one is supplied, `type` wins over `schema_key`, 553 which wins over `config`. 554 Owner resolution follows a priority order: if `team` is supplied the object 555 is team-owned; if `user` is supplied it is owned by that user; if `agent` is 556 supplied it is agent-owned; otherwise the object is owned by the authenticated 557 user. Pass `system: true` explicitly to force system ownership this requires 558 elevated API credentials and returns 403 if the caller lacks permission. 559 If the schema declares a `row_key` (and optionally a `sort_key`), you may 560 pass `upsert: true` to update an existing object at that key instead of 561 receiving a 409 Conflict. The response status is `200` on an update and 562 `201` on a new create. 563 564 Args: 565 input: Request body. 566 input.acl: Access control list for the custom object. Supports explicit `read` and `write` grants to users, teams, organizations, organization roles, agents, or everyone. 567 input.agent: Agent user ID to set as the object owner. Used when neither `team` nor `user` is supplied. 568 input.config: Config ID (`cfg_...`) that resolves to the target schema. Provide one of `type`, `schema_key`, or `config`. 569 input.fields: Key-value map of field values for the new object. Must conform to the schema's field definitions. Omit to create an object with all fields at their default or null values. 570 input.org: Organization ID (`org_...`) to associate with the object. Typically required for system-owned objects. 571 input.schema_key: Legacy alias for `type` (schema `lookup_key`). Prefer `type` on new clients. Provide one of `type`, `schema_key`, or `config`. 572 input.system: When `true`, creates a system-owned object with no team, user, or agent owner. Requires elevated API credentials; returns 403 if the caller lacks permission. 573 input.team: Team ID (`team_...`) to set as the object owner. When supplied, takes priority over `user` and `agent`. 574 input.type: Schema type identifier (`lookup_key`) that defines the object's shape and validation rules. Preferred over the legacy `schema_key` / `config` aliases. 575 input.upsert: When `true` and the schema declares a `row_key`, updates the existing object at that key for the same owner instead of returning 409 Conflict. Returns HTTP 200 on update and 201 on create. 576 input.user: User ID (`user_...`) to set as the object owner. Used when neither `team` nor a higher-priority owner is set. 577 578 Returns: 579 The created (or upserted) custom object. 580 """ 581 return self._http.request( 582 "/api/v1/custom_objects", 583 method="POST", 584 body=input, 585 response_type=CustomObject, 586 ) 587 588 def delete(self, object: str) -> CustomObjectDeleteResponse: 589 """ 590 Delete a custom object 591 Permanently deletes the custom object identified by `object`. The caller 592 must be authenticated and have permission to delete the object. 593 On success, returns a confirmation payload containing the deleted object's 594 ID so callers can confirm the deletion without a follow-up fetch. 595 Attempting to delete an object that does not exist or has already been 596 deleted returns 404. 597 598 Args: 599 object: Custom object ID (`cobj_...`) of the object to delete. 600 601 Returns: 602 Successful response 603 """ 604 return self._http.request( 605 f"/api/v1/custom_objects/{object}", 606 method="DELETE", 607 response_type=CustomObjectDeleteResponse, 608 ) 609 610 def get(self, object: str, *, type: str | None = None) -> CustomObject: 611 """ 612 Retrieve a custom object 613 Returns a single custom object identified by its ID. The authenticated viewer 614 must have visibility access to the object. 615 Returns 404 if the object does not exist, has been deleted, or is not 616 visible to the viewer. 617 618 Args: 619 object: Custom object ID (`cobj_...`) to retrieve. 620 type: Schema type identifier (`lookup_key`) of the object. Optional; used for routing context only. 621 622 Returns: 623 The requested custom object. 624 """ 625 query: dict[str, object] = {} 626 if type is not None: 627 query["type"] = type 628 return self._http.request( 629 f"/api/v1/custom_objects/{object}", 630 query=query, 631 response_type=CustomObject, 632 ) 633 634 def replace(self, object: str, input: CustomObjectReplaceInput) -> CustomObjectReplaceResponse: 635 """ 636 Update a custom object 637 Updates the fields of an existing custom object and returns the updated 638 object along with its new version number. The authenticated viewer must have 639 permission to modify the object. 640 You may supply `fields` (a full or partial key-value map to merge into the 641 object), `field_ops` (granular array operations per field), `acl`, or any 642 compatible combination. The same field name must not appear in both 643 `fields` and `field_ops`, which returns 422. Returns 404 if the object does 644 not exist or has been deleted. 645 646 Args: 647 object: Custom object ID (`cobj_...`) to update. 648 input: Request body. 649 input.acl: Updated access control list. Supports full replacement via `grants` or targeted `add`/`remove` operations. 650 input.field_ops: Granular array operations to apply per field (e.g. append, prepend, remove). A field must not appear in both `fields` and `field_ops`. 651 input.fields: Key-value map of field values to merge into the object. Only the supplied keys are affected. 652 input.type: Schema type identifier (`lookup_key`) of the object. Optional; used for routing context only. 653 654 Returns: 655 Successful response 656 """ 657 return self._http.request( 658 f"/api/v1/custom_objects/{object}", 659 method="PUT", 660 body=input, 661 response_type=CustomObjectReplaceResponse, 662 )
18class CustomObjectCreateInputAclAddItem(TypedDict, total=False): 19 actions: Required[list[str]] 20 'Array of action strings the principal is permitted to perform, e.g. `["read", "write"]`. Must contain at least one entry.' 21 principal: str | None 22 'The identifier of the principal. A string ID for `"user"`, `"team"`, `"org"`, and `"agent"` types; one of `"admin"`, `"member"`, or `"viewer"` for `"org_role"`; omit entirely when `principal_type` is `"everyone"`.' 23 principal_type: Required[str] 24 'The kind of principal receiving the grant. One of `"user"`, `"team"`, `"org"`, `"org_role"`, `"agent"`, or `"everyone"`.'
Array of action strings the principal is permitted to perform, e.g. ["read", "write"]. Must contain at least one entry.
The identifier of the principal. A string ID for "user", "team", "org", and "agent" types; one of "admin", "member", or "viewer" for "org_role"; omit entirely when principal_type is "everyone".
27class CustomObjectCreateInputAclGrantsItem(TypedDict, total=False): 28 actions: Required[list[str]] 29 'Array of action strings the principal is permitted to perform, e.g. `["read", "write"]`. Must contain at least one entry.' 30 principal: str | None 31 'The identifier of the principal. A string ID for `"user"`, `"team"`, `"org"`, and `"agent"` types; one of `"admin"`, `"member"`, or `"viewer"` for `"org_role"`; omit entirely when `principal_type` is `"everyone"`.' 32 principal_type: Required[str] 33 'The kind of principal receiving the grant. One of `"user"`, `"team"`, `"org"`, `"org_role"`, `"agent"`, or `"everyone"`.'
Array of action strings the principal is permitted to perform, e.g. ["read", "write"]. Must contain at least one entry.
The identifier of the principal. A string ID for "user", "team", "org", and "agent" types; one of "admin", "member", or "viewer" for "org_role"; omit entirely when principal_type is "everyone".
36class CustomObjectCreateInputAclRemoveItem(TypedDict, total=False): 37 principal: str | None 38 'The identifier of the principal to remove. A string ID for `"user"`, `"team"`, `"org"`, and `"agent"` types; one of `"admin"`, `"member"`, or `"viewer"` for `"org_role"`. Omit when `principal_type` is `"everyone"`.' 39 principal_type: Required[str] 40 'The kind of principal to remove. One of `"user"`, `"team"`, `"org"`, `"org_role"`, `"agent"`, or `"everyone"`.'
The identifier of the principal to remove. A string ID for "user", "team", "org", and "agent" types; one of "admin", "member", or "viewer" for "org_role". Omit when principal_type is "everyone".
43class CustomObjectCreateInputAcl(TypedDict, total=False): 44 add: list[CustomObjectCreateInputAclAddItem] | None 45 "Patch mode: grants to add or merge into the existing list. Cannot be combined with `grants`." 46 grants: list[CustomObjectCreateInputAclGrantsItem] | None 47 "Replace mode: the complete new list of grants that replaces all existing entries. Send an empty array (`[]`) to clear all grants. Cannot be combined with `add` or `remove`." 48 remove: list[CustomObjectCreateInputAclRemoveItem] | None 49 "Patch mode: principals whose grants should be removed from the existing list. Cannot be combined with `grants`."
Patch mode: grants to add or merge into the existing list. Cannot be combined with grants.
Patch mode: principals whose grants should be removed from the existing list. Cannot be combined with grants.
52class CustomObjectCreateInput(TypedDict, total=False): 53 "Create a custom object" 54 55 acl: CustomObjectCreateInputAcl | None 56 "Access control list for the custom object. Supports explicit `read` and `write` grants to users, teams, organizations, organization roles, agents, or everyone." 57 agent: str | None 58 "Agent user ID to set as the object owner. Used when neither `team` nor `user` is supplied." 59 config: str | None 60 "Config ID (`cfg_...`) that resolves to the target schema. Provide one of `type`, `schema_key`, or `config`." 61 fields: dict[str, Any] | None 62 "Key-value map of field values for the new object. Must conform to the schema's field definitions. Omit to create an object with all fields at their default or null values." 63 org: str | None 64 "Organization ID (`org_...`) to associate with the object. Typically required for system-owned objects." 65 schema_key: str | None 66 "Legacy alias for `type` (schema `lookup_key`). Prefer `type` on new clients. Provide one of `type`, `schema_key`, or `config`." 67 system: bool | None 68 "When `true`, creates a system-owned object with no team, user, or agent owner. Requires elevated API credentials; returns 403 if the caller lacks permission." 69 team: str | None 70 "Team ID (`team_...`) to set as the object owner. When supplied, takes priority over `user` and `agent`." 71 type: str | None 72 "Schema type identifier (`lookup_key`) that defines the object's shape and validation rules. Preferred over the legacy `schema_key` / `config` aliases." 73 upsert: bool | None 74 "When `true` and the schema declares a `row_key`, updates the existing object at that key for the same owner instead of returning 409 Conflict. Returns HTTP 200 on update and 201 on create." 75 user: str | None 76 "User ID (`user_...`) to set as the object owner. Used when neither `team` nor a higher-priority owner is set."
Create a custom object
Access control list for the custom object. Supports explicit read and write grants to users, teams, organizations, organization roles, agents, or everyone.
Config ID (cfg_...) that resolves to the target schema. Provide one of type, schema_key, or config.
Key-value map of field values for the new object. Must conform to the schema's field definitions. Omit to create an object with all fields at their default or null values.
Organization ID (org_...) to associate with the object. Typically required for system-owned objects.
Legacy alias for type (schema lookup_key). Prefer type on new clients. Provide one of type, schema_key, or config.
When true, creates a system-owned object with no team, user, or agent owner. Requires elevated API credentials; returns 403 if the caller lacks permission.
Schema type identifier (lookup_key) that defines the object's shape and validation rules. Preferred over the legacy schema_key / config aliases.
When true and the schema declares a row_key, updates the existing object at that key for the same owner instead of returning 409 Conflict. Returns HTTP 200 on update and 201 on create.
User ID (user_...) to set as the object owner. Used when neither team nor a higher-priority owner is set.
79class CustomObjectReplaceInputAclAddItem(TypedDict, total=False): 80 actions: Required[list[str]] 81 'Array of action strings the principal is permitted to perform, e.g. `["read", "write"]`. Must contain at least one entry.' 82 principal: str | None 83 'The identifier of the principal. A string ID for `"user"`, `"team"`, `"org"`, and `"agent"` types; one of `"admin"`, `"member"`, or `"viewer"` for `"org_role"`; omit entirely when `principal_type` is `"everyone"`.' 84 principal_type: Required[str] 85 'The kind of principal receiving the grant. One of `"user"`, `"team"`, `"org"`, `"org_role"`, `"agent"`, or `"everyone"`.'
Array of action strings the principal is permitted to perform, e.g. ["read", "write"]. Must contain at least one entry.
The identifier of the principal. A string ID for "user", "team", "org", and "agent" types; one of "admin", "member", or "viewer" for "org_role"; omit entirely when principal_type is "everyone".
88class CustomObjectReplaceInputAclGrantsItem(TypedDict, total=False): 89 actions: Required[list[str]] 90 'Array of action strings the principal is permitted to perform, e.g. `["read", "write"]`. Must contain at least one entry.' 91 principal: str | None 92 'The identifier of the principal. A string ID for `"user"`, `"team"`, `"org"`, and `"agent"` types; one of `"admin"`, `"member"`, or `"viewer"` for `"org_role"`; omit entirely when `principal_type` is `"everyone"`.' 93 principal_type: Required[str] 94 'The kind of principal receiving the grant. One of `"user"`, `"team"`, `"org"`, `"org_role"`, `"agent"`, or `"everyone"`.'
Array of action strings the principal is permitted to perform, e.g. ["read", "write"]. Must contain at least one entry.
The identifier of the principal. A string ID for "user", "team", "org", and "agent" types; one of "admin", "member", or "viewer" for "org_role"; omit entirely when principal_type is "everyone".
97class CustomObjectReplaceInputAclRemoveItem(TypedDict, total=False): 98 principal: str | None 99 'The identifier of the principal to remove. A string ID for `"user"`, `"team"`, `"org"`, and `"agent"` types; one of `"admin"`, `"member"`, or `"viewer"` for `"org_role"`. Omit when `principal_type` is `"everyone"`.' 100 principal_type: Required[str] 101 'The kind of principal to remove. One of `"user"`, `"team"`, `"org"`, `"org_role"`, `"agent"`, or `"everyone"`.'
The identifier of the principal to remove. A string ID for "user", "team", "org", and "agent" types; one of "admin", "member", or "viewer" for "org_role". Omit when principal_type is "everyone".
104class CustomObjectReplaceInputAcl(TypedDict, total=False): 105 add: list[CustomObjectReplaceInputAclAddItem] | None 106 "Patch mode: grants to add or merge into the existing list. Cannot be combined with `grants`." 107 grants: list[CustomObjectReplaceInputAclGrantsItem] | None 108 "Replace mode: the complete new list of grants that replaces all existing entries. Send an empty array (`[]`) to clear all grants. Cannot be combined with `add` or `remove`." 109 remove: list[CustomObjectReplaceInputAclRemoveItem] | None 110 "Patch mode: principals whose grants should be removed from the existing list. Cannot be combined with `grants`."
Patch mode: grants to add or merge into the existing list. Cannot be combined with grants.
Patch mode: principals whose grants should be removed from the existing list. Cannot be combined with grants.
113class CustomObjectReplaceInput(TypedDict, total=False): 114 "Update a custom object" 115 116 acl: CustomObjectReplaceInputAcl | None 117 "Updated access control list. Supports full replacement via `grants` or targeted `add`/`remove` operations." 118 field_ops: dict[str, Any] | None 119 "Granular array operations to apply per field (e.g. append, prepend, remove). A field must not appear in both `fields` and `field_ops`." 120 fields: dict[str, Any] | None 121 "Key-value map of field values to merge into the object. Only the supplied keys are affected." 122 type: str | None 123 "Schema type identifier (`lookup_key`) of the object. Optional; used for routing context only."
Update a custom object
Updated access control list. Supports full replacement via grants or targeted add/remove operations.
126class CustomObjectDeleteResponse(BaseModel): 127 """ 128 Successful response 129 """ 130 131 deleted: bool = Field(..., description="Always `true` when the deletion succeeds.") 132 id: str = Field(..., description="ID of the deleted custom object (`cobj_...`).")
Successful response
135class CustomObjectReplaceResponseDataAclAddItem(BaseModel): 136 actions: list[str] = Field( 137 ..., 138 description='Array of action strings the principal is permitted to perform, e.g. `["read", "write"]`. Must contain at least one entry.', 139 ) 140 principal: str | None = Field( 141 default=None, 142 description='The identifier of the principal. A string ID for `"user"`, `"team"`, `"org"`, and `"agent"` types; one of `"admin"`, `"member"`, or `"viewer"` for `"org_role"`; omit entirely when `principal_type` is `"everyone"`.', 143 ) 144 principal_type: str = Field( 145 ..., 146 description='The kind of principal receiving the grant. One of `"user"`, `"team"`, `"org"`, `"org_role"`, `"agent"`, or `"everyone"`.', 147 )
!!! abstract "Usage Documentation" Models
A base class for creating Pydantic models.
Attributes:
- __class_vars__: The names of the class variables defined on the model.
- __private_attributes__: Metadata about the private attributes of the model.
- __signature__: The synthesized
__init__[Signature][inspect.Signature] of the model. - __pydantic_complete__: Whether model building is completed, or if there are still undefined fields.
- __pydantic_core_schema__: The core schema of the model.
- __pydantic_custom_init__: Whether the model has a custom
__init__function. - __pydantic_decorators__: Metadata containing the decorators defined on the model.
This replaces
Model.__validators__andModel.__root_validators__from Pydantic V1. - __pydantic_generic_metadata__: A dictionary containing metadata about generic Pydantic models.
The
originandargsitems map to the [__origin__][genericalias.__origin__] and [__args__][genericalias.__args__] attributes of [generic aliases][types-genericalias], and theparameteritem maps to the__parameter__attribute of generic classes. - __pydantic_parent_namespace__: Parent namespace of the model, used for automatic rebuilding of models.
- __pydantic_post_init__: The name of the post-init method for the model, if defined.
- __pydantic_root_model__: Whether the model is a [
RootModel][pydantic.root_model.RootModel]. - __pydantic_serializer__: The
pydantic-coreSchemaSerializerused to dump instances of the model. - __pydantic_validator__: The
pydantic-coreSchemaValidatorused to validate instances of the model. - __pydantic_fields__: A dictionary of field names and their corresponding [
FieldInfo][pydantic.fields.FieldInfo] objects. - __pydantic_computed_fields__: A dictionary of computed field names and their corresponding [
ComputedFieldInfo][pydantic.fields.ComputedFieldInfo] objects. - __pydantic_extra__: A dictionary containing extra values, if [
extra][pydantic.config.ConfigDict.extra] is set to'allow'. - __pydantic_fields_set__: The names of fields explicitly set during instantiation.
- __pydantic_private__: Values of private attributes set on the model instance.
Array of action strings the principal is permitted to perform, e.g. ["read", "write"]. Must contain at least one entry.
The identifier of the principal. A string ID for "user", "team", "org", and "agent" types; one of "admin", "member", or "viewer" for "org_role"; omit entirely when principal_type is "everyone".
150class CustomObjectReplaceResponseDataAclGrantsItem(BaseModel): 151 actions: list[str] = Field( 152 ..., 153 description='Array of action strings the principal is permitted to perform, e.g. `["read", "write"]`. Must contain at least one entry.', 154 ) 155 principal: str | None = Field( 156 default=None, 157 description='The identifier of the principal. A string ID for `"user"`, `"team"`, `"org"`, and `"agent"` types; one of `"admin"`, `"member"`, or `"viewer"` for `"org_role"`; omit entirely when `principal_type` is `"everyone"`.', 158 ) 159 principal_type: str = Field( 160 ..., 161 description='The kind of principal receiving the grant. One of `"user"`, `"team"`, `"org"`, `"org_role"`, `"agent"`, or `"everyone"`.', 162 )
!!! abstract "Usage Documentation" Models
A base class for creating Pydantic models.
Attributes:
- __class_vars__: The names of the class variables defined on the model.
- __private_attributes__: Metadata about the private attributes of the model.
- __signature__: The synthesized
__init__[Signature][inspect.Signature] of the model. - __pydantic_complete__: Whether model building is completed, or if there are still undefined fields.
- __pydantic_core_schema__: The core schema of the model.
- __pydantic_custom_init__: Whether the model has a custom
__init__function. - __pydantic_decorators__: Metadata containing the decorators defined on the model.
This replaces
Model.__validators__andModel.__root_validators__from Pydantic V1. - __pydantic_generic_metadata__: A dictionary containing metadata about generic Pydantic models.
The
originandargsitems map to the [__origin__][genericalias.__origin__] and [__args__][genericalias.__args__] attributes of [generic aliases][types-genericalias], and theparameteritem maps to the__parameter__attribute of generic classes. - __pydantic_parent_namespace__: Parent namespace of the model, used for automatic rebuilding of models.
- __pydantic_post_init__: The name of the post-init method for the model, if defined.
- __pydantic_root_model__: Whether the model is a [
RootModel][pydantic.root_model.RootModel]. - __pydantic_serializer__: The
pydantic-coreSchemaSerializerused to dump instances of the model. - __pydantic_validator__: The
pydantic-coreSchemaValidatorused to validate instances of the model. - __pydantic_fields__: A dictionary of field names and their corresponding [
FieldInfo][pydantic.fields.FieldInfo] objects. - __pydantic_computed_fields__: A dictionary of computed field names and their corresponding [
ComputedFieldInfo][pydantic.fields.ComputedFieldInfo] objects. - __pydantic_extra__: A dictionary containing extra values, if [
extra][pydantic.config.ConfigDict.extra] is set to'allow'. - __pydantic_fields_set__: The names of fields explicitly set during instantiation.
- __pydantic_private__: Values of private attributes set on the model instance.
Array of action strings the principal is permitted to perform, e.g. ["read", "write"]. Must contain at least one entry.
The identifier of the principal. A string ID for "user", "team", "org", and "agent" types; one of "admin", "member", or "viewer" for "org_role"; omit entirely when principal_type is "everyone".
165class CustomObjectReplaceResponseDataAclRemoveItem(BaseModel): 166 principal: str | None = Field( 167 default=None, 168 description='The identifier of the principal to remove. A string ID for `"user"`, `"team"`, `"org"`, and `"agent"` types; one of `"admin"`, `"member"`, or `"viewer"` for `"org_role"`. Omit when `principal_type` is `"everyone"`.', 169 ) 170 principal_type: str = Field( 171 ..., 172 description='The kind of principal to remove. One of `"user"`, `"team"`, `"org"`, `"org_role"`, `"agent"`, or `"everyone"`.', 173 )
!!! abstract "Usage Documentation" Models
A base class for creating Pydantic models.
Attributes:
- __class_vars__: The names of the class variables defined on the model.
- __private_attributes__: Metadata about the private attributes of the model.
- __signature__: The synthesized
__init__[Signature][inspect.Signature] of the model. - __pydantic_complete__: Whether model building is completed, or if there are still undefined fields.
- __pydantic_core_schema__: The core schema of the model.
- __pydantic_custom_init__: Whether the model has a custom
__init__function. - __pydantic_decorators__: Metadata containing the decorators defined on the model.
This replaces
Model.__validators__andModel.__root_validators__from Pydantic V1. - __pydantic_generic_metadata__: A dictionary containing metadata about generic Pydantic models.
The
originandargsitems map to the [__origin__][genericalias.__origin__] and [__args__][genericalias.__args__] attributes of [generic aliases][types-genericalias], and theparameteritem maps to the__parameter__attribute of generic classes. - __pydantic_parent_namespace__: Parent namespace of the model, used for automatic rebuilding of models.
- __pydantic_post_init__: The name of the post-init method for the model, if defined.
- __pydantic_root_model__: Whether the model is a [
RootModel][pydantic.root_model.RootModel]. - __pydantic_serializer__: The
pydantic-coreSchemaSerializerused to dump instances of the model. - __pydantic_validator__: The
pydantic-coreSchemaValidatorused to validate instances of the model. - __pydantic_fields__: A dictionary of field names and their corresponding [
FieldInfo][pydantic.fields.FieldInfo] objects. - __pydantic_computed_fields__: A dictionary of computed field names and their corresponding [
ComputedFieldInfo][pydantic.fields.ComputedFieldInfo] objects. - __pydantic_extra__: A dictionary containing extra values, if [
extra][pydantic.config.ConfigDict.extra] is set to'allow'. - __pydantic_fields_set__: The names of fields explicitly set during instantiation.
- __pydantic_private__: Values of private attributes set on the model instance.
The identifier of the principal to remove. A string ID for "user", "team", "org", and "agent" types; one of "admin", "member", or "viewer" for "org_role". Omit when principal_type is "everyone".
176class CustomObjectReplaceResponseDataAcl(BaseModel): 177 add: list[CustomObjectReplaceResponseDataAclAddItem] | None = Field( 178 default=None, 179 description="Patch mode: grants to add or merge into the existing list. Cannot be combined with `grants`.", 180 ) 181 grants: list[CustomObjectReplaceResponseDataAclGrantsItem] | None = Field( 182 default=None, 183 description="Replace mode: the complete new list of grants that replaces all existing entries. Send an empty array (`[]`) to clear all grants. Cannot be combined with `add` or `remove`.", 184 ) 185 remove: list[CustomObjectReplaceResponseDataAclRemoveItem] | None = Field( 186 default=None, 187 description="Patch mode: principals whose grants should be removed from the existing list. Cannot be combined with `grants`.", 188 )
!!! abstract "Usage Documentation" Models
A base class for creating Pydantic models.
Attributes:
- __class_vars__: The names of the class variables defined on the model.
- __private_attributes__: Metadata about the private attributes of the model.
- __signature__: The synthesized
__init__[Signature][inspect.Signature] of the model. - __pydantic_complete__: Whether model building is completed, or if there are still undefined fields.
- __pydantic_core_schema__: The core schema of the model.
- __pydantic_custom_init__: Whether the model has a custom
__init__function. - __pydantic_decorators__: Metadata containing the decorators defined on the model.
This replaces
Model.__validators__andModel.__root_validators__from Pydantic V1. - __pydantic_generic_metadata__: A dictionary containing metadata about generic Pydantic models.
The
originandargsitems map to the [__origin__][genericalias.__origin__] and [__args__][genericalias.__args__] attributes of [generic aliases][types-genericalias], and theparameteritem maps to the__parameter__attribute of generic classes. - __pydantic_parent_namespace__: Parent namespace of the model, used for automatic rebuilding of models.
- __pydantic_post_init__: The name of the post-init method for the model, if defined.
- __pydantic_root_model__: Whether the model is a [
RootModel][pydantic.root_model.RootModel]. - __pydantic_serializer__: The
pydantic-coreSchemaSerializerused to dump instances of the model. - __pydantic_validator__: The
pydantic-coreSchemaValidatorused to validate instances of the model. - __pydantic_fields__: A dictionary of field names and their corresponding [
FieldInfo][pydantic.fields.FieldInfo] objects. - __pydantic_computed_fields__: A dictionary of computed field names and their corresponding [
ComputedFieldInfo][pydantic.fields.ComputedFieldInfo] objects. - __pydantic_extra__: A dictionary containing extra values, if [
extra][pydantic.config.ConfigDict.extra] is set to'allow'. - __pydantic_fields_set__: The names of fields explicitly set during instantiation.
- __pydantic_private__: Values of private attributes set on the model instance.
Patch mode: grants to add or merge into the existing list. Cannot be combined with grants.
Patch mode: principals whose grants should be removed from the existing list. Cannot be combined with grants.
191class CustomObjectReplaceResponseData(BaseModel): 192 acl: CustomObjectReplaceResponseDataAcl | None = Field( 193 default=None, 194 description="Access control list governing read and write access to this custom object. Only returned to resource owners and privileged or organization-admin viewers; `null` for everyone else.", 195 ) 196 created_at: datetime | None = Field( 197 default=None, description="When the custom object was created (ISO 8601)." 198 ) 199 fields: dict[str, Any] | None = Field( 200 default=None, 201 description="Map of field names to their current values as defined by the object's schema type.", 202 ) 203 id: str = Field(..., description="Unique identifier for the custom object (`cobj_...`).") 204 org: str | None = Field( 205 default=None, description="ID of the organization this object belongs to (`org_...`)." 206 ) 207 row_key: str | None = Field( 208 default=None, 209 description="An optional stable key used to identify this object by a caller-controlled string rather than its generated ID. `null` if not set.", 210 ) 211 sandbox: str | None = Field( 212 default=None, 213 description="ID of the sandbox environment this object is scoped to (`dsb_...`). `null` for production objects.", 214 ) 215 schema_type: str | None = Field( 216 default=None, 217 description="The lookup key of the schema type that defines this object's field structure. `null` if the schema type has not been set.", 218 ) 219 team: str | None = Field( 220 default=None, 221 description="ID of the team that owns this object (`tem_...`). `null` if the object is not team-scoped.", 222 ) 223 updated_at: datetime | None = Field( 224 default=None, 225 description="When the custom object was last modified (ISO 8601). `null` if the object has never been updated after creation.", 226 ) 227 user: str | None = Field( 228 default=None, 229 description="ID of the user that owns this object (`usr_...`). `null` if the object is not user-scoped.", 230 ) 231 version: int | None = Field( 232 default=None, 233 description="Optimistic concurrency version of the object. Increments with each successful update; pass this value in write operations to detect conflicting changes.", 234 )
!!! abstract "Usage Documentation" Models
A base class for creating Pydantic models.
Attributes:
- __class_vars__: The names of the class variables defined on the model.
- __private_attributes__: Metadata about the private attributes of the model.
- __signature__: The synthesized
__init__[Signature][inspect.Signature] of the model. - __pydantic_complete__: Whether model building is completed, or if there are still undefined fields.
- __pydantic_core_schema__: The core schema of the model.
- __pydantic_custom_init__: Whether the model has a custom
__init__function. - __pydantic_decorators__: Metadata containing the decorators defined on the model.
This replaces
Model.__validators__andModel.__root_validators__from Pydantic V1. - __pydantic_generic_metadata__: A dictionary containing metadata about generic Pydantic models.
The
originandargsitems map to the [__origin__][genericalias.__origin__] and [__args__][genericalias.__args__] attributes of [generic aliases][types-genericalias], and theparameteritem maps to the__parameter__attribute of generic classes. - __pydantic_parent_namespace__: Parent namespace of the model, used for automatic rebuilding of models.
- __pydantic_post_init__: The name of the post-init method for the model, if defined.
- __pydantic_root_model__: Whether the model is a [
RootModel][pydantic.root_model.RootModel]. - __pydantic_serializer__: The
pydantic-coreSchemaSerializerused to dump instances of the model. - __pydantic_validator__: The
pydantic-coreSchemaValidatorused to validate instances of the model. - __pydantic_fields__: A dictionary of field names and their corresponding [
FieldInfo][pydantic.fields.FieldInfo] objects. - __pydantic_computed_fields__: A dictionary of computed field names and their corresponding [
ComputedFieldInfo][pydantic.fields.ComputedFieldInfo] objects. - __pydantic_extra__: A dictionary containing extra values, if [
extra][pydantic.config.ConfigDict.extra] is set to'allow'. - __pydantic_fields_set__: The names of fields explicitly set during instantiation.
- __pydantic_private__: Values of private attributes set on the model instance.
Access control list governing read and write access to this custom object. Only returned to resource owners and privileged or organization-admin viewers; null for everyone else.
Map of field names to their current values as defined by the object's schema type.
An optional stable key used to identify this object by a caller-controlled string rather than its generated ID. null if not set.
ID of the sandbox environment this object is scoped to (dsb_...). null for production objects.
The lookup key of the schema type that defines this object's field structure. null if the schema type has not been set.
ID of the team that owns this object (tem_...). null if the object is not team-scoped.
When the custom object was last modified (ISO 8601). null if the object has never been updated after creation.
237class CustomObjectReplaceResponse(BaseModel): 238 """ 239 Successful response 240 """ 241 242 data: CustomObjectReplaceResponseData = Field( 243 ..., description="The custom object after the update has been applied." 244 ) 245 meta: dict[str, Any] | None = Field( 246 default=None, description="Version metadata for the updated object." 247 )
Successful response
250class AsyncCustomObjectResource: 251 def __init__(self, http: HttpClient): 252 self._http = http 253 254 async def list( 255 self, 256 *, 257 type: str | None = None, 258 schema_key: str | None = None, 259 row_key: str | None = None, 260 sort_key: builtins.list[str] | None = None, 261 team: builtins.list[str] | None = None, 262 user: builtins.list[str] | None = None, 263 agent: builtins.list[str] | None = None, 264 org: builtins.list[str] | None = None, 265 query: str | None = None, 266 search: str | None = None, 267 page: int | None = None, 268 page_size: int | None = None, 269 ) -> CustomObjectListResponse: 270 """ 271 List custom objects 272 Returns a paginated list of custom objects visible to the authenticated 273 viewer, ordered by creation time descending. Results span all ownership 274 types (team-owned, user-owned, agent-owned, and system-owned) that the 275 viewer has access to. 276 Filter by schema type with `type` (preferred) or the legacy alias 277 `schema_key`. Use the `row_key` param to perform an exact-match partition 278 lookup. You may additionally supply `sort_key` to narrow within that 279 partition `sort_key` requires `row_key` and the request returns 400 if 280 `sort_key` is provided alone. Owner filters (`team`, `user`, `agent`, 281 `org`) are additive: each accepts an array of IDs (or a single ID, which 282 is wrapped) and returns objects matching any of the supplied values. 283 When `query` is supplied, results are ranked by full-text relevance 284 (descending `ts_rank`) rather than creation time. The legacy `search` 285 param performs a case-insensitive substring match and is retained for 286 developer-namespace clients. 287 288 Args: 289 type: Schema type identifier (`lookup_key`) to filter by. Only objects of this type are returned. Alias of `schema_key`; either name is accepted. 290 schema_key: Legacy alias for `type`. Prefer `type` on new clients. When both are supplied, `type` wins. 291 row_key: Exact `row_key` value to match. When supplied, only objects with this partition key are returned. 292 sort_key: One or more `sort_key` values to match within the `row_key` partition. Requires `row_key` to be set. 293 team: One or more team IDs (`team_...`) to filter by owning team. Returns objects owned by any of the supplied teams. 294 user: One or more user IDs (`user_...`) to filter by owning user. Returns objects owned by any of the supplied users. 295 agent: One or more agent IDs to filter by owning agent. Returns objects owned by any of the supplied agents. 296 org: One or more organization IDs (`org_...`) to filter by. Typically used by admins to query system-owned objects in a specific org. 297 query: Full-text search string matched against the schema's configured search fields. When supplied, results are ordered by relevance score descending instead of creation time descending. 298 search: Case-insensitive substring search applied across the schema type and serialized field values. Deprecated prefer `query` for full-text search. Retained for developer-namespace clients. 299 page: Page number to retrieve (1-indexed). Defaults to `1`. 300 page_size: Number of objects per page. Defaults to `25`; maximum is `100`. 301 302 Returns: 303 Paginated list of custom objects matching the supplied filters. 304 """ 305 query: dict[str, object] = {} 306 if type is not None: 307 query["type"] = type 308 if schema_key is not None: 309 query["schema_key"] = schema_key 310 if row_key is not None: 311 query["row_key"] = row_key 312 if sort_key is not None: 313 query["sort_key"] = sort_key 314 if team is not None: 315 query["team"] = team 316 if user is not None: 317 query["user"] = user 318 if agent is not None: 319 query["agent"] = agent 320 if org is not None: 321 query["org"] = org 322 if query is not None: 323 query["query"] = query 324 if search is not None: 325 query["search"] = search 326 if page is not None: 327 query["page"] = page 328 if page_size is not None: 329 query["page_size"] = page_size 330 return await self._http.request( 331 "/api/v1/custom_objects", 332 query=query, 333 response_type=CustomObjectListResponse, 334 ) 335 336 async def create(self, input: CustomObjectCreateInput) -> CustomObject: 337 """ 338 Create a custom object 339 Creates a new custom object of the given schema type and returns the 340 persisted object. The caller must be authenticated and authorized to create 341 objects of the specified type. 342 Identify the schema with `type` (preferred), or the legacy aliases 343 `schema_key` (lookup key) / `config` (config ID). Exactly one identifier is 344 required; when more than one is supplied, `type` wins over `schema_key`, 345 which wins over `config`. 346 Owner resolution follows a priority order: if `team` is supplied the object 347 is team-owned; if `user` is supplied it is owned by that user; if `agent` is 348 supplied it is agent-owned; otherwise the object is owned by the authenticated 349 user. Pass `system: true` explicitly to force system ownership this requires 350 elevated API credentials and returns 403 if the caller lacks permission. 351 If the schema declares a `row_key` (and optionally a `sort_key`), you may 352 pass `upsert: true` to update an existing object at that key instead of 353 receiving a 409 Conflict. The response status is `200` on an update and 354 `201` on a new create. 355 356 Args: 357 input: Request body. 358 input.acl: Access control list for the custom object. Supports explicit `read` and `write` grants to users, teams, organizations, organization roles, agents, or everyone. 359 input.agent: Agent user ID to set as the object owner. Used when neither `team` nor `user` is supplied. 360 input.config: Config ID (`cfg_...`) that resolves to the target schema. Provide one of `type`, `schema_key`, or `config`. 361 input.fields: Key-value map of field values for the new object. Must conform to the schema's field definitions. Omit to create an object with all fields at their default or null values. 362 input.org: Organization ID (`org_...`) to associate with the object. Typically required for system-owned objects. 363 input.schema_key: Legacy alias for `type` (schema `lookup_key`). Prefer `type` on new clients. Provide one of `type`, `schema_key`, or `config`. 364 input.system: When `true`, creates a system-owned object with no team, user, or agent owner. Requires elevated API credentials; returns 403 if the caller lacks permission. 365 input.team: Team ID (`team_...`) to set as the object owner. When supplied, takes priority over `user` and `agent`. 366 input.type: Schema type identifier (`lookup_key`) that defines the object's shape and validation rules. Preferred over the legacy `schema_key` / `config` aliases. 367 input.upsert: When `true` and the schema declares a `row_key`, updates the existing object at that key for the same owner instead of returning 409 Conflict. Returns HTTP 200 on update and 201 on create. 368 input.user: User ID (`user_...`) to set as the object owner. Used when neither `team` nor a higher-priority owner is set. 369 370 Returns: 371 The created (or upserted) custom object. 372 """ 373 return await self._http.request( 374 "/api/v1/custom_objects", 375 method="POST", 376 body=input, 377 response_type=CustomObject, 378 ) 379 380 async def delete(self, object: str) -> CustomObjectDeleteResponse: 381 """ 382 Delete a custom object 383 Permanently deletes the custom object identified by `object`. The caller 384 must be authenticated and have permission to delete the object. 385 On success, returns a confirmation payload containing the deleted object's 386 ID so callers can confirm the deletion without a follow-up fetch. 387 Attempting to delete an object that does not exist or has already been 388 deleted returns 404. 389 390 Args: 391 object: Custom object ID (`cobj_...`) of the object to delete. 392 393 Returns: 394 Successful response 395 """ 396 return await self._http.request( 397 f"/api/v1/custom_objects/{object}", 398 method="DELETE", 399 response_type=CustomObjectDeleteResponse, 400 ) 401 402 async def get(self, object: str, *, type: str | None = None) -> CustomObject: 403 """ 404 Retrieve a custom object 405 Returns a single custom object identified by its ID. The authenticated viewer 406 must have visibility access to the object. 407 Returns 404 if the object does not exist, has been deleted, or is not 408 visible to the viewer. 409 410 Args: 411 object: Custom object ID (`cobj_...`) to retrieve. 412 type: Schema type identifier (`lookup_key`) of the object. Optional; used for routing context only. 413 414 Returns: 415 The requested custom object. 416 """ 417 query: dict[str, object] = {} 418 if type is not None: 419 query["type"] = type 420 return await self._http.request( 421 f"/api/v1/custom_objects/{object}", 422 query=query, 423 response_type=CustomObject, 424 ) 425 426 async def replace( 427 self, object: str, input: CustomObjectReplaceInput 428 ) -> CustomObjectReplaceResponse: 429 """ 430 Update a custom object 431 Updates the fields of an existing custom object and returns the updated 432 object along with its new version number. The authenticated viewer must have 433 permission to modify the object. 434 You may supply `fields` (a full or partial key-value map to merge into the 435 object), `field_ops` (granular array operations per field), `acl`, or any 436 compatible combination. The same field name must not appear in both 437 `fields` and `field_ops`, which returns 422. Returns 404 if the object does 438 not exist or has been deleted. 439 440 Args: 441 object: Custom object ID (`cobj_...`) to update. 442 input: Request body. 443 input.acl: Updated access control list. Supports full replacement via `grants` or targeted `add`/`remove` operations. 444 input.field_ops: Granular array operations to apply per field (e.g. append, prepend, remove). A field must not appear in both `fields` and `field_ops`. 445 input.fields: Key-value map of field values to merge into the object. Only the supplied keys are affected. 446 input.type: Schema type identifier (`lookup_key`) of the object. Optional; used for routing context only. 447 448 Returns: 449 Successful response 450 """ 451 return await self._http.request( 452 f"/api/v1/custom_objects/{object}", 453 method="PUT", 454 body=input, 455 response_type=CustomObjectReplaceResponse, 456 )
254 async def list( 255 self, 256 *, 257 type: str | None = None, 258 schema_key: str | None = None, 259 row_key: str | None = None, 260 sort_key: builtins.list[str] | None = None, 261 team: builtins.list[str] | None = None, 262 user: builtins.list[str] | None = None, 263 agent: builtins.list[str] | None = None, 264 org: builtins.list[str] | None = None, 265 query: str | None = None, 266 search: str | None = None, 267 page: int | None = None, 268 page_size: int | None = None, 269 ) -> CustomObjectListResponse: 270 """ 271 List custom objects 272 Returns a paginated list of custom objects visible to the authenticated 273 viewer, ordered by creation time descending. Results span all ownership 274 types (team-owned, user-owned, agent-owned, and system-owned) that the 275 viewer has access to. 276 Filter by schema type with `type` (preferred) or the legacy alias 277 `schema_key`. Use the `row_key` param to perform an exact-match partition 278 lookup. You may additionally supply `sort_key` to narrow within that 279 partition `sort_key` requires `row_key` and the request returns 400 if 280 `sort_key` is provided alone. Owner filters (`team`, `user`, `agent`, 281 `org`) are additive: each accepts an array of IDs (or a single ID, which 282 is wrapped) and returns objects matching any of the supplied values. 283 When `query` is supplied, results are ranked by full-text relevance 284 (descending `ts_rank`) rather than creation time. The legacy `search` 285 param performs a case-insensitive substring match and is retained for 286 developer-namespace clients. 287 288 Args: 289 type: Schema type identifier (`lookup_key`) to filter by. Only objects of this type are returned. Alias of `schema_key`; either name is accepted. 290 schema_key: Legacy alias for `type`. Prefer `type` on new clients. When both are supplied, `type` wins. 291 row_key: Exact `row_key` value to match. When supplied, only objects with this partition key are returned. 292 sort_key: One or more `sort_key` values to match within the `row_key` partition. Requires `row_key` to be set. 293 team: One or more team IDs (`team_...`) to filter by owning team. Returns objects owned by any of the supplied teams. 294 user: One or more user IDs (`user_...`) to filter by owning user. Returns objects owned by any of the supplied users. 295 agent: One or more agent IDs to filter by owning agent. Returns objects owned by any of the supplied agents. 296 org: One or more organization IDs (`org_...`) to filter by. Typically used by admins to query system-owned objects in a specific org. 297 query: Full-text search string matched against the schema's configured search fields. When supplied, results are ordered by relevance score descending instead of creation time descending. 298 search: Case-insensitive substring search applied across the schema type and serialized field values. Deprecated prefer `query` for full-text search. Retained for developer-namespace clients. 299 page: Page number to retrieve (1-indexed). Defaults to `1`. 300 page_size: Number of objects per page. Defaults to `25`; maximum is `100`. 301 302 Returns: 303 Paginated list of custom objects matching the supplied filters. 304 """ 305 query: dict[str, object] = {} 306 if type is not None: 307 query["type"] = type 308 if schema_key is not None: 309 query["schema_key"] = schema_key 310 if row_key is not None: 311 query["row_key"] = row_key 312 if sort_key is not None: 313 query["sort_key"] = sort_key 314 if team is not None: 315 query["team"] = team 316 if user is not None: 317 query["user"] = user 318 if agent is not None: 319 query["agent"] = agent 320 if org is not None: 321 query["org"] = org 322 if query is not None: 323 query["query"] = query 324 if search is not None: 325 query["search"] = search 326 if page is not None: 327 query["page"] = page 328 if page_size is not None: 329 query["page_size"] = page_size 330 return await self._http.request( 331 "/api/v1/custom_objects", 332 query=query, 333 response_type=CustomObjectListResponse, 334 )
List custom objects
Returns a paginated list of custom objects visible to the authenticated
viewer, ordered by creation time descending. Results span all ownership
types (team-owned, user-owned, agent-owned, and system-owned) that the
viewer has access to.
Filter by schema type with type (preferred) or the legacy alias
schema_key. Use the row_key param to perform an exact-match partition
lookup. You may additionally supply sort_key to narrow within that
partition sort_key requires row_key and the request returns 400 if
sort_key is provided alone. Owner filters (team, user, agent,
org) are additive: each accepts an array of IDs (or a single ID, which
is wrapped) and returns objects matching any of the supplied values.
When query is supplied, results are ranked by full-text relevance
(descending ts_rank) rather than creation time. The legacy search
param performs a case-insensitive substring match and is retained for
developer-namespace clients.
Arguments:
- type: Schema type identifier (
lookup_key) to filter by. Only objects of this type are returned. Alias ofschema_key; either name is accepted. - schema_key: Legacy alias for
type. Prefertypeon new clients. When both are supplied,typewins. - row_key: Exact
row_keyvalue to match. When supplied, only objects with this partition key are returned. - sort_key: One or more
sort_keyvalues to match within therow_keypartition. Requiresrow_keyto be set. - team: One or more team IDs (
team_...) to filter by owning team. Returns objects owned by any of the supplied teams. - user: One or more user IDs (
user_...) to filter by owning user. Returns objects owned by any of the supplied users. - agent: One or more agent IDs to filter by owning agent. Returns objects owned by any of the supplied agents.
- org: One or more organization IDs (
org_...) to filter by. Typically used by admins to query system-owned objects in a specific org. - query: Full-text search string matched against the schema's configured search fields. When supplied, results are ordered by relevance score descending instead of creation time descending.
- search: Case-insensitive substring search applied across the schema type and serialized field values. Deprecated prefer
queryfor full-text search. Retained for developer-namespace clients. - page: Page number to retrieve (1-indexed). Defaults to
1. - page_size: Number of objects per page. Defaults to
25; maximum is100.
Returns:
Paginated list of custom objects matching the supplied filters.
336 async def create(self, input: CustomObjectCreateInput) -> CustomObject: 337 """ 338 Create a custom object 339 Creates a new custom object of the given schema type and returns the 340 persisted object. The caller must be authenticated and authorized to create 341 objects of the specified type. 342 Identify the schema with `type` (preferred), or the legacy aliases 343 `schema_key` (lookup key) / `config` (config ID). Exactly one identifier is 344 required; when more than one is supplied, `type` wins over `schema_key`, 345 which wins over `config`. 346 Owner resolution follows a priority order: if `team` is supplied the object 347 is team-owned; if `user` is supplied it is owned by that user; if `agent` is 348 supplied it is agent-owned; otherwise the object is owned by the authenticated 349 user. Pass `system: true` explicitly to force system ownership this requires 350 elevated API credentials and returns 403 if the caller lacks permission. 351 If the schema declares a `row_key` (and optionally a `sort_key`), you may 352 pass `upsert: true` to update an existing object at that key instead of 353 receiving a 409 Conflict. The response status is `200` on an update and 354 `201` on a new create. 355 356 Args: 357 input: Request body. 358 input.acl: Access control list for the custom object. Supports explicit `read` and `write` grants to users, teams, organizations, organization roles, agents, or everyone. 359 input.agent: Agent user ID to set as the object owner. Used when neither `team` nor `user` is supplied. 360 input.config: Config ID (`cfg_...`) that resolves to the target schema. Provide one of `type`, `schema_key`, or `config`. 361 input.fields: Key-value map of field values for the new object. Must conform to the schema's field definitions. Omit to create an object with all fields at their default or null values. 362 input.org: Organization ID (`org_...`) to associate with the object. Typically required for system-owned objects. 363 input.schema_key: Legacy alias for `type` (schema `lookup_key`). Prefer `type` on new clients. Provide one of `type`, `schema_key`, or `config`. 364 input.system: When `true`, creates a system-owned object with no team, user, or agent owner. Requires elevated API credentials; returns 403 if the caller lacks permission. 365 input.team: Team ID (`team_...`) to set as the object owner. When supplied, takes priority over `user` and `agent`. 366 input.type: Schema type identifier (`lookup_key`) that defines the object's shape and validation rules. Preferred over the legacy `schema_key` / `config` aliases. 367 input.upsert: When `true` and the schema declares a `row_key`, updates the existing object at that key for the same owner instead of returning 409 Conflict. Returns HTTP 200 on update and 201 on create. 368 input.user: User ID (`user_...`) to set as the object owner. Used when neither `team` nor a higher-priority owner is set. 369 370 Returns: 371 The created (or upserted) custom object. 372 """ 373 return await self._http.request( 374 "/api/v1/custom_objects", 375 method="POST", 376 body=input, 377 response_type=CustomObject, 378 )
Create a custom object
Creates a new custom object of the given schema type and returns the
persisted object. The caller must be authenticated and authorized to create
objects of the specified type.
Identify the schema with type (preferred), or the legacy aliases
schema_key (lookup key) / config (config ID). Exactly one identifier is
required; when more than one is supplied, type wins over schema_key,
which wins over config.
Owner resolution follows a priority order: if team is supplied the object
is team-owned; if user is supplied it is owned by that user; if agent is
supplied it is agent-owned; otherwise the object is owned by the authenticated
user. Pass system: true explicitly to force system ownership this requires
elevated API credentials and returns 403 if the caller lacks permission.
If the schema declares a row_key (and optionally a sort_key), you may
pass upsert: true to update an existing object at that key instead of
receiving a 409 Conflict. The response status is 200 on an update and
201 on a new create.
Arguments:
- input: Request body.
- input.acl: Access control list for the custom object. Supports explicit
readandwritegrants to users, teams, organizations, organization roles, agents, or everyone. - input.agent: Agent user ID to set as the object owner. Used when neither
teamnoruseris supplied. - input.config: Config ID (
cfg_...) that resolves to the target schema. Provide one oftype,schema_key, orconfig. - input.fields: Key-value map of field values for the new object. Must conform to the schema's field definitions. Omit to create an object with all fields at their default or null values.
- input.org: Organization ID (
org_...) to associate with the object. Typically required for system-owned objects. - input.schema_key: Legacy alias for
type(schemalookup_key). Prefertypeon new clients. Provide one oftype,schema_key, orconfig. - input.system: When
true, creates a system-owned object with no team, user, or agent owner. Requires elevated API credentials; returns 403 if the caller lacks permission. - input.team: Team ID (
team_...) to set as the object owner. When supplied, takes priority overuserandagent. - input.type: Schema type identifier (
lookup_key) that defines the object's shape and validation rules. Preferred over the legacyschema_key/configaliases. - input.upsert: When
trueand the schema declares arow_key, updates the existing object at that key for the same owner instead of returning 409 Conflict. Returns HTTP 200 on update and 201 on create. - input.user: User ID (
user_...) to set as the object owner. Used when neitherteamnor a higher-priority owner is set.
Returns:
The created (or upserted) custom object.
380 async def delete(self, object: str) -> CustomObjectDeleteResponse: 381 """ 382 Delete a custom object 383 Permanently deletes the custom object identified by `object`. The caller 384 must be authenticated and have permission to delete the object. 385 On success, returns a confirmation payload containing the deleted object's 386 ID so callers can confirm the deletion without a follow-up fetch. 387 Attempting to delete an object that does not exist or has already been 388 deleted returns 404. 389 390 Args: 391 object: Custom object ID (`cobj_...`) of the object to delete. 392 393 Returns: 394 Successful response 395 """ 396 return await self._http.request( 397 f"/api/v1/custom_objects/{object}", 398 method="DELETE", 399 response_type=CustomObjectDeleteResponse, 400 )
Delete a custom object
Permanently deletes the custom object identified by object. The caller
must be authenticated and have permission to delete the object.
On success, returns a confirmation payload containing the deleted object's
ID so callers can confirm the deletion without a follow-up fetch.
Attempting to delete an object that does not exist or has already been
deleted returns 404.
Arguments:
- object: Custom object ID (
cobj_...) of the object to delete.
Returns:
Successful response
402 async def get(self, object: str, *, type: str | None = None) -> CustomObject: 403 """ 404 Retrieve a custom object 405 Returns a single custom object identified by its ID. The authenticated viewer 406 must have visibility access to the object. 407 Returns 404 if the object does not exist, has been deleted, or is not 408 visible to the viewer. 409 410 Args: 411 object: Custom object ID (`cobj_...`) to retrieve. 412 type: Schema type identifier (`lookup_key`) of the object. Optional; used for routing context only. 413 414 Returns: 415 The requested custom object. 416 """ 417 query: dict[str, object] = {} 418 if type is not None: 419 query["type"] = type 420 return await self._http.request( 421 f"/api/v1/custom_objects/{object}", 422 query=query, 423 response_type=CustomObject, 424 )
Retrieve a custom object Returns a single custom object identified by its ID. The authenticated viewer must have visibility access to the object. Returns 404 if the object does not exist, has been deleted, or is not visible to the viewer.
Arguments:
- object: Custom object ID (
cobj_...) to retrieve. - type: Schema type identifier (
lookup_key) of the object. Optional; used for routing context only.
Returns:
The requested custom object.
426 async def replace( 427 self, object: str, input: CustomObjectReplaceInput 428 ) -> CustomObjectReplaceResponse: 429 """ 430 Update a custom object 431 Updates the fields of an existing custom object and returns the updated 432 object along with its new version number. The authenticated viewer must have 433 permission to modify the object. 434 You may supply `fields` (a full or partial key-value map to merge into the 435 object), `field_ops` (granular array operations per field), `acl`, or any 436 compatible combination. The same field name must not appear in both 437 `fields` and `field_ops`, which returns 422. Returns 404 if the object does 438 not exist or has been deleted. 439 440 Args: 441 object: Custom object ID (`cobj_...`) to update. 442 input: Request body. 443 input.acl: Updated access control list. Supports full replacement via `grants` or targeted `add`/`remove` operations. 444 input.field_ops: Granular array operations to apply per field (e.g. append, prepend, remove). A field must not appear in both `fields` and `field_ops`. 445 input.fields: Key-value map of field values to merge into the object. Only the supplied keys are affected. 446 input.type: Schema type identifier (`lookup_key`) of the object. Optional; used for routing context only. 447 448 Returns: 449 Successful response 450 """ 451 return await self._http.request( 452 f"/api/v1/custom_objects/{object}", 453 method="PUT", 454 body=input, 455 response_type=CustomObjectReplaceResponse, 456 )
Update a custom object
Updates the fields of an existing custom object and returns the updated
object along with its new version number. The authenticated viewer must have
permission to modify the object.
You may supply fields (a full or partial key-value map to merge into the
object), field_ops (granular array operations per field), acl, or any
compatible combination. The same field name must not appear in both
fields and field_ops, which returns 422. Returns 404 if the object does
not exist or has been deleted.
Arguments:
- object: Custom object ID (
cobj_...) to update. - input: Request body.
- input.acl: Updated access control list. Supports full replacement via
grantsor targetedadd/removeoperations. - input.field_ops: Granular array operations to apply per field (e.g. append, prepend, remove). A field must not appear in both
fieldsandfield_ops. - input.fields: Key-value map of field values to merge into the object. Only the supplied keys are affected.
- input.type: Schema type identifier (
lookup_key) of the object. Optional; used for routing context only.
Returns:
Successful response
459class CustomObjectResource: 460 def __init__(self, http: SyncHttpClient): 461 self._http = http 462 463 def list( 464 self, 465 *, 466 type: str | None = None, 467 schema_key: str | None = None, 468 row_key: str | None = None, 469 sort_key: builtins.list[str] | None = None, 470 team: builtins.list[str] | None = None, 471 user: builtins.list[str] | None = None, 472 agent: builtins.list[str] | None = None, 473 org: builtins.list[str] | None = None, 474 query: str | None = None, 475 search: str | None = None, 476 page: int | None = None, 477 page_size: int | None = None, 478 ) -> CustomObjectListResponse: 479 """ 480 List custom objects 481 Returns a paginated list of custom objects visible to the authenticated 482 viewer, ordered by creation time descending. Results span all ownership 483 types (team-owned, user-owned, agent-owned, and system-owned) that the 484 viewer has access to. 485 Filter by schema type with `type` (preferred) or the legacy alias 486 `schema_key`. Use the `row_key` param to perform an exact-match partition 487 lookup. You may additionally supply `sort_key` to narrow within that 488 partition `sort_key` requires `row_key` and the request returns 400 if 489 `sort_key` is provided alone. Owner filters (`team`, `user`, `agent`, 490 `org`) are additive: each accepts an array of IDs (or a single ID, which 491 is wrapped) and returns objects matching any of the supplied values. 492 When `query` is supplied, results are ranked by full-text relevance 493 (descending `ts_rank`) rather than creation time. The legacy `search` 494 param performs a case-insensitive substring match and is retained for 495 developer-namespace clients. 496 497 Args: 498 type: Schema type identifier (`lookup_key`) to filter by. Only objects of this type are returned. Alias of `schema_key`; either name is accepted. 499 schema_key: Legacy alias for `type`. Prefer `type` on new clients. When both are supplied, `type` wins. 500 row_key: Exact `row_key` value to match. When supplied, only objects with this partition key are returned. 501 sort_key: One or more `sort_key` values to match within the `row_key` partition. Requires `row_key` to be set. 502 team: One or more team IDs (`team_...`) to filter by owning team. Returns objects owned by any of the supplied teams. 503 user: One or more user IDs (`user_...`) to filter by owning user. Returns objects owned by any of the supplied users. 504 agent: One or more agent IDs to filter by owning agent. Returns objects owned by any of the supplied agents. 505 org: One or more organization IDs (`org_...`) to filter by. Typically used by admins to query system-owned objects in a specific org. 506 query: Full-text search string matched against the schema's configured search fields. When supplied, results are ordered by relevance score descending instead of creation time descending. 507 search: Case-insensitive substring search applied across the schema type and serialized field values. Deprecated prefer `query` for full-text search. Retained for developer-namespace clients. 508 page: Page number to retrieve (1-indexed). Defaults to `1`. 509 page_size: Number of objects per page. Defaults to `25`; maximum is `100`. 510 511 Returns: 512 Paginated list of custom objects matching the supplied filters. 513 """ 514 query: dict[str, object] = {} 515 if type is not None: 516 query["type"] = type 517 if schema_key is not None: 518 query["schema_key"] = schema_key 519 if row_key is not None: 520 query["row_key"] = row_key 521 if sort_key is not None: 522 query["sort_key"] = sort_key 523 if team is not None: 524 query["team"] = team 525 if user is not None: 526 query["user"] = user 527 if agent is not None: 528 query["agent"] = agent 529 if org is not None: 530 query["org"] = org 531 if query is not None: 532 query["query"] = query 533 if search is not None: 534 query["search"] = search 535 if page is not None: 536 query["page"] = page 537 if page_size is not None: 538 query["page_size"] = page_size 539 return self._http.request( 540 "/api/v1/custom_objects", 541 query=query, 542 response_type=CustomObjectListResponse, 543 ) 544 545 def create(self, input: CustomObjectCreateInput) -> CustomObject: 546 """ 547 Create a custom object 548 Creates a new custom object of the given schema type and returns the 549 persisted object. The caller must be authenticated and authorized to create 550 objects of the specified type. 551 Identify the schema with `type` (preferred), or the legacy aliases 552 `schema_key` (lookup key) / `config` (config ID). Exactly one identifier is 553 required; when more than one is supplied, `type` wins over `schema_key`, 554 which wins over `config`. 555 Owner resolution follows a priority order: if `team` is supplied the object 556 is team-owned; if `user` is supplied it is owned by that user; if `agent` is 557 supplied it is agent-owned; otherwise the object is owned by the authenticated 558 user. Pass `system: true` explicitly to force system ownership this requires 559 elevated API credentials and returns 403 if the caller lacks permission. 560 If the schema declares a `row_key` (and optionally a `sort_key`), you may 561 pass `upsert: true` to update an existing object at that key instead of 562 receiving a 409 Conflict. The response status is `200` on an update and 563 `201` on a new create. 564 565 Args: 566 input: Request body. 567 input.acl: Access control list for the custom object. Supports explicit `read` and `write` grants to users, teams, organizations, organization roles, agents, or everyone. 568 input.agent: Agent user ID to set as the object owner. Used when neither `team` nor `user` is supplied. 569 input.config: Config ID (`cfg_...`) that resolves to the target schema. Provide one of `type`, `schema_key`, or `config`. 570 input.fields: Key-value map of field values for the new object. Must conform to the schema's field definitions. Omit to create an object with all fields at their default or null values. 571 input.org: Organization ID (`org_...`) to associate with the object. Typically required for system-owned objects. 572 input.schema_key: Legacy alias for `type` (schema `lookup_key`). Prefer `type` on new clients. Provide one of `type`, `schema_key`, or `config`. 573 input.system: When `true`, creates a system-owned object with no team, user, or agent owner. Requires elevated API credentials; returns 403 if the caller lacks permission. 574 input.team: Team ID (`team_...`) to set as the object owner. When supplied, takes priority over `user` and `agent`. 575 input.type: Schema type identifier (`lookup_key`) that defines the object's shape and validation rules. Preferred over the legacy `schema_key` / `config` aliases. 576 input.upsert: When `true` and the schema declares a `row_key`, updates the existing object at that key for the same owner instead of returning 409 Conflict. Returns HTTP 200 on update and 201 on create. 577 input.user: User ID (`user_...`) to set as the object owner. Used when neither `team` nor a higher-priority owner is set. 578 579 Returns: 580 The created (or upserted) custom object. 581 """ 582 return self._http.request( 583 "/api/v1/custom_objects", 584 method="POST", 585 body=input, 586 response_type=CustomObject, 587 ) 588 589 def delete(self, object: str) -> CustomObjectDeleteResponse: 590 """ 591 Delete a custom object 592 Permanently deletes the custom object identified by `object`. The caller 593 must be authenticated and have permission to delete the object. 594 On success, returns a confirmation payload containing the deleted object's 595 ID so callers can confirm the deletion without a follow-up fetch. 596 Attempting to delete an object that does not exist or has already been 597 deleted returns 404. 598 599 Args: 600 object: Custom object ID (`cobj_...`) of the object to delete. 601 602 Returns: 603 Successful response 604 """ 605 return self._http.request( 606 f"/api/v1/custom_objects/{object}", 607 method="DELETE", 608 response_type=CustomObjectDeleteResponse, 609 ) 610 611 def get(self, object: str, *, type: str | None = None) -> CustomObject: 612 """ 613 Retrieve a custom object 614 Returns a single custom object identified by its ID. The authenticated viewer 615 must have visibility access to the object. 616 Returns 404 if the object does not exist, has been deleted, or is not 617 visible to the viewer. 618 619 Args: 620 object: Custom object ID (`cobj_...`) to retrieve. 621 type: Schema type identifier (`lookup_key`) of the object. Optional; used for routing context only. 622 623 Returns: 624 The requested custom object. 625 """ 626 query: dict[str, object] = {} 627 if type is not None: 628 query["type"] = type 629 return self._http.request( 630 f"/api/v1/custom_objects/{object}", 631 query=query, 632 response_type=CustomObject, 633 ) 634 635 def replace(self, object: str, input: CustomObjectReplaceInput) -> CustomObjectReplaceResponse: 636 """ 637 Update a custom object 638 Updates the fields of an existing custom object and returns the updated 639 object along with its new version number. The authenticated viewer must have 640 permission to modify the object. 641 You may supply `fields` (a full or partial key-value map to merge into the 642 object), `field_ops` (granular array operations per field), `acl`, or any 643 compatible combination. The same field name must not appear in both 644 `fields` and `field_ops`, which returns 422. Returns 404 if the object does 645 not exist or has been deleted. 646 647 Args: 648 object: Custom object ID (`cobj_...`) to update. 649 input: Request body. 650 input.acl: Updated access control list. Supports full replacement via `grants` or targeted `add`/`remove` operations. 651 input.field_ops: Granular array operations to apply per field (e.g. append, prepend, remove). A field must not appear in both `fields` and `field_ops`. 652 input.fields: Key-value map of field values to merge into the object. Only the supplied keys are affected. 653 input.type: Schema type identifier (`lookup_key`) of the object. Optional; used for routing context only. 654 655 Returns: 656 Successful response 657 """ 658 return self._http.request( 659 f"/api/v1/custom_objects/{object}", 660 method="PUT", 661 body=input, 662 response_type=CustomObjectReplaceResponse, 663 )
463 def list( 464 self, 465 *, 466 type: str | None = None, 467 schema_key: str | None = None, 468 row_key: str | None = None, 469 sort_key: builtins.list[str] | None = None, 470 team: builtins.list[str] | None = None, 471 user: builtins.list[str] | None = None, 472 agent: builtins.list[str] | None = None, 473 org: builtins.list[str] | None = None, 474 query: str | None = None, 475 search: str | None = None, 476 page: int | None = None, 477 page_size: int | None = None, 478 ) -> CustomObjectListResponse: 479 """ 480 List custom objects 481 Returns a paginated list of custom objects visible to the authenticated 482 viewer, ordered by creation time descending. Results span all ownership 483 types (team-owned, user-owned, agent-owned, and system-owned) that the 484 viewer has access to. 485 Filter by schema type with `type` (preferred) or the legacy alias 486 `schema_key`. Use the `row_key` param to perform an exact-match partition 487 lookup. You may additionally supply `sort_key` to narrow within that 488 partition `sort_key` requires `row_key` and the request returns 400 if 489 `sort_key` is provided alone. Owner filters (`team`, `user`, `agent`, 490 `org`) are additive: each accepts an array of IDs (or a single ID, which 491 is wrapped) and returns objects matching any of the supplied values. 492 When `query` is supplied, results are ranked by full-text relevance 493 (descending `ts_rank`) rather than creation time. The legacy `search` 494 param performs a case-insensitive substring match and is retained for 495 developer-namespace clients. 496 497 Args: 498 type: Schema type identifier (`lookup_key`) to filter by. Only objects of this type are returned. Alias of `schema_key`; either name is accepted. 499 schema_key: Legacy alias for `type`. Prefer `type` on new clients. When both are supplied, `type` wins. 500 row_key: Exact `row_key` value to match. When supplied, only objects with this partition key are returned. 501 sort_key: One or more `sort_key` values to match within the `row_key` partition. Requires `row_key` to be set. 502 team: One or more team IDs (`team_...`) to filter by owning team. Returns objects owned by any of the supplied teams. 503 user: One or more user IDs (`user_...`) to filter by owning user. Returns objects owned by any of the supplied users. 504 agent: One or more agent IDs to filter by owning agent. Returns objects owned by any of the supplied agents. 505 org: One or more organization IDs (`org_...`) to filter by. Typically used by admins to query system-owned objects in a specific org. 506 query: Full-text search string matched against the schema's configured search fields. When supplied, results are ordered by relevance score descending instead of creation time descending. 507 search: Case-insensitive substring search applied across the schema type and serialized field values. Deprecated prefer `query` for full-text search. Retained for developer-namespace clients. 508 page: Page number to retrieve (1-indexed). Defaults to `1`. 509 page_size: Number of objects per page. Defaults to `25`; maximum is `100`. 510 511 Returns: 512 Paginated list of custom objects matching the supplied filters. 513 """ 514 query: dict[str, object] = {} 515 if type is not None: 516 query["type"] = type 517 if schema_key is not None: 518 query["schema_key"] = schema_key 519 if row_key is not None: 520 query["row_key"] = row_key 521 if sort_key is not None: 522 query["sort_key"] = sort_key 523 if team is not None: 524 query["team"] = team 525 if user is not None: 526 query["user"] = user 527 if agent is not None: 528 query["agent"] = agent 529 if org is not None: 530 query["org"] = org 531 if query is not None: 532 query["query"] = query 533 if search is not None: 534 query["search"] = search 535 if page is not None: 536 query["page"] = page 537 if page_size is not None: 538 query["page_size"] = page_size 539 return self._http.request( 540 "/api/v1/custom_objects", 541 query=query, 542 response_type=CustomObjectListResponse, 543 )
List custom objects
Returns a paginated list of custom objects visible to the authenticated
viewer, ordered by creation time descending. Results span all ownership
types (team-owned, user-owned, agent-owned, and system-owned) that the
viewer has access to.
Filter by schema type with type (preferred) or the legacy alias
schema_key. Use the row_key param to perform an exact-match partition
lookup. You may additionally supply sort_key to narrow within that
partition sort_key requires row_key and the request returns 400 if
sort_key is provided alone. Owner filters (team, user, agent,
org) are additive: each accepts an array of IDs (or a single ID, which
is wrapped) and returns objects matching any of the supplied values.
When query is supplied, results are ranked by full-text relevance
(descending ts_rank) rather than creation time. The legacy search
param performs a case-insensitive substring match and is retained for
developer-namespace clients.
Arguments:
- type: Schema type identifier (
lookup_key) to filter by. Only objects of this type are returned. Alias ofschema_key; either name is accepted. - schema_key: Legacy alias for
type. Prefertypeon new clients. When both are supplied,typewins. - row_key: Exact
row_keyvalue to match. When supplied, only objects with this partition key are returned. - sort_key: One or more
sort_keyvalues to match within therow_keypartition. Requiresrow_keyto be set. - team: One or more team IDs (
team_...) to filter by owning team. Returns objects owned by any of the supplied teams. - user: One or more user IDs (
user_...) to filter by owning user. Returns objects owned by any of the supplied users. - agent: One or more agent IDs to filter by owning agent. Returns objects owned by any of the supplied agents.
- org: One or more organization IDs (
org_...) to filter by. Typically used by admins to query system-owned objects in a specific org. - query: Full-text search string matched against the schema's configured search fields. When supplied, results are ordered by relevance score descending instead of creation time descending.
- search: Case-insensitive substring search applied across the schema type and serialized field values. Deprecated prefer
queryfor full-text search. Retained for developer-namespace clients. - page: Page number to retrieve (1-indexed). Defaults to
1. - page_size: Number of objects per page. Defaults to
25; maximum is100.
Returns:
Paginated list of custom objects matching the supplied filters.
545 def create(self, input: CustomObjectCreateInput) -> CustomObject: 546 """ 547 Create a custom object 548 Creates a new custom object of the given schema type and returns the 549 persisted object. The caller must be authenticated and authorized to create 550 objects of the specified type. 551 Identify the schema with `type` (preferred), or the legacy aliases 552 `schema_key` (lookup key) / `config` (config ID). Exactly one identifier is 553 required; when more than one is supplied, `type` wins over `schema_key`, 554 which wins over `config`. 555 Owner resolution follows a priority order: if `team` is supplied the object 556 is team-owned; if `user` is supplied it is owned by that user; if `agent` is 557 supplied it is agent-owned; otherwise the object is owned by the authenticated 558 user. Pass `system: true` explicitly to force system ownership this requires 559 elevated API credentials and returns 403 if the caller lacks permission. 560 If the schema declares a `row_key` (and optionally a `sort_key`), you may 561 pass `upsert: true` to update an existing object at that key instead of 562 receiving a 409 Conflict. The response status is `200` on an update and 563 `201` on a new create. 564 565 Args: 566 input: Request body. 567 input.acl: Access control list for the custom object. Supports explicit `read` and `write` grants to users, teams, organizations, organization roles, agents, or everyone. 568 input.agent: Agent user ID to set as the object owner. Used when neither `team` nor `user` is supplied. 569 input.config: Config ID (`cfg_...`) that resolves to the target schema. Provide one of `type`, `schema_key`, or `config`. 570 input.fields: Key-value map of field values for the new object. Must conform to the schema's field definitions. Omit to create an object with all fields at their default or null values. 571 input.org: Organization ID (`org_...`) to associate with the object. Typically required for system-owned objects. 572 input.schema_key: Legacy alias for `type` (schema `lookup_key`). Prefer `type` on new clients. Provide one of `type`, `schema_key`, or `config`. 573 input.system: When `true`, creates a system-owned object with no team, user, or agent owner. Requires elevated API credentials; returns 403 if the caller lacks permission. 574 input.team: Team ID (`team_...`) to set as the object owner. When supplied, takes priority over `user` and `agent`. 575 input.type: Schema type identifier (`lookup_key`) that defines the object's shape and validation rules. Preferred over the legacy `schema_key` / `config` aliases. 576 input.upsert: When `true` and the schema declares a `row_key`, updates the existing object at that key for the same owner instead of returning 409 Conflict. Returns HTTP 200 on update and 201 on create. 577 input.user: User ID (`user_...`) to set as the object owner. Used when neither `team` nor a higher-priority owner is set. 578 579 Returns: 580 The created (or upserted) custom object. 581 """ 582 return self._http.request( 583 "/api/v1/custom_objects", 584 method="POST", 585 body=input, 586 response_type=CustomObject, 587 )
Create a custom object
Creates a new custom object of the given schema type and returns the
persisted object. The caller must be authenticated and authorized to create
objects of the specified type.
Identify the schema with type (preferred), or the legacy aliases
schema_key (lookup key) / config (config ID). Exactly one identifier is
required; when more than one is supplied, type wins over schema_key,
which wins over config.
Owner resolution follows a priority order: if team is supplied the object
is team-owned; if user is supplied it is owned by that user; if agent is
supplied it is agent-owned; otherwise the object is owned by the authenticated
user. Pass system: true explicitly to force system ownership this requires
elevated API credentials and returns 403 if the caller lacks permission.
If the schema declares a row_key (and optionally a sort_key), you may
pass upsert: true to update an existing object at that key instead of
receiving a 409 Conflict. The response status is 200 on an update and
201 on a new create.
Arguments:
- input: Request body.
- input.acl: Access control list for the custom object. Supports explicit
readandwritegrants to users, teams, organizations, organization roles, agents, or everyone. - input.agent: Agent user ID to set as the object owner. Used when neither
teamnoruseris supplied. - input.config: Config ID (
cfg_...) that resolves to the target schema. Provide one oftype,schema_key, orconfig. - input.fields: Key-value map of field values for the new object. Must conform to the schema's field definitions. Omit to create an object with all fields at their default or null values.
- input.org: Organization ID (
org_...) to associate with the object. Typically required for system-owned objects. - input.schema_key: Legacy alias for
type(schemalookup_key). Prefertypeon new clients. Provide one oftype,schema_key, orconfig. - input.system: When
true, creates a system-owned object with no team, user, or agent owner. Requires elevated API credentials; returns 403 if the caller lacks permission. - input.team: Team ID (
team_...) to set as the object owner. When supplied, takes priority overuserandagent. - input.type: Schema type identifier (
lookup_key) that defines the object's shape and validation rules. Preferred over the legacyschema_key/configaliases. - input.upsert: When
trueand the schema declares arow_key, updates the existing object at that key for the same owner instead of returning 409 Conflict. Returns HTTP 200 on update and 201 on create. - input.user: User ID (
user_...) to set as the object owner. Used when neitherteamnor a higher-priority owner is set.
Returns:
The created (or upserted) custom object.
589 def delete(self, object: str) -> CustomObjectDeleteResponse: 590 """ 591 Delete a custom object 592 Permanently deletes the custom object identified by `object`. The caller 593 must be authenticated and have permission to delete the object. 594 On success, returns a confirmation payload containing the deleted object's 595 ID so callers can confirm the deletion without a follow-up fetch. 596 Attempting to delete an object that does not exist or has already been 597 deleted returns 404. 598 599 Args: 600 object: Custom object ID (`cobj_...`) of the object to delete. 601 602 Returns: 603 Successful response 604 """ 605 return self._http.request( 606 f"/api/v1/custom_objects/{object}", 607 method="DELETE", 608 response_type=CustomObjectDeleteResponse, 609 )
Delete a custom object
Permanently deletes the custom object identified by object. The caller
must be authenticated and have permission to delete the object.
On success, returns a confirmation payload containing the deleted object's
ID so callers can confirm the deletion without a follow-up fetch.
Attempting to delete an object that does not exist or has already been
deleted returns 404.
Arguments:
- object: Custom object ID (
cobj_...) of the object to delete.
Returns:
Successful response
611 def get(self, object: str, *, type: str | None = None) -> CustomObject: 612 """ 613 Retrieve a custom object 614 Returns a single custom object identified by its ID. The authenticated viewer 615 must have visibility access to the object. 616 Returns 404 if the object does not exist, has been deleted, or is not 617 visible to the viewer. 618 619 Args: 620 object: Custom object ID (`cobj_...`) to retrieve. 621 type: Schema type identifier (`lookup_key`) of the object. Optional; used for routing context only. 622 623 Returns: 624 The requested custom object. 625 """ 626 query: dict[str, object] = {} 627 if type is not None: 628 query["type"] = type 629 return self._http.request( 630 f"/api/v1/custom_objects/{object}", 631 query=query, 632 response_type=CustomObject, 633 )
Retrieve a custom object Returns a single custom object identified by its ID. The authenticated viewer must have visibility access to the object. Returns 404 if the object does not exist, has been deleted, or is not visible to the viewer.
Arguments:
- object: Custom object ID (
cobj_...) to retrieve. - type: Schema type identifier (
lookup_key) of the object. Optional; used for routing context only.
Returns:
The requested custom object.
635 def replace(self, object: str, input: CustomObjectReplaceInput) -> CustomObjectReplaceResponse: 636 """ 637 Update a custom object 638 Updates the fields of an existing custom object and returns the updated 639 object along with its new version number. The authenticated viewer must have 640 permission to modify the object. 641 You may supply `fields` (a full or partial key-value map to merge into the 642 object), `field_ops` (granular array operations per field), `acl`, or any 643 compatible combination. The same field name must not appear in both 644 `fields` and `field_ops`, which returns 422. Returns 404 if the object does 645 not exist or has been deleted. 646 647 Args: 648 object: Custom object ID (`cobj_...`) to update. 649 input: Request body. 650 input.acl: Updated access control list. Supports full replacement via `grants` or targeted `add`/`remove` operations. 651 input.field_ops: Granular array operations to apply per field (e.g. append, prepend, remove). A field must not appear in both `fields` and `field_ops`. 652 input.fields: Key-value map of field values to merge into the object. Only the supplied keys are affected. 653 input.type: Schema type identifier (`lookup_key`) of the object. Optional; used for routing context only. 654 655 Returns: 656 Successful response 657 """ 658 return self._http.request( 659 f"/api/v1/custom_objects/{object}", 660 method="PUT", 661 body=input, 662 response_type=CustomObjectReplaceResponse, 663 )
Update a custom object
Updates the fields of an existing custom object and returns the updated
object along with its new version number. The authenticated viewer must have
permission to modify the object.
You may supply fields (a full or partial key-value map to merge into the
object), field_ops (granular array operations per field), acl, or any
compatible combination. The same field name must not appear in both
fields and field_ops, which returns 422. Returns 404 if the object does
not exist or has been deleted.
Arguments:
- object: Custom object ID (
cobj_...) to update. - input: Request body.
- input.acl: Updated access control list. Supports full replacement via
grantsor targetedadd/removeoperations. - input.field_ops: Granular array operations to apply per field (e.g. append, prepend, remove). A field must not appear in both
fieldsandfield_ops. - input.fields: Key-value map of field values to merge into the object. Only the supplied keys are affected.
- input.type: Schema type identifier (
lookup_key) of the object. Optional; used for routing context only.
Returns:
Successful response