archastro.platform.v1.resources.kv
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: c7ca581aeeaa 4 5from __future__ import annotations 6 7from typing import Required, TypedDict 8 9from pydantic import BaseModel, Field 10 11from ...runtime.http_client import HttpClient, SyncHttpClient 12from ...types.common import KeyValueStorageEntry, KeyValueStorageEntryPage 13 14 15class KvCreateInput(TypedDict, total=False): 16 "Create a key-value storage entry" 17 18 agent: str | None 19 "Agent owner ID." 20 key: Required[str] 21 "Storage key for the entry. Must be a non-empty string unique to this user." 22 org: str | None 23 "Organization scope for the owner." 24 system: bool | None 25 "Select system ownership within the app or organization." 26 team: str | None 27 "Team owner ID." 28 ttl_seconds: int | None 29 "Positive lifetime in seconds; omitted means no expiry." 30 user: str | None 31 "User owner ID. Elevated callers may instead select team, agent, org, or system ownership." 32 value: Required[str] 33 "Value to store under `key`. Must be a non-empty string." 34 35 36class KvUpsertInput(TypedDict, total=False): 37 "Create or update a key-value storage entry" 38 39 agent: str | None 40 "Agent owner ID." 41 org: str | None 42 "Organization scope for the owner." 43 system: bool | None 44 "Select system ownership within the app or organization." 45 team: str | None 46 "Team owner ID." 47 ttl_seconds: int | None 48 "Positive lifetime in seconds; omitted means no expiry." 49 user: str | None 50 "User owner ID. Elevated callers may instead select team, agent, org, or system ownership." 51 value: Required[str] 52 "New value to store under `key`. Must be a non-empty string. Replaces any existing value." 53 54 55class KvDeleteResponse(BaseModel): 56 """ 57 Successful response 58 """ 59 60 deleted: bool = Field(..., description="Always `true` when the deletion succeeds.") 61 key: str = Field(..., description="Storage key of the deleted entry.") 62 63 64class AsyncKvResource: 65 def __init__(self, http: HttpClient): 66 self._http = http 67 68 async def list( 69 self, 70 *, 71 org: str | None = None, 72 team: str | None = None, 73 agent: str | None = None, 74 system: bool | None = None, 75 page: int | None = None, 76 page_size: int | None = None, 77 user: str | None = None, 78 user_search: str | None = None, 79 key: str | None = None, 80 ) -> KeyValueStorageEntryPage: 81 """ 82 List key-value storage entries 83 Returns key-value storage entries in one of two modes depending on the caller's 84 auth scope. 85 **User-JWT callers** receive a flat list of all their own entries with no 86 pagination fields. The `page`, `page_size`, `user`, `user_search`, and `key` 87 params are ignored. 88 **Developer and server-to-server callers** receive a page-based paginated 89 response across all users within the caller's app. Use `user` to scope results 90 to a single user, `user_search` to do a substring match on email or full name, 91 and `key` to filter entries whose key starts with the given prefix. Results are 92 ordered by update time descending. Supplying org, team, agent, or system selects 93 a single owner's flat list instead. Expired entries are excluded in every mode. 94 95 Args: 96 org: Organization scope for the owner. 97 team: Team owner ID. 98 agent: Agent owner ID. 99 system: Select system ownership within the app or organization. 100 page: Page number to retrieve. Applies to developer and server-to-server callers only. Defaults to 1. 101 page_size: Number of entries per page. Applies to developer and server-to-server callers only. Defaults to 25; maximum is 100. 102 user: Filter results to entries belonging to this user ID. Applies to developer and server-to-server callers only. 103 user_search: Substring match against user email address and full name. Applies to developer and server-to-server callers only. 104 key: Prefix filter on the storage key. Returns only entries whose key starts with this string. Applies to developer and server-to-server callers only. 105 106 Returns: 107 Key-value storage entries for the current page, with pagination metadata for developer and server-to-server callers. 108 """ 109 query: dict[str, object] = {} 110 if org is not None: 111 query["org"] = org 112 if team is not None: 113 query["team"] = team 114 if agent is not None: 115 query["agent"] = agent 116 if system is not None: 117 query["system"] = system 118 if page is not None: 119 query["page"] = page 120 if page_size is not None: 121 query["page_size"] = page_size 122 if user is not None: 123 query["user"] = user 124 if user_search is not None: 125 query["user_search"] = user_search 126 if key is not None: 127 query["key"] = key 128 return await self._http.request( 129 "/api/v1/kv", 130 query=query, 131 response_type=KeyValueStorageEntryPage, 132 ) 133 134 async def create(self, input: KvCreateInput) -> KeyValueStorageEntry: 135 """ 136 Create a key-value storage entry 137 Creates a key once per owner. An existing key returns HTTP 409 conflict, including expired rows awaiting sweep. 138 User-JWT callers use their own storage. Elevated callers select an owner with 139 system: true, team, user, or agent (in that priority order). An org alone selects 140 system ownership within that organization; all owners must be in the app scope. 141 Create and upsert accept a positive ttl_seconds; absent means no expiry. 142 Script binding (`kv.create`): the entry is owned by the triggering 143 automation's owner; scripts pass no owner params. A duplicate key 144 returns a script Err with code "conflict" instead of raising. 145 146 Args: 147 input: Request body. 148 input.agent: Agent owner ID. 149 input.key: Storage key for the entry. Must be a non-empty string unique to this user. 150 input.org: Organization scope for the owner. 151 input.system: Select system ownership within the app or organization. 152 input.team: Team owner ID. 153 input.ttl_seconds: Positive lifetime in seconds; omitted means no expiry. 154 input.user: User owner ID. Elevated callers may instead select team, agent, org, or system ownership. 155 input.value: Value to store under `key`. Must be a non-empty string. 156 157 Returns: 158 The newly created key-value storage entry. 159 """ 160 return await self._http.request( 161 "/api/v1/kv", 162 method="POST", 163 body=input, 164 response_type=KeyValueStorageEntry, 165 ) 166 167 async def delete(self, key: str) -> KvDeleteResponse: 168 """ 169 Delete a key-value storage entry 170 Deletes an unexpired entry by owner and key. Returns 204, or 404 when absent. 171 User-JWT callers use their own storage. Elevated callers select an owner with 172 system: true, team, user, or agent (in that priority order). An org alone selects 173 system ownership within that organization; all owners must be in the app scope. 174 Create and upsert accept a positive ttl_seconds; absent means no expiry. 175 Script binding (`kv.delete`): removes the entry owned by the triggering 176 automation's owner; scripts pass no owner params. 177 178 Args: 179 key: Storage key of the entry to delete. Must be a non-empty string. 180 181 Returns: 182 Successful response 183 """ 184 return await self._http.request( 185 f"/api/v1/kv/{key}", 186 method="DELETE", 187 response_type=KvDeleteResponse, 188 ) 189 190 async def get( 191 self, 192 key: str, 193 *, 194 org: str | None = None, 195 team: str | None = None, 196 agent: str | None = None, 197 system: bool | None = None, 198 user: str | None = None, 199 ) -> KeyValueStorageEntry: 200 """ 201 Retrieve a key-value storage entry 202 Returns an unexpired entry by owner and key, or 404. 203 User-JWT callers use their own storage. Elevated callers select an owner with 204 system: true, team, user, or agent (in that priority order). An org alone selects 205 system ownership within that organization; all owners must be in the app scope. 206 Create and upsert accept a positive ttl_seconds; absent means no expiry. 207 Script binding (`kv.get`): reads the entry owned by the triggering 208 automation's owner; scripts pass no owner params. 209 210 Args: 211 key: Storage key of the entry to retrieve. Must be a non-empty string. 212 org: Organization scope for the owner. 213 team: Team owner ID. 214 agent: Agent owner ID. 215 system: Select system ownership within the app or organization. 216 user: User owner ID. Elevated callers may instead select team, agent, org, or system ownership. 217 218 Returns: 219 The key-value storage entry for the given key. 220 """ 221 query: dict[str, object] = {} 222 if org is not None: 223 query["org"] = org 224 if team is not None: 225 query["team"] = team 226 if agent is not None: 227 query["agent"] = agent 228 if system is not None: 229 query["system"] = system 230 if user is not None: 231 query["user"] = user 232 return await self._http.request( 233 f"/api/v1/kv/{key}", 234 query=query, 235 response_type=KeyValueStorageEntry, 236 ) 237 238 async def upsert(self, key: str, input: KvUpsertInput) -> KeyValueStorageEntry: 239 """ 240 Create or update a key-value storage entry 241 Creates or replaces a value and its expiry. Omitted ttl_seconds clears any previous expiry. 242 User-JWT callers use their own storage. Elevated callers select an owner with 243 system: true, team, user, or agent (in that priority order). An org alone selects 244 system ownership within that organization; all owners must be in the app scope. 245 Create and upsert accept a positive ttl_seconds; absent means no expiry. 246 Script binding (`kv.upsert`): overwrites the entry owned by the triggering 247 automation's owner; scripts pass no owner params. 248 249 Args: 250 key: Storage key to create or overwrite. Must be a non-empty string. 251 input: Request body. 252 input.agent: Agent owner ID. 253 input.org: Organization scope for the owner. 254 input.system: Select system ownership within the app or organization. 255 input.team: Team owner ID. 256 input.ttl_seconds: Positive lifetime in seconds; omitted means no expiry. 257 input.user: User owner ID. Elevated callers may instead select team, agent, org, or system ownership. 258 input.value: New value to store under `key`. Must be a non-empty string. Replaces any existing value. 259 260 Returns: 261 The created or updated key-value storage entry. 262 """ 263 return await self._http.request( 264 f"/api/v1/kv/{key}", 265 method="PUT", 266 body=input, 267 response_type=KeyValueStorageEntry, 268 ) 269 270 271class KvResource: 272 def __init__(self, http: SyncHttpClient): 273 self._http = http 274 275 def list( 276 self, 277 *, 278 org: str | None = None, 279 team: str | None = None, 280 agent: str | None = None, 281 system: bool | None = None, 282 page: int | None = None, 283 page_size: int | None = None, 284 user: str | None = None, 285 user_search: str | None = None, 286 key: str | None = None, 287 ) -> KeyValueStorageEntryPage: 288 """ 289 List key-value storage entries 290 Returns key-value storage entries in one of two modes depending on the caller's 291 auth scope. 292 **User-JWT callers** receive a flat list of all their own entries with no 293 pagination fields. The `page`, `page_size`, `user`, `user_search`, and `key` 294 params are ignored. 295 **Developer and server-to-server callers** receive a page-based paginated 296 response across all users within the caller's app. Use `user` to scope results 297 to a single user, `user_search` to do a substring match on email or full name, 298 and `key` to filter entries whose key starts with the given prefix. Results are 299 ordered by update time descending. Supplying org, team, agent, or system selects 300 a single owner's flat list instead. Expired entries are excluded in every mode. 301 302 Args: 303 org: Organization scope for the owner. 304 team: Team owner ID. 305 agent: Agent owner ID. 306 system: Select system ownership within the app or organization. 307 page: Page number to retrieve. Applies to developer and server-to-server callers only. Defaults to 1. 308 page_size: Number of entries per page. Applies to developer and server-to-server callers only. Defaults to 25; maximum is 100. 309 user: Filter results to entries belonging to this user ID. Applies to developer and server-to-server callers only. 310 user_search: Substring match against user email address and full name. Applies to developer and server-to-server callers only. 311 key: Prefix filter on the storage key. Returns only entries whose key starts with this string. Applies to developer and server-to-server callers only. 312 313 Returns: 314 Key-value storage entries for the current page, with pagination metadata for developer and server-to-server callers. 315 """ 316 query: dict[str, object] = {} 317 if org is not None: 318 query["org"] = org 319 if team is not None: 320 query["team"] = team 321 if agent is not None: 322 query["agent"] = agent 323 if system is not None: 324 query["system"] = system 325 if page is not None: 326 query["page"] = page 327 if page_size is not None: 328 query["page_size"] = page_size 329 if user is not None: 330 query["user"] = user 331 if user_search is not None: 332 query["user_search"] = user_search 333 if key is not None: 334 query["key"] = key 335 return self._http.request( 336 "/api/v1/kv", 337 query=query, 338 response_type=KeyValueStorageEntryPage, 339 ) 340 341 def create(self, input: KvCreateInput) -> KeyValueStorageEntry: 342 """ 343 Create a key-value storage entry 344 Creates a key once per owner. An existing key returns HTTP 409 conflict, including expired rows awaiting sweep. 345 User-JWT callers use their own storage. Elevated callers select an owner with 346 system: true, team, user, or agent (in that priority order). An org alone selects 347 system ownership within that organization; all owners must be in the app scope. 348 Create and upsert accept a positive ttl_seconds; absent means no expiry. 349 Script binding (`kv.create`): the entry is owned by the triggering 350 automation's owner; scripts pass no owner params. A duplicate key 351 returns a script Err with code "conflict" instead of raising. 352 353 Args: 354 input: Request body. 355 input.agent: Agent owner ID. 356 input.key: Storage key for the entry. Must be a non-empty string unique to this user. 357 input.org: Organization scope for the owner. 358 input.system: Select system ownership within the app or organization. 359 input.team: Team owner ID. 360 input.ttl_seconds: Positive lifetime in seconds; omitted means no expiry. 361 input.user: User owner ID. Elevated callers may instead select team, agent, org, or system ownership. 362 input.value: Value to store under `key`. Must be a non-empty string. 363 364 Returns: 365 The newly created key-value storage entry. 366 """ 367 return self._http.request( 368 "/api/v1/kv", 369 method="POST", 370 body=input, 371 response_type=KeyValueStorageEntry, 372 ) 373 374 def delete(self, key: str) -> KvDeleteResponse: 375 """ 376 Delete a key-value storage entry 377 Deletes an unexpired entry by owner and key. Returns 204, or 404 when absent. 378 User-JWT callers use their own storage. Elevated callers select an owner with 379 system: true, team, user, or agent (in that priority order). An org alone selects 380 system ownership within that organization; all owners must be in the app scope. 381 Create and upsert accept a positive ttl_seconds; absent means no expiry. 382 Script binding (`kv.delete`): removes the entry owned by the triggering 383 automation's owner; scripts pass no owner params. 384 385 Args: 386 key: Storage key of the entry to delete. Must be a non-empty string. 387 388 Returns: 389 Successful response 390 """ 391 return self._http.request( 392 f"/api/v1/kv/{key}", 393 method="DELETE", 394 response_type=KvDeleteResponse, 395 ) 396 397 def get( 398 self, 399 key: str, 400 *, 401 org: str | None = None, 402 team: str | None = None, 403 agent: str | None = None, 404 system: bool | None = None, 405 user: str | None = None, 406 ) -> KeyValueStorageEntry: 407 """ 408 Retrieve a key-value storage entry 409 Returns an unexpired entry by owner and key, or 404. 410 User-JWT callers use their own storage. Elevated callers select an owner with 411 system: true, team, user, or agent (in that priority order). An org alone selects 412 system ownership within that organization; all owners must be in the app scope. 413 Create and upsert accept a positive ttl_seconds; absent means no expiry. 414 Script binding (`kv.get`): reads the entry owned by the triggering 415 automation's owner; scripts pass no owner params. 416 417 Args: 418 key: Storage key of the entry to retrieve. Must be a non-empty string. 419 org: Organization scope for the owner. 420 team: Team owner ID. 421 agent: Agent owner ID. 422 system: Select system ownership within the app or organization. 423 user: User owner ID. Elevated callers may instead select team, agent, org, or system ownership. 424 425 Returns: 426 The key-value storage entry for the given key. 427 """ 428 query: dict[str, object] = {} 429 if org is not None: 430 query["org"] = org 431 if team is not None: 432 query["team"] = team 433 if agent is not None: 434 query["agent"] = agent 435 if system is not None: 436 query["system"] = system 437 if user is not None: 438 query["user"] = user 439 return self._http.request( 440 f"/api/v1/kv/{key}", 441 query=query, 442 response_type=KeyValueStorageEntry, 443 ) 444 445 def upsert(self, key: str, input: KvUpsertInput) -> KeyValueStorageEntry: 446 """ 447 Create or update a key-value storage entry 448 Creates or replaces a value and its expiry. Omitted ttl_seconds clears any previous expiry. 449 User-JWT callers use their own storage. Elevated callers select an owner with 450 system: true, team, user, or agent (in that priority order). An org alone selects 451 system ownership within that organization; all owners must be in the app scope. 452 Create and upsert accept a positive ttl_seconds; absent means no expiry. 453 Script binding (`kv.upsert`): overwrites the entry owned by the triggering 454 automation's owner; scripts pass no owner params. 455 456 Args: 457 key: Storage key to create or overwrite. Must be a non-empty string. 458 input: Request body. 459 input.agent: Agent owner ID. 460 input.org: Organization scope for the owner. 461 input.system: Select system ownership within the app or organization. 462 input.team: Team owner ID. 463 input.ttl_seconds: Positive lifetime in seconds; omitted means no expiry. 464 input.user: User owner ID. Elevated callers may instead select team, agent, org, or system ownership. 465 input.value: New value to store under `key`. Must be a non-empty string. Replaces any existing value. 466 467 Returns: 468 The created or updated key-value storage entry. 469 """ 470 return self._http.request( 471 f"/api/v1/kv/{key}", 472 method="PUT", 473 body=input, 474 response_type=KeyValueStorageEntry, 475 )
16class KvCreateInput(TypedDict, total=False): 17 "Create a key-value storage entry" 18 19 agent: str | None 20 "Agent owner ID." 21 key: Required[str] 22 "Storage key for the entry. Must be a non-empty string unique to this user." 23 org: str | None 24 "Organization scope for the owner." 25 system: bool | None 26 "Select system ownership within the app or organization." 27 team: str | None 28 "Team owner ID." 29 ttl_seconds: int | None 30 "Positive lifetime in seconds; omitted means no expiry." 31 user: str | None 32 "User owner ID. Elevated callers may instead select team, agent, org, or system ownership." 33 value: Required[str] 34 "Value to store under `key`. Must be a non-empty string."
Create a key-value storage entry
37class KvUpsertInput(TypedDict, total=False): 38 "Create or update a key-value storage entry" 39 40 agent: str | None 41 "Agent owner ID." 42 org: str | None 43 "Organization scope for the owner." 44 system: bool | None 45 "Select system ownership within the app or organization." 46 team: str | None 47 "Team owner ID." 48 ttl_seconds: int | None 49 "Positive lifetime in seconds; omitted means no expiry." 50 user: str | None 51 "User owner ID. Elevated callers may instead select team, agent, org, or system ownership." 52 value: Required[str] 53 "New value to store under `key`. Must be a non-empty string. Replaces any existing value."
Create or update a key-value storage entry
56class KvDeleteResponse(BaseModel): 57 """ 58 Successful response 59 """ 60 61 deleted: bool = Field(..., description="Always `true` when the deletion succeeds.") 62 key: str = Field(..., description="Storage key of the deleted entry.")
Successful response
65class AsyncKvResource: 66 def __init__(self, http: HttpClient): 67 self._http = http 68 69 async def list( 70 self, 71 *, 72 org: str | None = None, 73 team: str | None = None, 74 agent: str | None = None, 75 system: bool | None = None, 76 page: int | None = None, 77 page_size: int | None = None, 78 user: str | None = None, 79 user_search: str | None = None, 80 key: str | None = None, 81 ) -> KeyValueStorageEntryPage: 82 """ 83 List key-value storage entries 84 Returns key-value storage entries in one of two modes depending on the caller's 85 auth scope. 86 **User-JWT callers** receive a flat list of all their own entries with no 87 pagination fields. The `page`, `page_size`, `user`, `user_search`, and `key` 88 params are ignored. 89 **Developer and server-to-server callers** receive a page-based paginated 90 response across all users within the caller's app. Use `user` to scope results 91 to a single user, `user_search` to do a substring match on email or full name, 92 and `key` to filter entries whose key starts with the given prefix. Results are 93 ordered by update time descending. Supplying org, team, agent, or system selects 94 a single owner's flat list instead. Expired entries are excluded in every mode. 95 96 Args: 97 org: Organization scope for the owner. 98 team: Team owner ID. 99 agent: Agent owner ID. 100 system: Select system ownership within the app or organization. 101 page: Page number to retrieve. Applies to developer and server-to-server callers only. Defaults to 1. 102 page_size: Number of entries per page. Applies to developer and server-to-server callers only. Defaults to 25; maximum is 100. 103 user: Filter results to entries belonging to this user ID. Applies to developer and server-to-server callers only. 104 user_search: Substring match against user email address and full name. Applies to developer and server-to-server callers only. 105 key: Prefix filter on the storage key. Returns only entries whose key starts with this string. Applies to developer and server-to-server callers only. 106 107 Returns: 108 Key-value storage entries for the current page, with pagination metadata for developer and server-to-server callers. 109 """ 110 query: dict[str, object] = {} 111 if org is not None: 112 query["org"] = org 113 if team is not None: 114 query["team"] = team 115 if agent is not None: 116 query["agent"] = agent 117 if system is not None: 118 query["system"] = system 119 if page is not None: 120 query["page"] = page 121 if page_size is not None: 122 query["page_size"] = page_size 123 if user is not None: 124 query["user"] = user 125 if user_search is not None: 126 query["user_search"] = user_search 127 if key is not None: 128 query["key"] = key 129 return await self._http.request( 130 "/api/v1/kv", 131 query=query, 132 response_type=KeyValueStorageEntryPage, 133 ) 134 135 async def create(self, input: KvCreateInput) -> KeyValueStorageEntry: 136 """ 137 Create a key-value storage entry 138 Creates a key once per owner. An existing key returns HTTP 409 conflict, including expired rows awaiting sweep. 139 User-JWT callers use their own storage. Elevated callers select an owner with 140 system: true, team, user, or agent (in that priority order). An org alone selects 141 system ownership within that organization; all owners must be in the app scope. 142 Create and upsert accept a positive ttl_seconds; absent means no expiry. 143 Script binding (`kv.create`): the entry is owned by the triggering 144 automation's owner; scripts pass no owner params. A duplicate key 145 returns a script Err with code "conflict" instead of raising. 146 147 Args: 148 input: Request body. 149 input.agent: Agent owner ID. 150 input.key: Storage key for the entry. Must be a non-empty string unique to this user. 151 input.org: Organization scope for the owner. 152 input.system: Select system ownership within the app or organization. 153 input.team: Team owner ID. 154 input.ttl_seconds: Positive lifetime in seconds; omitted means no expiry. 155 input.user: User owner ID. Elevated callers may instead select team, agent, org, or system ownership. 156 input.value: Value to store under `key`. Must be a non-empty string. 157 158 Returns: 159 The newly created key-value storage entry. 160 """ 161 return await self._http.request( 162 "/api/v1/kv", 163 method="POST", 164 body=input, 165 response_type=KeyValueStorageEntry, 166 ) 167 168 async def delete(self, key: str) -> KvDeleteResponse: 169 """ 170 Delete a key-value storage entry 171 Deletes an unexpired entry by owner and key. Returns 204, or 404 when absent. 172 User-JWT callers use their own storage. Elevated callers select an owner with 173 system: true, team, user, or agent (in that priority order). An org alone selects 174 system ownership within that organization; all owners must be in the app scope. 175 Create and upsert accept a positive ttl_seconds; absent means no expiry. 176 Script binding (`kv.delete`): removes the entry owned by the triggering 177 automation's owner; scripts pass no owner params. 178 179 Args: 180 key: Storage key of the entry to delete. Must be a non-empty string. 181 182 Returns: 183 Successful response 184 """ 185 return await self._http.request( 186 f"/api/v1/kv/{key}", 187 method="DELETE", 188 response_type=KvDeleteResponse, 189 ) 190 191 async def get( 192 self, 193 key: str, 194 *, 195 org: str | None = None, 196 team: str | None = None, 197 agent: str | None = None, 198 system: bool | None = None, 199 user: str | None = None, 200 ) -> KeyValueStorageEntry: 201 """ 202 Retrieve a key-value storage entry 203 Returns an unexpired entry by owner and key, or 404. 204 User-JWT callers use their own storage. Elevated callers select an owner with 205 system: true, team, user, or agent (in that priority order). An org alone selects 206 system ownership within that organization; all owners must be in the app scope. 207 Create and upsert accept a positive ttl_seconds; absent means no expiry. 208 Script binding (`kv.get`): reads the entry owned by the triggering 209 automation's owner; scripts pass no owner params. 210 211 Args: 212 key: Storage key of the entry to retrieve. Must be a non-empty string. 213 org: Organization scope for the owner. 214 team: Team owner ID. 215 agent: Agent owner ID. 216 system: Select system ownership within the app or organization. 217 user: User owner ID. Elevated callers may instead select team, agent, org, or system ownership. 218 219 Returns: 220 The key-value storage entry for the given key. 221 """ 222 query: dict[str, object] = {} 223 if org is not None: 224 query["org"] = org 225 if team is not None: 226 query["team"] = team 227 if agent is not None: 228 query["agent"] = agent 229 if system is not None: 230 query["system"] = system 231 if user is not None: 232 query["user"] = user 233 return await self._http.request( 234 f"/api/v1/kv/{key}", 235 query=query, 236 response_type=KeyValueStorageEntry, 237 ) 238 239 async def upsert(self, key: str, input: KvUpsertInput) -> KeyValueStorageEntry: 240 """ 241 Create or update a key-value storage entry 242 Creates or replaces a value and its expiry. Omitted ttl_seconds clears any previous expiry. 243 User-JWT callers use their own storage. Elevated callers select an owner with 244 system: true, team, user, or agent (in that priority order). An org alone selects 245 system ownership within that organization; all owners must be in the app scope. 246 Create and upsert accept a positive ttl_seconds; absent means no expiry. 247 Script binding (`kv.upsert`): overwrites the entry owned by the triggering 248 automation's owner; scripts pass no owner params. 249 250 Args: 251 key: Storage key to create or overwrite. Must be a non-empty string. 252 input: Request body. 253 input.agent: Agent owner ID. 254 input.org: Organization scope for the owner. 255 input.system: Select system ownership within the app or organization. 256 input.team: Team owner ID. 257 input.ttl_seconds: Positive lifetime in seconds; omitted means no expiry. 258 input.user: User owner ID. Elevated callers may instead select team, agent, org, or system ownership. 259 input.value: New value to store under `key`. Must be a non-empty string. Replaces any existing value. 260 261 Returns: 262 The created or updated key-value storage entry. 263 """ 264 return await self._http.request( 265 f"/api/v1/kv/{key}", 266 method="PUT", 267 body=input, 268 response_type=KeyValueStorageEntry, 269 )
69 async def list( 70 self, 71 *, 72 org: str | None = None, 73 team: str | None = None, 74 agent: str | None = None, 75 system: bool | None = None, 76 page: int | None = None, 77 page_size: int | None = None, 78 user: str | None = None, 79 user_search: str | None = None, 80 key: str | None = None, 81 ) -> KeyValueStorageEntryPage: 82 """ 83 List key-value storage entries 84 Returns key-value storage entries in one of two modes depending on the caller's 85 auth scope. 86 **User-JWT callers** receive a flat list of all their own entries with no 87 pagination fields. The `page`, `page_size`, `user`, `user_search`, and `key` 88 params are ignored. 89 **Developer and server-to-server callers** receive a page-based paginated 90 response across all users within the caller's app. Use `user` to scope results 91 to a single user, `user_search` to do a substring match on email or full name, 92 and `key` to filter entries whose key starts with the given prefix. Results are 93 ordered by update time descending. Supplying org, team, agent, or system selects 94 a single owner's flat list instead. Expired entries are excluded in every mode. 95 96 Args: 97 org: Organization scope for the owner. 98 team: Team owner ID. 99 agent: Agent owner ID. 100 system: Select system ownership within the app or organization. 101 page: Page number to retrieve. Applies to developer and server-to-server callers only. Defaults to 1. 102 page_size: Number of entries per page. Applies to developer and server-to-server callers only. Defaults to 25; maximum is 100. 103 user: Filter results to entries belonging to this user ID. Applies to developer and server-to-server callers only. 104 user_search: Substring match against user email address and full name. Applies to developer and server-to-server callers only. 105 key: Prefix filter on the storage key. Returns only entries whose key starts with this string. Applies to developer and server-to-server callers only. 106 107 Returns: 108 Key-value storage entries for the current page, with pagination metadata for developer and server-to-server callers. 109 """ 110 query: dict[str, object] = {} 111 if org is not None: 112 query["org"] = org 113 if team is not None: 114 query["team"] = team 115 if agent is not None: 116 query["agent"] = agent 117 if system is not None: 118 query["system"] = system 119 if page is not None: 120 query["page"] = page 121 if page_size is not None: 122 query["page_size"] = page_size 123 if user is not None: 124 query["user"] = user 125 if user_search is not None: 126 query["user_search"] = user_search 127 if key is not None: 128 query["key"] = key 129 return await self._http.request( 130 "/api/v1/kv", 131 query=query, 132 response_type=KeyValueStorageEntryPage, 133 )
List key-value storage entries
Returns key-value storage entries in one of two modes depending on the caller's
auth scope.
User-JWT callers receive a flat list of all their own entries with no
pagination fields. The page, page_size, user, user_search, and key
params are ignored.
Developer and server-to-server callers receive a page-based paginated
response across all users within the caller's app. Use user to scope results
to a single user, user_search to do a substring match on email or full name,
and key to filter entries whose key starts with the given prefix. Results are
ordered by update time descending. Supplying org, team, agent, or system selects
a single owner's flat list instead. Expired entries are excluded in every mode.
Arguments:
- org: Organization scope for the owner.
- team: Team owner ID.
- agent: Agent owner ID.
- system: Select system ownership within the app or organization.
- page: Page number to retrieve. Applies to developer and server-to-server callers only. Defaults to 1.
- page_size: Number of entries per page. Applies to developer and server-to-server callers only. Defaults to 25; maximum is 100.
- user: Filter results to entries belonging to this user ID. Applies to developer and server-to-server callers only.
- user_search: Substring match against user email address and full name. Applies to developer and server-to-server callers only.
- key: Prefix filter on the storage key. Returns only entries whose key starts with this string. Applies to developer and server-to-server callers only.
Returns:
Key-value storage entries for the current page, with pagination metadata for developer and server-to-server callers.
135 async def create(self, input: KvCreateInput) -> KeyValueStorageEntry: 136 """ 137 Create a key-value storage entry 138 Creates a key once per owner. An existing key returns HTTP 409 conflict, including expired rows awaiting sweep. 139 User-JWT callers use their own storage. Elevated callers select an owner with 140 system: true, team, user, or agent (in that priority order). An org alone selects 141 system ownership within that organization; all owners must be in the app scope. 142 Create and upsert accept a positive ttl_seconds; absent means no expiry. 143 Script binding (`kv.create`): the entry is owned by the triggering 144 automation's owner; scripts pass no owner params. A duplicate key 145 returns a script Err with code "conflict" instead of raising. 146 147 Args: 148 input: Request body. 149 input.agent: Agent owner ID. 150 input.key: Storage key for the entry. Must be a non-empty string unique to this user. 151 input.org: Organization scope for the owner. 152 input.system: Select system ownership within the app or organization. 153 input.team: Team owner ID. 154 input.ttl_seconds: Positive lifetime in seconds; omitted means no expiry. 155 input.user: User owner ID. Elevated callers may instead select team, agent, org, or system ownership. 156 input.value: Value to store under `key`. Must be a non-empty string. 157 158 Returns: 159 The newly created key-value storage entry. 160 """ 161 return await self._http.request( 162 "/api/v1/kv", 163 method="POST", 164 body=input, 165 response_type=KeyValueStorageEntry, 166 )
Create a key-value storage entry
Creates a key once per owner. An existing key returns HTTP 409 conflict, including expired rows awaiting sweep.
User-JWT callers use their own storage. Elevated callers select an owner with
system: true, team, user, or agent (in that priority order). An org alone selects
system ownership within that organization; all owners must be in the app scope.
Create and upsert accept a positive ttl_seconds; absent means no expiry.
Script binding (kv.create): the entry is owned by the triggering
automation's owner; scripts pass no owner params. A duplicate key
returns a script Err with code "conflict" instead of raising.
Arguments:
- input: Request body.
- input.agent: Agent owner ID.
- input.key: Storage key for the entry. Must be a non-empty string unique to this user.
- input.org: Organization scope for the owner.
- input.system: Select system ownership within the app or organization.
- input.team: Team owner ID.
- input.ttl_seconds: Positive lifetime in seconds; omitted means no expiry.
- input.user: User owner ID. Elevated callers may instead select team, agent, org, or system ownership.
- input.value: Value to store under
key. Must be a non-empty string.
Returns:
The newly created key-value storage entry.
168 async def delete(self, key: str) -> KvDeleteResponse: 169 """ 170 Delete a key-value storage entry 171 Deletes an unexpired entry by owner and key. Returns 204, or 404 when absent. 172 User-JWT callers use their own storage. Elevated callers select an owner with 173 system: true, team, user, or agent (in that priority order). An org alone selects 174 system ownership within that organization; all owners must be in the app scope. 175 Create and upsert accept a positive ttl_seconds; absent means no expiry. 176 Script binding (`kv.delete`): removes the entry owned by the triggering 177 automation's owner; scripts pass no owner params. 178 179 Args: 180 key: Storage key of the entry to delete. Must be a non-empty string. 181 182 Returns: 183 Successful response 184 """ 185 return await self._http.request( 186 f"/api/v1/kv/{key}", 187 method="DELETE", 188 response_type=KvDeleteResponse, 189 )
Delete a key-value storage entry
Deletes an unexpired entry by owner and key. Returns 204, or 404 when absent.
User-JWT callers use their own storage. Elevated callers select an owner with
system: true, team, user, or agent (in that priority order). An org alone selects
system ownership within that organization; all owners must be in the app scope.
Create and upsert accept a positive ttl_seconds; absent means no expiry.
Script binding (kv.delete): removes the entry owned by the triggering
automation's owner; scripts pass no owner params.
Arguments:
- key: Storage key of the entry to delete. Must be a non-empty string.
Returns:
Successful response
191 async def get( 192 self, 193 key: str, 194 *, 195 org: str | None = None, 196 team: str | None = None, 197 agent: str | None = None, 198 system: bool | None = None, 199 user: str | None = None, 200 ) -> KeyValueStorageEntry: 201 """ 202 Retrieve a key-value storage entry 203 Returns an unexpired entry by owner and key, or 404. 204 User-JWT callers use their own storage. Elevated callers select an owner with 205 system: true, team, user, or agent (in that priority order). An org alone selects 206 system ownership within that organization; all owners must be in the app scope. 207 Create and upsert accept a positive ttl_seconds; absent means no expiry. 208 Script binding (`kv.get`): reads the entry owned by the triggering 209 automation's owner; scripts pass no owner params. 210 211 Args: 212 key: Storage key of the entry to retrieve. Must be a non-empty string. 213 org: Organization scope for the owner. 214 team: Team owner ID. 215 agent: Agent owner ID. 216 system: Select system ownership within the app or organization. 217 user: User owner ID. Elevated callers may instead select team, agent, org, or system ownership. 218 219 Returns: 220 The key-value storage entry for the given key. 221 """ 222 query: dict[str, object] = {} 223 if org is not None: 224 query["org"] = org 225 if team is not None: 226 query["team"] = team 227 if agent is not None: 228 query["agent"] = agent 229 if system is not None: 230 query["system"] = system 231 if user is not None: 232 query["user"] = user 233 return await self._http.request( 234 f"/api/v1/kv/{key}", 235 query=query, 236 response_type=KeyValueStorageEntry, 237 )
Retrieve a key-value storage entry
Returns an unexpired entry by owner and key, or 404.
User-JWT callers use their own storage. Elevated callers select an owner with
system: true, team, user, or agent (in that priority order). An org alone selects
system ownership within that organization; all owners must be in the app scope.
Create and upsert accept a positive ttl_seconds; absent means no expiry.
Script binding (kv.get): reads the entry owned by the triggering
automation's owner; scripts pass no owner params.
Arguments:
- key: Storage key of the entry to retrieve. Must be a non-empty string.
- org: Organization scope for the owner.
- team: Team owner ID.
- agent: Agent owner ID.
- system: Select system ownership within the app or organization.
- user: User owner ID. Elevated callers may instead select team, agent, org, or system ownership.
Returns:
The key-value storage entry for the given key.
239 async def upsert(self, key: str, input: KvUpsertInput) -> KeyValueStorageEntry: 240 """ 241 Create or update a key-value storage entry 242 Creates or replaces a value and its expiry. Omitted ttl_seconds clears any previous expiry. 243 User-JWT callers use their own storage. Elevated callers select an owner with 244 system: true, team, user, or agent (in that priority order). An org alone selects 245 system ownership within that organization; all owners must be in the app scope. 246 Create and upsert accept a positive ttl_seconds; absent means no expiry. 247 Script binding (`kv.upsert`): overwrites the entry owned by the triggering 248 automation's owner; scripts pass no owner params. 249 250 Args: 251 key: Storage key to create or overwrite. Must be a non-empty string. 252 input: Request body. 253 input.agent: Agent owner ID. 254 input.org: Organization scope for the owner. 255 input.system: Select system ownership within the app or organization. 256 input.team: Team owner ID. 257 input.ttl_seconds: Positive lifetime in seconds; omitted means no expiry. 258 input.user: User owner ID. Elevated callers may instead select team, agent, org, or system ownership. 259 input.value: New value to store under `key`. Must be a non-empty string. Replaces any existing value. 260 261 Returns: 262 The created or updated key-value storage entry. 263 """ 264 return await self._http.request( 265 f"/api/v1/kv/{key}", 266 method="PUT", 267 body=input, 268 response_type=KeyValueStorageEntry, 269 )
Create or update a key-value storage entry
Creates or replaces a value and its expiry. Omitted ttl_seconds clears any previous expiry.
User-JWT callers use their own storage. Elevated callers select an owner with
system: true, team, user, or agent (in that priority order). An org alone selects
system ownership within that organization; all owners must be in the app scope.
Create and upsert accept a positive ttl_seconds; absent means no expiry.
Script binding (kv.upsert): overwrites the entry owned by the triggering
automation's owner; scripts pass no owner params.
Arguments:
- key: Storage key to create or overwrite. Must be a non-empty string.
- input: Request body.
- input.agent: Agent owner ID.
- input.org: Organization scope for the owner.
- input.system: Select system ownership within the app or organization.
- input.team: Team owner ID.
- input.ttl_seconds: Positive lifetime in seconds; omitted means no expiry.
- input.user: User owner ID. Elevated callers may instead select team, agent, org, or system ownership.
- input.value: New value to store under
key. Must be a non-empty string. Replaces any existing value.
Returns:
The created or updated key-value storage entry.
272class KvResource: 273 def __init__(self, http: SyncHttpClient): 274 self._http = http 275 276 def list( 277 self, 278 *, 279 org: str | None = None, 280 team: str | None = None, 281 agent: str | None = None, 282 system: bool | None = None, 283 page: int | None = None, 284 page_size: int | None = None, 285 user: str | None = None, 286 user_search: str | None = None, 287 key: str | None = None, 288 ) -> KeyValueStorageEntryPage: 289 """ 290 List key-value storage entries 291 Returns key-value storage entries in one of two modes depending on the caller's 292 auth scope. 293 **User-JWT callers** receive a flat list of all their own entries with no 294 pagination fields. The `page`, `page_size`, `user`, `user_search`, and `key` 295 params are ignored. 296 **Developer and server-to-server callers** receive a page-based paginated 297 response across all users within the caller's app. Use `user` to scope results 298 to a single user, `user_search` to do a substring match on email or full name, 299 and `key` to filter entries whose key starts with the given prefix. Results are 300 ordered by update time descending. Supplying org, team, agent, or system selects 301 a single owner's flat list instead. Expired entries are excluded in every mode. 302 303 Args: 304 org: Organization scope for the owner. 305 team: Team owner ID. 306 agent: Agent owner ID. 307 system: Select system ownership within the app or organization. 308 page: Page number to retrieve. Applies to developer and server-to-server callers only. Defaults to 1. 309 page_size: Number of entries per page. Applies to developer and server-to-server callers only. Defaults to 25; maximum is 100. 310 user: Filter results to entries belonging to this user ID. Applies to developer and server-to-server callers only. 311 user_search: Substring match against user email address and full name. Applies to developer and server-to-server callers only. 312 key: Prefix filter on the storage key. Returns only entries whose key starts with this string. Applies to developer and server-to-server callers only. 313 314 Returns: 315 Key-value storage entries for the current page, with pagination metadata for developer and server-to-server callers. 316 """ 317 query: dict[str, object] = {} 318 if org is not None: 319 query["org"] = org 320 if team is not None: 321 query["team"] = team 322 if agent is not None: 323 query["agent"] = agent 324 if system is not None: 325 query["system"] = system 326 if page is not None: 327 query["page"] = page 328 if page_size is not None: 329 query["page_size"] = page_size 330 if user is not None: 331 query["user"] = user 332 if user_search is not None: 333 query["user_search"] = user_search 334 if key is not None: 335 query["key"] = key 336 return self._http.request( 337 "/api/v1/kv", 338 query=query, 339 response_type=KeyValueStorageEntryPage, 340 ) 341 342 def create(self, input: KvCreateInput) -> KeyValueStorageEntry: 343 """ 344 Create a key-value storage entry 345 Creates a key once per owner. An existing key returns HTTP 409 conflict, including expired rows awaiting sweep. 346 User-JWT callers use their own storage. Elevated callers select an owner with 347 system: true, team, user, or agent (in that priority order). An org alone selects 348 system ownership within that organization; all owners must be in the app scope. 349 Create and upsert accept a positive ttl_seconds; absent means no expiry. 350 Script binding (`kv.create`): the entry is owned by the triggering 351 automation's owner; scripts pass no owner params. A duplicate key 352 returns a script Err with code "conflict" instead of raising. 353 354 Args: 355 input: Request body. 356 input.agent: Agent owner ID. 357 input.key: Storage key for the entry. Must be a non-empty string unique to this user. 358 input.org: Organization scope for the owner. 359 input.system: Select system ownership within the app or organization. 360 input.team: Team owner ID. 361 input.ttl_seconds: Positive lifetime in seconds; omitted means no expiry. 362 input.user: User owner ID. Elevated callers may instead select team, agent, org, or system ownership. 363 input.value: Value to store under `key`. Must be a non-empty string. 364 365 Returns: 366 The newly created key-value storage entry. 367 """ 368 return self._http.request( 369 "/api/v1/kv", 370 method="POST", 371 body=input, 372 response_type=KeyValueStorageEntry, 373 ) 374 375 def delete(self, key: str) -> KvDeleteResponse: 376 """ 377 Delete a key-value storage entry 378 Deletes an unexpired entry by owner and key. Returns 204, or 404 when absent. 379 User-JWT callers use their own storage. Elevated callers select an owner with 380 system: true, team, user, or agent (in that priority order). An org alone selects 381 system ownership within that organization; all owners must be in the app scope. 382 Create and upsert accept a positive ttl_seconds; absent means no expiry. 383 Script binding (`kv.delete`): removes the entry owned by the triggering 384 automation's owner; scripts pass no owner params. 385 386 Args: 387 key: Storage key of the entry to delete. Must be a non-empty string. 388 389 Returns: 390 Successful response 391 """ 392 return self._http.request( 393 f"/api/v1/kv/{key}", 394 method="DELETE", 395 response_type=KvDeleteResponse, 396 ) 397 398 def get( 399 self, 400 key: str, 401 *, 402 org: str | None = None, 403 team: str | None = None, 404 agent: str | None = None, 405 system: bool | None = None, 406 user: str | None = None, 407 ) -> KeyValueStorageEntry: 408 """ 409 Retrieve a key-value storage entry 410 Returns an unexpired entry by owner and key, or 404. 411 User-JWT callers use their own storage. Elevated callers select an owner with 412 system: true, team, user, or agent (in that priority order). An org alone selects 413 system ownership within that organization; all owners must be in the app scope. 414 Create and upsert accept a positive ttl_seconds; absent means no expiry. 415 Script binding (`kv.get`): reads the entry owned by the triggering 416 automation's owner; scripts pass no owner params. 417 418 Args: 419 key: Storage key of the entry to retrieve. Must be a non-empty string. 420 org: Organization scope for the owner. 421 team: Team owner ID. 422 agent: Agent owner ID. 423 system: Select system ownership within the app or organization. 424 user: User owner ID. Elevated callers may instead select team, agent, org, or system ownership. 425 426 Returns: 427 The key-value storage entry for the given key. 428 """ 429 query: dict[str, object] = {} 430 if org is not None: 431 query["org"] = org 432 if team is not None: 433 query["team"] = team 434 if agent is not None: 435 query["agent"] = agent 436 if system is not None: 437 query["system"] = system 438 if user is not None: 439 query["user"] = user 440 return self._http.request( 441 f"/api/v1/kv/{key}", 442 query=query, 443 response_type=KeyValueStorageEntry, 444 ) 445 446 def upsert(self, key: str, input: KvUpsertInput) -> KeyValueStorageEntry: 447 """ 448 Create or update a key-value storage entry 449 Creates or replaces a value and its expiry. Omitted ttl_seconds clears any previous expiry. 450 User-JWT callers use their own storage. Elevated callers select an owner with 451 system: true, team, user, or agent (in that priority order). An org alone selects 452 system ownership within that organization; all owners must be in the app scope. 453 Create and upsert accept a positive ttl_seconds; absent means no expiry. 454 Script binding (`kv.upsert`): overwrites the entry owned by the triggering 455 automation's owner; scripts pass no owner params. 456 457 Args: 458 key: Storage key to create or overwrite. Must be a non-empty string. 459 input: Request body. 460 input.agent: Agent owner ID. 461 input.org: Organization scope for the owner. 462 input.system: Select system ownership within the app or organization. 463 input.team: Team owner ID. 464 input.ttl_seconds: Positive lifetime in seconds; omitted means no expiry. 465 input.user: User owner ID. Elevated callers may instead select team, agent, org, or system ownership. 466 input.value: New value to store under `key`. Must be a non-empty string. Replaces any existing value. 467 468 Returns: 469 The created or updated key-value storage entry. 470 """ 471 return self._http.request( 472 f"/api/v1/kv/{key}", 473 method="PUT", 474 body=input, 475 response_type=KeyValueStorageEntry, 476 )
276 def list( 277 self, 278 *, 279 org: str | None = None, 280 team: str | None = None, 281 agent: str | None = None, 282 system: bool | None = None, 283 page: int | None = None, 284 page_size: int | None = None, 285 user: str | None = None, 286 user_search: str | None = None, 287 key: str | None = None, 288 ) -> KeyValueStorageEntryPage: 289 """ 290 List key-value storage entries 291 Returns key-value storage entries in one of two modes depending on the caller's 292 auth scope. 293 **User-JWT callers** receive a flat list of all their own entries with no 294 pagination fields. The `page`, `page_size`, `user`, `user_search`, and `key` 295 params are ignored. 296 **Developer and server-to-server callers** receive a page-based paginated 297 response across all users within the caller's app. Use `user` to scope results 298 to a single user, `user_search` to do a substring match on email or full name, 299 and `key` to filter entries whose key starts with the given prefix. Results are 300 ordered by update time descending. Supplying org, team, agent, or system selects 301 a single owner's flat list instead. Expired entries are excluded in every mode. 302 303 Args: 304 org: Organization scope for the owner. 305 team: Team owner ID. 306 agent: Agent owner ID. 307 system: Select system ownership within the app or organization. 308 page: Page number to retrieve. Applies to developer and server-to-server callers only. Defaults to 1. 309 page_size: Number of entries per page. Applies to developer and server-to-server callers only. Defaults to 25; maximum is 100. 310 user: Filter results to entries belonging to this user ID. Applies to developer and server-to-server callers only. 311 user_search: Substring match against user email address and full name. Applies to developer and server-to-server callers only. 312 key: Prefix filter on the storage key. Returns only entries whose key starts with this string. Applies to developer and server-to-server callers only. 313 314 Returns: 315 Key-value storage entries for the current page, with pagination metadata for developer and server-to-server callers. 316 """ 317 query: dict[str, object] = {} 318 if org is not None: 319 query["org"] = org 320 if team is not None: 321 query["team"] = team 322 if agent is not None: 323 query["agent"] = agent 324 if system is not None: 325 query["system"] = system 326 if page is not None: 327 query["page"] = page 328 if page_size is not None: 329 query["page_size"] = page_size 330 if user is not None: 331 query["user"] = user 332 if user_search is not None: 333 query["user_search"] = user_search 334 if key is not None: 335 query["key"] = key 336 return self._http.request( 337 "/api/v1/kv", 338 query=query, 339 response_type=KeyValueStorageEntryPage, 340 )
List key-value storage entries
Returns key-value storage entries in one of two modes depending on the caller's
auth scope.
User-JWT callers receive a flat list of all their own entries with no
pagination fields. The page, page_size, user, user_search, and key
params are ignored.
Developer and server-to-server callers receive a page-based paginated
response across all users within the caller's app. Use user to scope results
to a single user, user_search to do a substring match on email or full name,
and key to filter entries whose key starts with the given prefix. Results are
ordered by update time descending. Supplying org, team, agent, or system selects
a single owner's flat list instead. Expired entries are excluded in every mode.
Arguments:
- org: Organization scope for the owner.
- team: Team owner ID.
- agent: Agent owner ID.
- system: Select system ownership within the app or organization.
- page: Page number to retrieve. Applies to developer and server-to-server callers only. Defaults to 1.
- page_size: Number of entries per page. Applies to developer and server-to-server callers only. Defaults to 25; maximum is 100.
- user: Filter results to entries belonging to this user ID. Applies to developer and server-to-server callers only.
- user_search: Substring match against user email address and full name. Applies to developer and server-to-server callers only.
- key: Prefix filter on the storage key. Returns only entries whose key starts with this string. Applies to developer and server-to-server callers only.
Returns:
Key-value storage entries for the current page, with pagination metadata for developer and server-to-server callers.
342 def create(self, input: KvCreateInput) -> KeyValueStorageEntry: 343 """ 344 Create a key-value storage entry 345 Creates a key once per owner. An existing key returns HTTP 409 conflict, including expired rows awaiting sweep. 346 User-JWT callers use their own storage. Elevated callers select an owner with 347 system: true, team, user, or agent (in that priority order). An org alone selects 348 system ownership within that organization; all owners must be in the app scope. 349 Create and upsert accept a positive ttl_seconds; absent means no expiry. 350 Script binding (`kv.create`): the entry is owned by the triggering 351 automation's owner; scripts pass no owner params. A duplicate key 352 returns a script Err with code "conflict" instead of raising. 353 354 Args: 355 input: Request body. 356 input.agent: Agent owner ID. 357 input.key: Storage key for the entry. Must be a non-empty string unique to this user. 358 input.org: Organization scope for the owner. 359 input.system: Select system ownership within the app or organization. 360 input.team: Team owner ID. 361 input.ttl_seconds: Positive lifetime in seconds; omitted means no expiry. 362 input.user: User owner ID. Elevated callers may instead select team, agent, org, or system ownership. 363 input.value: Value to store under `key`. Must be a non-empty string. 364 365 Returns: 366 The newly created key-value storage entry. 367 """ 368 return self._http.request( 369 "/api/v1/kv", 370 method="POST", 371 body=input, 372 response_type=KeyValueStorageEntry, 373 )
Create a key-value storage entry
Creates a key once per owner. An existing key returns HTTP 409 conflict, including expired rows awaiting sweep.
User-JWT callers use their own storage. Elevated callers select an owner with
system: true, team, user, or agent (in that priority order). An org alone selects
system ownership within that organization; all owners must be in the app scope.
Create and upsert accept a positive ttl_seconds; absent means no expiry.
Script binding (kv.create): the entry is owned by the triggering
automation's owner; scripts pass no owner params. A duplicate key
returns a script Err with code "conflict" instead of raising.
Arguments:
- input: Request body.
- input.agent: Agent owner ID.
- input.key: Storage key for the entry. Must be a non-empty string unique to this user.
- input.org: Organization scope for the owner.
- input.system: Select system ownership within the app or organization.
- input.team: Team owner ID.
- input.ttl_seconds: Positive lifetime in seconds; omitted means no expiry.
- input.user: User owner ID. Elevated callers may instead select team, agent, org, or system ownership.
- input.value: Value to store under
key. Must be a non-empty string.
Returns:
The newly created key-value storage entry.
375 def delete(self, key: str) -> KvDeleteResponse: 376 """ 377 Delete a key-value storage entry 378 Deletes an unexpired entry by owner and key. Returns 204, or 404 when absent. 379 User-JWT callers use their own storage. Elevated callers select an owner with 380 system: true, team, user, or agent (in that priority order). An org alone selects 381 system ownership within that organization; all owners must be in the app scope. 382 Create and upsert accept a positive ttl_seconds; absent means no expiry. 383 Script binding (`kv.delete`): removes the entry owned by the triggering 384 automation's owner; scripts pass no owner params. 385 386 Args: 387 key: Storage key of the entry to delete. Must be a non-empty string. 388 389 Returns: 390 Successful response 391 """ 392 return self._http.request( 393 f"/api/v1/kv/{key}", 394 method="DELETE", 395 response_type=KvDeleteResponse, 396 )
Delete a key-value storage entry
Deletes an unexpired entry by owner and key. Returns 204, or 404 when absent.
User-JWT callers use their own storage. Elevated callers select an owner with
system: true, team, user, or agent (in that priority order). An org alone selects
system ownership within that organization; all owners must be in the app scope.
Create and upsert accept a positive ttl_seconds; absent means no expiry.
Script binding (kv.delete): removes the entry owned by the triggering
automation's owner; scripts pass no owner params.
Arguments:
- key: Storage key of the entry to delete. Must be a non-empty string.
Returns:
Successful response
398 def get( 399 self, 400 key: str, 401 *, 402 org: str | None = None, 403 team: str | None = None, 404 agent: str | None = None, 405 system: bool | None = None, 406 user: str | None = None, 407 ) -> KeyValueStorageEntry: 408 """ 409 Retrieve a key-value storage entry 410 Returns an unexpired entry by owner and key, or 404. 411 User-JWT callers use their own storage. Elevated callers select an owner with 412 system: true, team, user, or agent (in that priority order). An org alone selects 413 system ownership within that organization; all owners must be in the app scope. 414 Create and upsert accept a positive ttl_seconds; absent means no expiry. 415 Script binding (`kv.get`): reads the entry owned by the triggering 416 automation's owner; scripts pass no owner params. 417 418 Args: 419 key: Storage key of the entry to retrieve. Must be a non-empty string. 420 org: Organization scope for the owner. 421 team: Team owner ID. 422 agent: Agent owner ID. 423 system: Select system ownership within the app or organization. 424 user: User owner ID. Elevated callers may instead select team, agent, org, or system ownership. 425 426 Returns: 427 The key-value storage entry for the given key. 428 """ 429 query: dict[str, object] = {} 430 if org is not None: 431 query["org"] = org 432 if team is not None: 433 query["team"] = team 434 if agent is not None: 435 query["agent"] = agent 436 if system is not None: 437 query["system"] = system 438 if user is not None: 439 query["user"] = user 440 return self._http.request( 441 f"/api/v1/kv/{key}", 442 query=query, 443 response_type=KeyValueStorageEntry, 444 )
Retrieve a key-value storage entry
Returns an unexpired entry by owner and key, or 404.
User-JWT callers use their own storage. Elevated callers select an owner with
system: true, team, user, or agent (in that priority order). An org alone selects
system ownership within that organization; all owners must be in the app scope.
Create and upsert accept a positive ttl_seconds; absent means no expiry.
Script binding (kv.get): reads the entry owned by the triggering
automation's owner; scripts pass no owner params.
Arguments:
- key: Storage key of the entry to retrieve. Must be a non-empty string.
- org: Organization scope for the owner.
- team: Team owner ID.
- agent: Agent owner ID.
- system: Select system ownership within the app or organization.
- user: User owner ID. Elevated callers may instead select team, agent, org, or system ownership.
Returns:
The key-value storage entry for the given key.
446 def upsert(self, key: str, input: KvUpsertInput) -> KeyValueStorageEntry: 447 """ 448 Create or update a key-value storage entry 449 Creates or replaces a value and its expiry. Omitted ttl_seconds clears any previous expiry. 450 User-JWT callers use their own storage. Elevated callers select an owner with 451 system: true, team, user, or agent (in that priority order). An org alone selects 452 system ownership within that organization; all owners must be in the app scope. 453 Create and upsert accept a positive ttl_seconds; absent means no expiry. 454 Script binding (`kv.upsert`): overwrites the entry owned by the triggering 455 automation's owner; scripts pass no owner params. 456 457 Args: 458 key: Storage key to create or overwrite. Must be a non-empty string. 459 input: Request body. 460 input.agent: Agent owner ID. 461 input.org: Organization scope for the owner. 462 input.system: Select system ownership within the app or organization. 463 input.team: Team owner ID. 464 input.ttl_seconds: Positive lifetime in seconds; omitted means no expiry. 465 input.user: User owner ID. Elevated callers may instead select team, agent, org, or system ownership. 466 input.value: New value to store under `key`. Must be a non-empty string. Replaces any existing value. 467 468 Returns: 469 The created or updated key-value storage entry. 470 """ 471 return self._http.request( 472 f"/api/v1/kv/{key}", 473 method="PUT", 474 body=input, 475 response_type=KeyValueStorageEntry, 476 )
Create or update a key-value storage entry
Creates or replaces a value and its expiry. Omitted ttl_seconds clears any previous expiry.
User-JWT callers use their own storage. Elevated callers select an owner with
system: true, team, user, or agent (in that priority order). An org alone selects
system ownership within that organization; all owners must be in the app scope.
Create and upsert accept a positive ttl_seconds; absent means no expiry.
Script binding (kv.upsert): overwrites the entry owned by the triggering
automation's owner; scripts pass no owner params.
Arguments:
- key: Storage key to create or overwrite. Must be a non-empty string.
- input: Request body.
- input.agent: Agent owner ID.
- input.org: Organization scope for the owner.
- input.system: Select system ownership within the app or organization.
- input.team: Team owner ID.
- input.ttl_seconds: Positive lifetime in seconds; omitted means no expiry.
- input.user: User owner ID. Elevated callers may instead select team, agent, org, or system ownership.
- input.value: New value to store under
key. Must be a non-empty string. Replaces any existing value.
Returns:
The created or updated key-value storage entry.