archastro.platform.v1.resources.custom_objects
1# Copyright (c) 2026 ArchAstro Inc. All Rights Reserved. 2# This file is auto-generated by @archastro/sdk-generator. Do not edit. 3# Content hash: c5a3abd0b2ab 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 CustomObjectCreateInput(TypedDict, total=False): 18 "Create a custom object" 19 20 agent: str | None 21 "Agent user ID to set as the object owner. Used when neither `team` nor `user` is supplied." 22 fields: Required[dict[str, Any]] 23 "Key-value map of field values for the new object. Must conform to the schema's field definitions." 24 org: str | None 25 "Organization ID (`org_...`) to associate with the object. Typically required for system-owned objects." 26 system: bool | None 27 "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." 28 team: str | None 29 "Team ID (`team_...`) to set as the object owner. When supplied, takes priority over `user` and `agent`." 30 type: Required[str] 31 "Schema type identifier (`lookup_key`) that defines the object's shape and validation rules." 32 upsert: bool | None 33 "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." 34 user: str | None 35 "User ID (`user_...`) to set as the object owner. Used when neither `team` nor a higher-priority owner is set." 36 37 38class CustomObjectReplaceInput(TypedDict, total=False): 39 "Update a custom object" 40 41 field_ops: dict[str, Any] | None 42 "Granular array operations to apply per field (e.g. append, prepend, remove). A field must not appear in both `fields` and `field_ops`." 43 fields: Required[dict[str, Any]] 44 "Key-value map of field values to merge into the object. Only the supplied keys are affected." 45 type: str | None 46 "Schema type identifier (`lookup_key`) of the object. Optional; used for routing context only." 47 48 49class CustomObjectDeleteResponse(BaseModel): 50 """ 51 Successful response 52 """ 53 54 deleted: bool = Field(..., description="Always `true` when the deletion succeeds.") 55 id: str = Field(..., description="ID of the deleted custom object (`cobj_...`).") 56 57 58class CustomObjectReplaceResponseData(BaseModel): 59 created_at: datetime | None = Field( 60 default=None, description="When the custom object was created (ISO 8601)." 61 ) 62 fields: dict[str, Any] | None = Field( 63 default=None, 64 description="Map of field names to their current values as defined by the object's schema type.", 65 ) 66 id: str = Field(..., description="Unique identifier for the custom object (`cobj_...`).") 67 org: str | None = Field( 68 default=None, description="ID of the organization this object belongs to (`org_...`)." 69 ) 70 row_key: str | None = Field( 71 default=None, 72 description="An optional stable key used to identify this object by a caller-controlled string rather than its generated ID. `null` if not set.", 73 ) 74 sandbox: str | None = Field( 75 default=None, 76 description="ID of the sandbox environment this object is scoped to (`dsb_...`). `null` for production objects.", 77 ) 78 schema_type: str | None = Field( 79 default=None, 80 description="The lookup key of the schema type that defines this object's field structure. `null` if the schema type has not been set.", 81 ) 82 team: str | None = Field( 83 default=None, 84 description="ID of the team that owns this object (`tem_...`). `null` if the object is not team-scoped.", 85 ) 86 updated_at: datetime | None = Field( 87 default=None, 88 description="When the custom object was last modified (ISO 8601). `null` if the object has never been updated after creation.", 89 ) 90 user: str | None = Field( 91 default=None, 92 description="ID of the user that owns this object (`usr_...`). `null` if the object is not user-scoped.", 93 ) 94 version: int | None = Field( 95 default=None, 96 description="Optimistic concurrency version of the object. Increments with each successful update; pass this value in write operations to detect conflicting changes.", 97 ) 98 99 100class CustomObjectReplaceResponse(BaseModel): 101 """ 102 Successful response 103 """ 104 105 data: CustomObjectReplaceResponseData = Field( 106 ..., description="The custom object after the update has been applied." 107 ) 108 meta: dict[str, Any] | None = Field( 109 default=None, description="Version metadata for the updated object." 110 ) 111 112 113class AsyncCustomObjectResource: 114 def __init__(self, http: HttpClient): 115 self._http = http 116 117 async def list( 118 self, 119 type: str, 120 *, 121 row_key: str | None = None, 122 sort_key: builtins.list[str] | None = None, 123 team: builtins.list[str] | None = None, 124 user: builtins.list[str] | None = None, 125 agent: builtins.list[str] | None = None, 126 org: builtins.list[str] | None = None, 127 query: str | None = None, 128 page: int | None = None, 129 page_size: int | None = None, 130 ) -> CustomObjectListResponse: 131 """ 132 List custom objects 133 Returns a paginated list of custom objects of the given schema type that are 134 visible to the authenticated viewer, ordered by creation time descending. 135 Results span all ownership types (team-owned, user-owned, agent-owned, and 136 system-owned) that the viewer has access to. 137 Use the `row_key` param to perform an exact-match partition lookup. You may 138 additionally supply `sort_key` to narrow within that partition `sort_key` 139 requires `row_key` and the request returns 400 if `sort_key` is provided 140 alone. Owner filters (`team`, `user`, `agent`, `org`) are additive: each 141 accepts an array of IDs and returns objects matching any of the supplied 142 values. 143 When `query` is supplied, results are ranked by full-text relevance 144 (descending `ts_rank`) rather than creation time. 145 146 Args: 147 type: Schema type identifier (`lookup_key`) to filter by. Only objects of this type are returned. 148 row_key: Exact `row_key` value to match. When supplied, only objects with this partition key are returned. 149 sort_key: One or more `sort_key` values to match within the `row_key` partition. Requires `row_key` to be set. 150 team: One or more team IDs (`team_...`) to filter by owning team. Returns objects owned by any of the supplied teams. 151 user: One or more user IDs (`user_...`) to filter by owning user. Returns objects owned by any of the supplied users. 152 agent: One or more agent IDs to filter by owning agent. Returns objects owned by any of the supplied agents. 153 org: One or more organization IDs (`org_...`) to filter by. Typically used by admins to query system-owned objects in a specific org. 154 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. 155 page: Page number to retrieve (1-indexed). Defaults to `1`. 156 page_size: Number of objects per page. Defaults to `25`; maximum is `100`. 157 158 Returns: 159 Paginated list of custom objects matching the supplied filters. 160 """ 161 query: dict[str, object] = {} 162 query["type"] = type 163 if row_key is not None: 164 query["row_key"] = row_key 165 if sort_key is not None: 166 query["sort_key"] = sort_key 167 if team is not None: 168 query["team"] = team 169 if user is not None: 170 query["user"] = user 171 if agent is not None: 172 query["agent"] = agent 173 if org is not None: 174 query["org"] = org 175 if query is not None: 176 query["query"] = query 177 if page is not None: 178 query["page"] = page 179 if page_size is not None: 180 query["page_size"] = page_size 181 return await self._http.request( 182 "/api/v1/custom_objects", 183 query=query, 184 response_type=CustomObjectListResponse, 185 ) 186 187 async def create(self, input: CustomObjectCreateInput) -> CustomObject: 188 """ 189 Create a custom object 190 Creates a new custom object of the given schema type and returns the 191 persisted object. The caller must be authenticated and authorized to create 192 objects of the specified type. 193 Owner resolution follows a priority order: if `team` is supplied the object 194 is team-owned; if `user` is supplied it is owned by that user; if `agent` is 195 supplied it is agent-owned; otherwise the object is owned by the authenticated 196 user. Pass `system: true` explicitly to force system ownership this requires 197 elevated API credentials and returns 403 if the caller lacks permission. 198 If the schema declares a `row_key` (and optionally a `sort_key`), you may 199 pass `upsert: true` to update an existing object at that key instead of 200 receiving a 409 Conflict. The response status is `200` on an update and 201 `201` on a new create. 202 203 Args: 204 input: Request body. 205 input.agent: Agent user ID to set as the object owner. Used when neither `team` nor `user` is supplied. 206 input.fields: Key-value map of field values for the new object. Must conform to the schema's field definitions. 207 input.org: Organization ID (`org_...`) to associate with the object. Typically required for system-owned objects. 208 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. 209 input.team: Team ID (`team_...`) to set as the object owner. When supplied, takes priority over `user` and `agent`. 210 input.type: Schema type identifier (`lookup_key`) that defines the object's shape and validation rules. 211 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. 212 input.user: User ID (`user_...`) to set as the object owner. Used when neither `team` nor a higher-priority owner is set. 213 214 Returns: 215 The created (or upserted) custom object. 216 """ 217 return await self._http.request( 218 "/api/v1/custom_objects", 219 method="POST", 220 body=input, 221 response_type=CustomObject, 222 ) 223 224 async def delete(self, object: str) -> CustomObjectDeleteResponse: 225 """ 226 Delete a custom object 227 Permanently deletes the custom object identified by `object`. The caller 228 must be authenticated and have permission to delete the object. 229 On success, returns a confirmation payload containing the deleted object's 230 ID so callers can confirm the deletion without a follow-up fetch. 231 Attempting to delete an object that does not exist or has already been 232 deleted returns 404. 233 234 Args: 235 object: Custom object ID (`cobj_...`) of the object to delete. 236 237 Returns: 238 Successful response 239 """ 240 return await self._http.request( 241 f"/api/v1/custom_objects/{object}", 242 method="DELETE", 243 response_type=CustomObjectDeleteResponse, 244 ) 245 246 async def get(self, object: str, *, type: str | None = None) -> CustomObject: 247 """ 248 Retrieve a custom object 249 Returns a single custom object identified by its ID. The authenticated viewer 250 must have visibility access to the object. 251 Returns 404 if the object does not exist, has been deleted, or is not 252 visible to the viewer. 253 254 Args: 255 object: Custom object ID (`cobj_...`) to retrieve. 256 type: Schema type identifier (`lookup_key`) of the object. Optional; used for routing context only. 257 258 Returns: 259 The requested custom object. 260 """ 261 query: dict[str, object] = {} 262 if type is not None: 263 query["type"] = type 264 return await self._http.request( 265 f"/api/v1/custom_objects/{object}", 266 query=query, 267 response_type=CustomObject, 268 ) 269 270 async def replace( 271 self, object: str, input: CustomObjectReplaceInput 272 ) -> CustomObjectReplaceResponse: 273 """ 274 Update a custom object 275 Updates the fields of an existing custom object and returns the updated 276 object along with its new version number. The authenticated viewer must have 277 permission to modify the object. 278 You may supply `fields` (a full or partial key-value map to merge into the 279 object), `field_ops` (granular array operations per field), or both but 280 the same field name must not appear in both, which returns 422. Returns 404 281 if the object does not exist or has been deleted. 282 283 Args: 284 object: Custom object ID (`cobj_...`) to update. 285 input: Request body. 286 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`. 287 input.fields: Key-value map of field values to merge into the object. Only the supplied keys are affected. 288 input.type: Schema type identifier (`lookup_key`) of the object. Optional; used for routing context only. 289 290 Returns: 291 Successful response 292 """ 293 return await self._http.request( 294 f"/api/v1/custom_objects/{object}", 295 method="PUT", 296 body=input, 297 response_type=CustomObjectReplaceResponse, 298 ) 299 300 301class CustomObjectResource: 302 def __init__(self, http: SyncHttpClient): 303 self._http = http 304 305 def list( 306 self, 307 type: str, 308 *, 309 row_key: str | None = None, 310 sort_key: builtins.list[str] | None = None, 311 team: builtins.list[str] | None = None, 312 user: builtins.list[str] | None = None, 313 agent: builtins.list[str] | None = None, 314 org: builtins.list[str] | None = None, 315 query: str | None = None, 316 page: int | None = None, 317 page_size: int | None = None, 318 ) -> CustomObjectListResponse: 319 """ 320 List custom objects 321 Returns a paginated list of custom objects of the given schema type that are 322 visible to the authenticated viewer, ordered by creation time descending. 323 Results span all ownership types (team-owned, user-owned, agent-owned, and 324 system-owned) that the viewer has access to. 325 Use the `row_key` param to perform an exact-match partition lookup. You may 326 additionally supply `sort_key` to narrow within that partition `sort_key` 327 requires `row_key` and the request returns 400 if `sort_key` is provided 328 alone. Owner filters (`team`, `user`, `agent`, `org`) are additive: each 329 accepts an array of IDs and returns objects matching any of the supplied 330 values. 331 When `query` is supplied, results are ranked by full-text relevance 332 (descending `ts_rank`) rather than creation time. 333 334 Args: 335 type: Schema type identifier (`lookup_key`) to filter by. Only objects of this type are returned. 336 row_key: Exact `row_key` value to match. When supplied, only objects with this partition key are returned. 337 sort_key: One or more `sort_key` values to match within the `row_key` partition. Requires `row_key` to be set. 338 team: One or more team IDs (`team_...`) to filter by owning team. Returns objects owned by any of the supplied teams. 339 user: One or more user IDs (`user_...`) to filter by owning user. Returns objects owned by any of the supplied users. 340 agent: One or more agent IDs to filter by owning agent. Returns objects owned by any of the supplied agents. 341 org: One or more organization IDs (`org_...`) to filter by. Typically used by admins to query system-owned objects in a specific org. 342 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. 343 page: Page number to retrieve (1-indexed). Defaults to `1`. 344 page_size: Number of objects per page. Defaults to `25`; maximum is `100`. 345 346 Returns: 347 Paginated list of custom objects matching the supplied filters. 348 """ 349 query: dict[str, object] = {} 350 query["type"] = type 351 if row_key is not None: 352 query["row_key"] = row_key 353 if sort_key is not None: 354 query["sort_key"] = sort_key 355 if team is not None: 356 query["team"] = team 357 if user is not None: 358 query["user"] = user 359 if agent is not None: 360 query["agent"] = agent 361 if org is not None: 362 query["org"] = org 363 if query is not None: 364 query["query"] = query 365 if page is not None: 366 query["page"] = page 367 if page_size is not None: 368 query["page_size"] = page_size 369 return self._http.request( 370 "/api/v1/custom_objects", 371 query=query, 372 response_type=CustomObjectListResponse, 373 ) 374 375 def create(self, input: CustomObjectCreateInput) -> CustomObject: 376 """ 377 Create a custom object 378 Creates a new custom object of the given schema type and returns the 379 persisted object. The caller must be authenticated and authorized to create 380 objects of the specified type. 381 Owner resolution follows a priority order: if `team` is supplied the object 382 is team-owned; if `user` is supplied it is owned by that user; if `agent` is 383 supplied it is agent-owned; otherwise the object is owned by the authenticated 384 user. Pass `system: true` explicitly to force system ownership this requires 385 elevated API credentials and returns 403 if the caller lacks permission. 386 If the schema declares a `row_key` (and optionally a `sort_key`), you may 387 pass `upsert: true` to update an existing object at that key instead of 388 receiving a 409 Conflict. The response status is `200` on an update and 389 `201` on a new create. 390 391 Args: 392 input: Request body. 393 input.agent: Agent user ID to set as the object owner. Used when neither `team` nor `user` is supplied. 394 input.fields: Key-value map of field values for the new object. Must conform to the schema's field definitions. 395 input.org: Organization ID (`org_...`) to associate with the object. Typically required for system-owned objects. 396 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. 397 input.team: Team ID (`team_...`) to set as the object owner. When supplied, takes priority over `user` and `agent`. 398 input.type: Schema type identifier (`lookup_key`) that defines the object's shape and validation rules. 399 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. 400 input.user: User ID (`user_...`) to set as the object owner. Used when neither `team` nor a higher-priority owner is set. 401 402 Returns: 403 The created (or upserted) custom object. 404 """ 405 return self._http.request( 406 "/api/v1/custom_objects", 407 method="POST", 408 body=input, 409 response_type=CustomObject, 410 ) 411 412 def delete(self, object: str) -> CustomObjectDeleteResponse: 413 """ 414 Delete a custom object 415 Permanently deletes the custom object identified by `object`. The caller 416 must be authenticated and have permission to delete the object. 417 On success, returns a confirmation payload containing the deleted object's 418 ID so callers can confirm the deletion without a follow-up fetch. 419 Attempting to delete an object that does not exist or has already been 420 deleted returns 404. 421 422 Args: 423 object: Custom object ID (`cobj_...`) of the object to delete. 424 425 Returns: 426 Successful response 427 """ 428 return self._http.request( 429 f"/api/v1/custom_objects/{object}", 430 method="DELETE", 431 response_type=CustomObjectDeleteResponse, 432 ) 433 434 def get(self, object: str, *, type: str | None = None) -> CustomObject: 435 """ 436 Retrieve a custom object 437 Returns a single custom object identified by its ID. The authenticated viewer 438 must have visibility access to the object. 439 Returns 404 if the object does not exist, has been deleted, or is not 440 visible to the viewer. 441 442 Args: 443 object: Custom object ID (`cobj_...`) to retrieve. 444 type: Schema type identifier (`lookup_key`) of the object. Optional; used for routing context only. 445 446 Returns: 447 The requested custom object. 448 """ 449 query: dict[str, object] = {} 450 if type is not None: 451 query["type"] = type 452 return self._http.request( 453 f"/api/v1/custom_objects/{object}", 454 query=query, 455 response_type=CustomObject, 456 ) 457 458 def replace(self, object: str, input: CustomObjectReplaceInput) -> CustomObjectReplaceResponse: 459 """ 460 Update a custom object 461 Updates the fields of an existing custom object and returns the updated 462 object along with its new version number. The authenticated viewer must have 463 permission to modify the object. 464 You may supply `fields` (a full or partial key-value map to merge into the 465 object), `field_ops` (granular array operations per field), or both but 466 the same field name must not appear in both, which returns 422. Returns 404 467 if the object does not exist or has been deleted. 468 469 Args: 470 object: Custom object ID (`cobj_...`) to update. 471 input: Request body. 472 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`. 473 input.fields: Key-value map of field values to merge into the object. Only the supplied keys are affected. 474 input.type: Schema type identifier (`lookup_key`) of the object. Optional; used for routing context only. 475 476 Returns: 477 Successful response 478 """ 479 return self._http.request( 480 f"/api/v1/custom_objects/{object}", 481 method="PUT", 482 body=input, 483 response_type=CustomObjectReplaceResponse, 484 )
18class CustomObjectCreateInput(TypedDict, total=False): 19 "Create a custom object" 20 21 agent: str | None 22 "Agent user ID to set as the object owner. Used when neither `team` nor `user` is supplied." 23 fields: Required[dict[str, Any]] 24 "Key-value map of field values for the new object. Must conform to the schema's field definitions." 25 org: str | None 26 "Organization ID (`org_...`) to associate with the object. Typically required for system-owned objects." 27 system: bool | None 28 "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." 29 team: str | None 30 "Team ID (`team_...`) to set as the object owner. When supplied, takes priority over `user` and `agent`." 31 type: Required[str] 32 "Schema type identifier (`lookup_key`) that defines the object's shape and validation rules." 33 upsert: bool | None 34 "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." 35 user: str | None 36 "User ID (`user_...`) to set as the object owner. Used when neither `team` nor a higher-priority owner is set."
Create a custom object
Key-value map of field values for the new object. Must conform to the schema's field definitions.
Organization ID (org_...) to associate with the object. Typically required for system-owned objects.
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.
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.
39class CustomObjectReplaceInput(TypedDict, total=False): 40 "Update a custom object" 41 42 field_ops: dict[str, Any] | None 43 "Granular array operations to apply per field (e.g. append, prepend, remove). A field must not appear in both `fields` and `field_ops`." 44 fields: Required[dict[str, Any]] 45 "Key-value map of field values to merge into the object. Only the supplied keys are affected." 46 type: str | None 47 "Schema type identifier (`lookup_key`) of the object. Optional; used for routing context only."
Update a custom object
50class CustomObjectDeleteResponse(BaseModel): 51 """ 52 Successful response 53 """ 54 55 deleted: bool = Field(..., description="Always `true` when the deletion succeeds.") 56 id: str = Field(..., description="ID of the deleted custom object (`cobj_...`).")
Successful response
59class CustomObjectReplaceResponseData(BaseModel): 60 created_at: datetime | None = Field( 61 default=None, description="When the custom object was created (ISO 8601)." 62 ) 63 fields: dict[str, Any] | None = Field( 64 default=None, 65 description="Map of field names to their current values as defined by the object's schema type.", 66 ) 67 id: str = Field(..., description="Unique identifier for the custom object (`cobj_...`).") 68 org: str | None = Field( 69 default=None, description="ID of the organization this object belongs to (`org_...`)." 70 ) 71 row_key: str | None = Field( 72 default=None, 73 description="An optional stable key used to identify this object by a caller-controlled string rather than its generated ID. `null` if not set.", 74 ) 75 sandbox: str | None = Field( 76 default=None, 77 description="ID of the sandbox environment this object is scoped to (`dsb_...`). `null` for production objects.", 78 ) 79 schema_type: str | None = Field( 80 default=None, 81 description="The lookup key of the schema type that defines this object's field structure. `null` if the schema type has not been set.", 82 ) 83 team: str | None = Field( 84 default=None, 85 description="ID of the team that owns this object (`tem_...`). `null` if the object is not team-scoped.", 86 ) 87 updated_at: datetime | None = Field( 88 default=None, 89 description="When the custom object was last modified (ISO 8601). `null` if the object has never been updated after creation.", 90 ) 91 user: str | None = Field( 92 default=None, 93 description="ID of the user that owns this object (`usr_...`). `null` if the object is not user-scoped.", 94 ) 95 version: int | None = Field( 96 default=None, 97 description="Optimistic concurrency version of the object. Increments with each successful update; pass this value in write operations to detect conflicting changes.", 98 )
!!! 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.
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.
101class CustomObjectReplaceResponse(BaseModel): 102 """ 103 Successful response 104 """ 105 106 data: CustomObjectReplaceResponseData = Field( 107 ..., description="The custom object after the update has been applied." 108 ) 109 meta: dict[str, Any] | None = Field( 110 default=None, description="Version metadata for the updated object." 111 )
Successful response
114class AsyncCustomObjectResource: 115 def __init__(self, http: HttpClient): 116 self._http = http 117 118 async def list( 119 self, 120 type: str, 121 *, 122 row_key: str | None = None, 123 sort_key: builtins.list[str] | None = None, 124 team: builtins.list[str] | None = None, 125 user: builtins.list[str] | None = None, 126 agent: builtins.list[str] | None = None, 127 org: builtins.list[str] | None = None, 128 query: str | None = None, 129 page: int | None = None, 130 page_size: int | None = None, 131 ) -> CustomObjectListResponse: 132 """ 133 List custom objects 134 Returns a paginated list of custom objects of the given schema type that are 135 visible to the authenticated viewer, ordered by creation time descending. 136 Results span all ownership types (team-owned, user-owned, agent-owned, and 137 system-owned) that the viewer has access to. 138 Use the `row_key` param to perform an exact-match partition lookup. You may 139 additionally supply `sort_key` to narrow within that partition `sort_key` 140 requires `row_key` and the request returns 400 if `sort_key` is provided 141 alone. Owner filters (`team`, `user`, `agent`, `org`) are additive: each 142 accepts an array of IDs and returns objects matching any of the supplied 143 values. 144 When `query` is supplied, results are ranked by full-text relevance 145 (descending `ts_rank`) rather than creation time. 146 147 Args: 148 type: Schema type identifier (`lookup_key`) to filter by. Only objects of this type are returned. 149 row_key: Exact `row_key` value to match. When supplied, only objects with this partition key are returned. 150 sort_key: One or more `sort_key` values to match within the `row_key` partition. Requires `row_key` to be set. 151 team: One or more team IDs (`team_...`) to filter by owning team. Returns objects owned by any of the supplied teams. 152 user: One or more user IDs (`user_...`) to filter by owning user. Returns objects owned by any of the supplied users. 153 agent: One or more agent IDs to filter by owning agent. Returns objects owned by any of the supplied agents. 154 org: One or more organization IDs (`org_...`) to filter by. Typically used by admins to query system-owned objects in a specific org. 155 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. 156 page: Page number to retrieve (1-indexed). Defaults to `1`. 157 page_size: Number of objects per page. Defaults to `25`; maximum is `100`. 158 159 Returns: 160 Paginated list of custom objects matching the supplied filters. 161 """ 162 query: dict[str, object] = {} 163 query["type"] = type 164 if row_key is not None: 165 query["row_key"] = row_key 166 if sort_key is not None: 167 query["sort_key"] = sort_key 168 if team is not None: 169 query["team"] = team 170 if user is not None: 171 query["user"] = user 172 if agent is not None: 173 query["agent"] = agent 174 if org is not None: 175 query["org"] = org 176 if query is not None: 177 query["query"] = query 178 if page is not None: 179 query["page"] = page 180 if page_size is not None: 181 query["page_size"] = page_size 182 return await self._http.request( 183 "/api/v1/custom_objects", 184 query=query, 185 response_type=CustomObjectListResponse, 186 ) 187 188 async def create(self, input: CustomObjectCreateInput) -> CustomObject: 189 """ 190 Create a custom object 191 Creates a new custom object of the given schema type and returns the 192 persisted object. The caller must be authenticated and authorized to create 193 objects of the specified type. 194 Owner resolution follows a priority order: if `team` is supplied the object 195 is team-owned; if `user` is supplied it is owned by that user; if `agent` is 196 supplied it is agent-owned; otherwise the object is owned by the authenticated 197 user. Pass `system: true` explicitly to force system ownership this requires 198 elevated API credentials and returns 403 if the caller lacks permission. 199 If the schema declares a `row_key` (and optionally a `sort_key`), you may 200 pass `upsert: true` to update an existing object at that key instead of 201 receiving a 409 Conflict. The response status is `200` on an update and 202 `201` on a new create. 203 204 Args: 205 input: Request body. 206 input.agent: Agent user ID to set as the object owner. Used when neither `team` nor `user` is supplied. 207 input.fields: Key-value map of field values for the new object. Must conform to the schema's field definitions. 208 input.org: Organization ID (`org_...`) to associate with the object. Typically required for system-owned objects. 209 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. 210 input.team: Team ID (`team_...`) to set as the object owner. When supplied, takes priority over `user` and `agent`. 211 input.type: Schema type identifier (`lookup_key`) that defines the object's shape and validation rules. 212 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. 213 input.user: User ID (`user_...`) to set as the object owner. Used when neither `team` nor a higher-priority owner is set. 214 215 Returns: 216 The created (or upserted) custom object. 217 """ 218 return await self._http.request( 219 "/api/v1/custom_objects", 220 method="POST", 221 body=input, 222 response_type=CustomObject, 223 ) 224 225 async def delete(self, object: str) -> CustomObjectDeleteResponse: 226 """ 227 Delete a custom object 228 Permanently deletes the custom object identified by `object`. The caller 229 must be authenticated and have permission to delete the object. 230 On success, returns a confirmation payload containing the deleted object's 231 ID so callers can confirm the deletion without a follow-up fetch. 232 Attempting to delete an object that does not exist or has already been 233 deleted returns 404. 234 235 Args: 236 object: Custom object ID (`cobj_...`) of the object to delete. 237 238 Returns: 239 Successful response 240 """ 241 return await self._http.request( 242 f"/api/v1/custom_objects/{object}", 243 method="DELETE", 244 response_type=CustomObjectDeleteResponse, 245 ) 246 247 async def get(self, object: str, *, type: str | None = None) -> CustomObject: 248 """ 249 Retrieve a custom object 250 Returns a single custom object identified by its ID. The authenticated viewer 251 must have visibility access to the object. 252 Returns 404 if the object does not exist, has been deleted, or is not 253 visible to the viewer. 254 255 Args: 256 object: Custom object ID (`cobj_...`) to retrieve. 257 type: Schema type identifier (`lookup_key`) of the object. Optional; used for routing context only. 258 259 Returns: 260 The requested custom object. 261 """ 262 query: dict[str, object] = {} 263 if type is not None: 264 query["type"] = type 265 return await self._http.request( 266 f"/api/v1/custom_objects/{object}", 267 query=query, 268 response_type=CustomObject, 269 ) 270 271 async def replace( 272 self, object: str, input: CustomObjectReplaceInput 273 ) -> CustomObjectReplaceResponse: 274 """ 275 Update a custom object 276 Updates the fields of an existing custom object and returns the updated 277 object along with its new version number. The authenticated viewer must have 278 permission to modify the object. 279 You may supply `fields` (a full or partial key-value map to merge into the 280 object), `field_ops` (granular array operations per field), or both but 281 the same field name must not appear in both, which returns 422. Returns 404 282 if the object does not exist or has been deleted. 283 284 Args: 285 object: Custom object ID (`cobj_...`) to update. 286 input: Request body. 287 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`. 288 input.fields: Key-value map of field values to merge into the object. Only the supplied keys are affected. 289 input.type: Schema type identifier (`lookup_key`) of the object. Optional; used for routing context only. 290 291 Returns: 292 Successful response 293 """ 294 return await self._http.request( 295 f"/api/v1/custom_objects/{object}", 296 method="PUT", 297 body=input, 298 response_type=CustomObjectReplaceResponse, 299 )
118 async def list( 119 self, 120 type: str, 121 *, 122 row_key: str | None = None, 123 sort_key: builtins.list[str] | None = None, 124 team: builtins.list[str] | None = None, 125 user: builtins.list[str] | None = None, 126 agent: builtins.list[str] | None = None, 127 org: builtins.list[str] | None = None, 128 query: str | None = None, 129 page: int | None = None, 130 page_size: int | None = None, 131 ) -> CustomObjectListResponse: 132 """ 133 List custom objects 134 Returns a paginated list of custom objects of the given schema type that are 135 visible to the authenticated viewer, ordered by creation time descending. 136 Results span all ownership types (team-owned, user-owned, agent-owned, and 137 system-owned) that the viewer has access to. 138 Use the `row_key` param to perform an exact-match partition lookup. You may 139 additionally supply `sort_key` to narrow within that partition `sort_key` 140 requires `row_key` and the request returns 400 if `sort_key` is provided 141 alone. Owner filters (`team`, `user`, `agent`, `org`) are additive: each 142 accepts an array of IDs and returns objects matching any of the supplied 143 values. 144 When `query` is supplied, results are ranked by full-text relevance 145 (descending `ts_rank`) rather than creation time. 146 147 Args: 148 type: Schema type identifier (`lookup_key`) to filter by. Only objects of this type are returned. 149 row_key: Exact `row_key` value to match. When supplied, only objects with this partition key are returned. 150 sort_key: One or more `sort_key` values to match within the `row_key` partition. Requires `row_key` to be set. 151 team: One or more team IDs (`team_...`) to filter by owning team. Returns objects owned by any of the supplied teams. 152 user: One or more user IDs (`user_...`) to filter by owning user. Returns objects owned by any of the supplied users. 153 agent: One or more agent IDs to filter by owning agent. Returns objects owned by any of the supplied agents. 154 org: One or more organization IDs (`org_...`) to filter by. Typically used by admins to query system-owned objects in a specific org. 155 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. 156 page: Page number to retrieve (1-indexed). Defaults to `1`. 157 page_size: Number of objects per page. Defaults to `25`; maximum is `100`. 158 159 Returns: 160 Paginated list of custom objects matching the supplied filters. 161 """ 162 query: dict[str, object] = {} 163 query["type"] = type 164 if row_key is not None: 165 query["row_key"] = row_key 166 if sort_key is not None: 167 query["sort_key"] = sort_key 168 if team is not None: 169 query["team"] = team 170 if user is not None: 171 query["user"] = user 172 if agent is not None: 173 query["agent"] = agent 174 if org is not None: 175 query["org"] = org 176 if query is not None: 177 query["query"] = query 178 if page is not None: 179 query["page"] = page 180 if page_size is not None: 181 query["page_size"] = page_size 182 return await self._http.request( 183 "/api/v1/custom_objects", 184 query=query, 185 response_type=CustomObjectListResponse, 186 )
List custom objects
Returns a paginated list of custom objects of the given schema type that are
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.
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 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.
Arguments:
- type: Schema type identifier (
lookup_key) to filter by. Only objects of this type are returned. - 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.
- 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.
188 async def create(self, input: CustomObjectCreateInput) -> CustomObject: 189 """ 190 Create a custom object 191 Creates a new custom object of the given schema type and returns the 192 persisted object. The caller must be authenticated and authorized to create 193 objects of the specified type. 194 Owner resolution follows a priority order: if `team` is supplied the object 195 is team-owned; if `user` is supplied it is owned by that user; if `agent` is 196 supplied it is agent-owned; otherwise the object is owned by the authenticated 197 user. Pass `system: true` explicitly to force system ownership this requires 198 elevated API credentials and returns 403 if the caller lacks permission. 199 If the schema declares a `row_key` (and optionally a `sort_key`), you may 200 pass `upsert: true` to update an existing object at that key instead of 201 receiving a 409 Conflict. The response status is `200` on an update and 202 `201` on a new create. 203 204 Args: 205 input: Request body. 206 input.agent: Agent user ID to set as the object owner. Used when neither `team` nor `user` is supplied. 207 input.fields: Key-value map of field values for the new object. Must conform to the schema's field definitions. 208 input.org: Organization ID (`org_...`) to associate with the object. Typically required for system-owned objects. 209 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. 210 input.team: Team ID (`team_...`) to set as the object owner. When supplied, takes priority over `user` and `agent`. 211 input.type: Schema type identifier (`lookup_key`) that defines the object's shape and validation rules. 212 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. 213 input.user: User ID (`user_...`) to set as the object owner. Used when neither `team` nor a higher-priority owner is set. 214 215 Returns: 216 The created (or upserted) custom object. 217 """ 218 return await self._http.request( 219 "/api/v1/custom_objects", 220 method="POST", 221 body=input, 222 response_type=CustomObject, 223 )
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.
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.agent: Agent user ID to set as the object owner. Used when neither
teamnoruseris supplied. - input.fields: Key-value map of field values for the new object. Must conform to the schema's field definitions.
- input.org: Organization ID (
org_...) to associate with the object. Typically required for system-owned objects. - 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. - 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.
225 async def delete(self, object: str) -> CustomObjectDeleteResponse: 226 """ 227 Delete a custom object 228 Permanently deletes the custom object identified by `object`. The caller 229 must be authenticated and have permission to delete the object. 230 On success, returns a confirmation payload containing the deleted object's 231 ID so callers can confirm the deletion without a follow-up fetch. 232 Attempting to delete an object that does not exist or has already been 233 deleted returns 404. 234 235 Args: 236 object: Custom object ID (`cobj_...`) of the object to delete. 237 238 Returns: 239 Successful response 240 """ 241 return await self._http.request( 242 f"/api/v1/custom_objects/{object}", 243 method="DELETE", 244 response_type=CustomObjectDeleteResponse, 245 )
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
247 async def get(self, object: str, *, type: str | None = None) -> CustomObject: 248 """ 249 Retrieve a custom object 250 Returns a single custom object identified by its ID. The authenticated viewer 251 must have visibility access to the object. 252 Returns 404 if the object does not exist, has been deleted, or is not 253 visible to the viewer. 254 255 Args: 256 object: Custom object ID (`cobj_...`) to retrieve. 257 type: Schema type identifier (`lookup_key`) of the object. Optional; used for routing context only. 258 259 Returns: 260 The requested custom object. 261 """ 262 query: dict[str, object] = {} 263 if type is not None: 264 query["type"] = type 265 return await self._http.request( 266 f"/api/v1/custom_objects/{object}", 267 query=query, 268 response_type=CustomObject, 269 )
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.
271 async def replace( 272 self, object: str, input: CustomObjectReplaceInput 273 ) -> CustomObjectReplaceResponse: 274 """ 275 Update a custom object 276 Updates the fields of an existing custom object and returns the updated 277 object along with its new version number. The authenticated viewer must have 278 permission to modify the object. 279 You may supply `fields` (a full or partial key-value map to merge into the 280 object), `field_ops` (granular array operations per field), or both but 281 the same field name must not appear in both, which returns 422. Returns 404 282 if the object does not exist or has been deleted. 283 284 Args: 285 object: Custom object ID (`cobj_...`) to update. 286 input: Request body. 287 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`. 288 input.fields: Key-value map of field values to merge into the object. Only the supplied keys are affected. 289 input.type: Schema type identifier (`lookup_key`) of the object. Optional; used for routing context only. 290 291 Returns: 292 Successful response 293 """ 294 return await self._http.request( 295 f"/api/v1/custom_objects/{object}", 296 method="PUT", 297 body=input, 298 response_type=CustomObjectReplaceResponse, 299 )
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), or both but
the same field name must not appear in both, 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.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
302class CustomObjectResource: 303 def __init__(self, http: SyncHttpClient): 304 self._http = http 305 306 def list( 307 self, 308 type: str, 309 *, 310 row_key: str | None = None, 311 sort_key: builtins.list[str] | None = None, 312 team: builtins.list[str] | None = None, 313 user: builtins.list[str] | None = None, 314 agent: builtins.list[str] | None = None, 315 org: builtins.list[str] | None = None, 316 query: str | None = None, 317 page: int | None = None, 318 page_size: int | None = None, 319 ) -> CustomObjectListResponse: 320 """ 321 List custom objects 322 Returns a paginated list of custom objects of the given schema type that are 323 visible to the authenticated viewer, ordered by creation time descending. 324 Results span all ownership types (team-owned, user-owned, agent-owned, and 325 system-owned) that the viewer has access to. 326 Use the `row_key` param to perform an exact-match partition lookup. You may 327 additionally supply `sort_key` to narrow within that partition `sort_key` 328 requires `row_key` and the request returns 400 if `sort_key` is provided 329 alone. Owner filters (`team`, `user`, `agent`, `org`) are additive: each 330 accepts an array of IDs and returns objects matching any of the supplied 331 values. 332 When `query` is supplied, results are ranked by full-text relevance 333 (descending `ts_rank`) rather than creation time. 334 335 Args: 336 type: Schema type identifier (`lookup_key`) to filter by. Only objects of this type are returned. 337 row_key: Exact `row_key` value to match. When supplied, only objects with this partition key are returned. 338 sort_key: One or more `sort_key` values to match within the `row_key` partition. Requires `row_key` to be set. 339 team: One or more team IDs (`team_...`) to filter by owning team. Returns objects owned by any of the supplied teams. 340 user: One or more user IDs (`user_...`) to filter by owning user. Returns objects owned by any of the supplied users. 341 agent: One or more agent IDs to filter by owning agent. Returns objects owned by any of the supplied agents. 342 org: One or more organization IDs (`org_...`) to filter by. Typically used by admins to query system-owned objects in a specific org. 343 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. 344 page: Page number to retrieve (1-indexed). Defaults to `1`. 345 page_size: Number of objects per page. Defaults to `25`; maximum is `100`. 346 347 Returns: 348 Paginated list of custom objects matching the supplied filters. 349 """ 350 query: dict[str, object] = {} 351 query["type"] = type 352 if row_key is not None: 353 query["row_key"] = row_key 354 if sort_key is not None: 355 query["sort_key"] = sort_key 356 if team is not None: 357 query["team"] = team 358 if user is not None: 359 query["user"] = user 360 if agent is not None: 361 query["agent"] = agent 362 if org is not None: 363 query["org"] = org 364 if query is not None: 365 query["query"] = query 366 if page is not None: 367 query["page"] = page 368 if page_size is not None: 369 query["page_size"] = page_size 370 return self._http.request( 371 "/api/v1/custom_objects", 372 query=query, 373 response_type=CustomObjectListResponse, 374 ) 375 376 def create(self, input: CustomObjectCreateInput) -> CustomObject: 377 """ 378 Create a custom object 379 Creates a new custom object of the given schema type and returns the 380 persisted object. The caller must be authenticated and authorized to create 381 objects of the specified type. 382 Owner resolution follows a priority order: if `team` is supplied the object 383 is team-owned; if `user` is supplied it is owned by that user; if `agent` is 384 supplied it is agent-owned; otherwise the object is owned by the authenticated 385 user. Pass `system: true` explicitly to force system ownership this requires 386 elevated API credentials and returns 403 if the caller lacks permission. 387 If the schema declares a `row_key` (and optionally a `sort_key`), you may 388 pass `upsert: true` to update an existing object at that key instead of 389 receiving a 409 Conflict. The response status is `200` on an update and 390 `201` on a new create. 391 392 Args: 393 input: Request body. 394 input.agent: Agent user ID to set as the object owner. Used when neither `team` nor `user` is supplied. 395 input.fields: Key-value map of field values for the new object. Must conform to the schema's field definitions. 396 input.org: Organization ID (`org_...`) to associate with the object. Typically required for system-owned objects. 397 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. 398 input.team: Team ID (`team_...`) to set as the object owner. When supplied, takes priority over `user` and `agent`. 399 input.type: Schema type identifier (`lookup_key`) that defines the object's shape and validation rules. 400 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. 401 input.user: User ID (`user_...`) to set as the object owner. Used when neither `team` nor a higher-priority owner is set. 402 403 Returns: 404 The created (or upserted) custom object. 405 """ 406 return self._http.request( 407 "/api/v1/custom_objects", 408 method="POST", 409 body=input, 410 response_type=CustomObject, 411 ) 412 413 def delete(self, object: str) -> CustomObjectDeleteResponse: 414 """ 415 Delete a custom object 416 Permanently deletes the custom object identified by `object`. The caller 417 must be authenticated and have permission to delete the object. 418 On success, returns a confirmation payload containing the deleted object's 419 ID so callers can confirm the deletion without a follow-up fetch. 420 Attempting to delete an object that does not exist or has already been 421 deleted returns 404. 422 423 Args: 424 object: Custom object ID (`cobj_...`) of the object to delete. 425 426 Returns: 427 Successful response 428 """ 429 return self._http.request( 430 f"/api/v1/custom_objects/{object}", 431 method="DELETE", 432 response_type=CustomObjectDeleteResponse, 433 ) 434 435 def get(self, object: str, *, type: str | None = None) -> CustomObject: 436 """ 437 Retrieve a custom object 438 Returns a single custom object identified by its ID. The authenticated viewer 439 must have visibility access to the object. 440 Returns 404 if the object does not exist, has been deleted, or is not 441 visible to the viewer. 442 443 Args: 444 object: Custom object ID (`cobj_...`) to retrieve. 445 type: Schema type identifier (`lookup_key`) of the object. Optional; used for routing context only. 446 447 Returns: 448 The requested custom object. 449 """ 450 query: dict[str, object] = {} 451 if type is not None: 452 query["type"] = type 453 return self._http.request( 454 f"/api/v1/custom_objects/{object}", 455 query=query, 456 response_type=CustomObject, 457 ) 458 459 def replace(self, object: str, input: CustomObjectReplaceInput) -> CustomObjectReplaceResponse: 460 """ 461 Update a custom object 462 Updates the fields of an existing custom object and returns the updated 463 object along with its new version number. The authenticated viewer must have 464 permission to modify the object. 465 You may supply `fields` (a full or partial key-value map to merge into the 466 object), `field_ops` (granular array operations per field), or both but 467 the same field name must not appear in both, which returns 422. Returns 404 468 if the object does not exist or has been deleted. 469 470 Args: 471 object: Custom object ID (`cobj_...`) to update. 472 input: Request body. 473 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`. 474 input.fields: Key-value map of field values to merge into the object. Only the supplied keys are affected. 475 input.type: Schema type identifier (`lookup_key`) of the object. Optional; used for routing context only. 476 477 Returns: 478 Successful response 479 """ 480 return self._http.request( 481 f"/api/v1/custom_objects/{object}", 482 method="PUT", 483 body=input, 484 response_type=CustomObjectReplaceResponse, 485 )
306 def list( 307 self, 308 type: str, 309 *, 310 row_key: str | None = None, 311 sort_key: builtins.list[str] | None = None, 312 team: builtins.list[str] | None = None, 313 user: builtins.list[str] | None = None, 314 agent: builtins.list[str] | None = None, 315 org: builtins.list[str] | None = None, 316 query: str | None = None, 317 page: int | None = None, 318 page_size: int | None = None, 319 ) -> CustomObjectListResponse: 320 """ 321 List custom objects 322 Returns a paginated list of custom objects of the given schema type that are 323 visible to the authenticated viewer, ordered by creation time descending. 324 Results span all ownership types (team-owned, user-owned, agent-owned, and 325 system-owned) that the viewer has access to. 326 Use the `row_key` param to perform an exact-match partition lookup. You may 327 additionally supply `sort_key` to narrow within that partition `sort_key` 328 requires `row_key` and the request returns 400 if `sort_key` is provided 329 alone. Owner filters (`team`, `user`, `agent`, `org`) are additive: each 330 accepts an array of IDs and returns objects matching any of the supplied 331 values. 332 When `query` is supplied, results are ranked by full-text relevance 333 (descending `ts_rank`) rather than creation time. 334 335 Args: 336 type: Schema type identifier (`lookup_key`) to filter by. Only objects of this type are returned. 337 row_key: Exact `row_key` value to match. When supplied, only objects with this partition key are returned. 338 sort_key: One or more `sort_key` values to match within the `row_key` partition. Requires `row_key` to be set. 339 team: One or more team IDs (`team_...`) to filter by owning team. Returns objects owned by any of the supplied teams. 340 user: One or more user IDs (`user_...`) to filter by owning user. Returns objects owned by any of the supplied users. 341 agent: One or more agent IDs to filter by owning agent. Returns objects owned by any of the supplied agents. 342 org: One or more organization IDs (`org_...`) to filter by. Typically used by admins to query system-owned objects in a specific org. 343 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. 344 page: Page number to retrieve (1-indexed). Defaults to `1`. 345 page_size: Number of objects per page. Defaults to `25`; maximum is `100`. 346 347 Returns: 348 Paginated list of custom objects matching the supplied filters. 349 """ 350 query: dict[str, object] = {} 351 query["type"] = type 352 if row_key is not None: 353 query["row_key"] = row_key 354 if sort_key is not None: 355 query["sort_key"] = sort_key 356 if team is not None: 357 query["team"] = team 358 if user is not None: 359 query["user"] = user 360 if agent is not None: 361 query["agent"] = agent 362 if org is not None: 363 query["org"] = org 364 if query is not None: 365 query["query"] = query 366 if page is not None: 367 query["page"] = page 368 if page_size is not None: 369 query["page_size"] = page_size 370 return self._http.request( 371 "/api/v1/custom_objects", 372 query=query, 373 response_type=CustomObjectListResponse, 374 )
List custom objects
Returns a paginated list of custom objects of the given schema type that are
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.
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 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.
Arguments:
- type: Schema type identifier (
lookup_key) to filter by. Only objects of this type are returned. - 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.
- 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.
376 def create(self, input: CustomObjectCreateInput) -> CustomObject: 377 """ 378 Create a custom object 379 Creates a new custom object of the given schema type and returns the 380 persisted object. The caller must be authenticated and authorized to create 381 objects of the specified type. 382 Owner resolution follows a priority order: if `team` is supplied the object 383 is team-owned; if `user` is supplied it is owned by that user; if `agent` is 384 supplied it is agent-owned; otherwise the object is owned by the authenticated 385 user. Pass `system: true` explicitly to force system ownership this requires 386 elevated API credentials and returns 403 if the caller lacks permission. 387 If the schema declares a `row_key` (and optionally a `sort_key`), you may 388 pass `upsert: true` to update an existing object at that key instead of 389 receiving a 409 Conflict. The response status is `200` on an update and 390 `201` on a new create. 391 392 Args: 393 input: Request body. 394 input.agent: Agent user ID to set as the object owner. Used when neither `team` nor `user` is supplied. 395 input.fields: Key-value map of field values for the new object. Must conform to the schema's field definitions. 396 input.org: Organization ID (`org_...`) to associate with the object. Typically required for system-owned objects. 397 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. 398 input.team: Team ID (`team_...`) to set as the object owner. When supplied, takes priority over `user` and `agent`. 399 input.type: Schema type identifier (`lookup_key`) that defines the object's shape and validation rules. 400 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. 401 input.user: User ID (`user_...`) to set as the object owner. Used when neither `team` nor a higher-priority owner is set. 402 403 Returns: 404 The created (or upserted) custom object. 405 """ 406 return self._http.request( 407 "/api/v1/custom_objects", 408 method="POST", 409 body=input, 410 response_type=CustomObject, 411 )
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.
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.agent: Agent user ID to set as the object owner. Used when neither
teamnoruseris supplied. - input.fields: Key-value map of field values for the new object. Must conform to the schema's field definitions.
- input.org: Organization ID (
org_...) to associate with the object. Typically required for system-owned objects. - 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. - 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.
413 def delete(self, object: str) -> CustomObjectDeleteResponse: 414 """ 415 Delete a custom object 416 Permanently deletes the custom object identified by `object`. The caller 417 must be authenticated and have permission to delete the object. 418 On success, returns a confirmation payload containing the deleted object's 419 ID so callers can confirm the deletion without a follow-up fetch. 420 Attempting to delete an object that does not exist or has already been 421 deleted returns 404. 422 423 Args: 424 object: Custom object ID (`cobj_...`) of the object to delete. 425 426 Returns: 427 Successful response 428 """ 429 return self._http.request( 430 f"/api/v1/custom_objects/{object}", 431 method="DELETE", 432 response_type=CustomObjectDeleteResponse, 433 )
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
435 def get(self, object: str, *, type: str | None = None) -> CustomObject: 436 """ 437 Retrieve a custom object 438 Returns a single custom object identified by its ID. The authenticated viewer 439 must have visibility access to the object. 440 Returns 404 if the object does not exist, has been deleted, or is not 441 visible to the viewer. 442 443 Args: 444 object: Custom object ID (`cobj_...`) to retrieve. 445 type: Schema type identifier (`lookup_key`) of the object. Optional; used for routing context only. 446 447 Returns: 448 The requested custom object. 449 """ 450 query: dict[str, object] = {} 451 if type is not None: 452 query["type"] = type 453 return self._http.request( 454 f"/api/v1/custom_objects/{object}", 455 query=query, 456 response_type=CustomObject, 457 )
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.
459 def replace(self, object: str, input: CustomObjectReplaceInput) -> CustomObjectReplaceResponse: 460 """ 461 Update a custom object 462 Updates the fields of an existing custom object and returns the updated 463 object along with its new version number. The authenticated viewer must have 464 permission to modify the object. 465 You may supply `fields` (a full or partial key-value map to merge into the 466 object), `field_ops` (granular array operations per field), or both but 467 the same field name must not appear in both, which returns 422. Returns 404 468 if the object does not exist or has been deleted. 469 470 Args: 471 object: Custom object ID (`cobj_...`) to update. 472 input: Request body. 473 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`. 474 input.fields: Key-value map of field values to merge into the object. Only the supplied keys are affected. 475 input.type: Schema type identifier (`lookup_key`) of the object. Optional; used for routing context only. 476 477 Returns: 478 Successful response 479 """ 480 return self._http.request( 481 f"/api/v1/custom_objects/{object}", 482 method="PUT", 483 body=input, 484 response_type=CustomObjectReplaceResponse, 485 )
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), or both but
the same field name must not appear in both, 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.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