From 37c8f27db56eda9d72ecfb27eb7f9711bbbbba1e Mon Sep 17 00:00:00 2001 From: Vlada Dusek Date: Wed, 15 Apr 2026 09:33:31 +0200 Subject: [PATCH 1/4] feat: sort generated model classes alphabetically with topological ordering Add class sorting to postprocess_generated_models.py that orders class definitions alphabetically while respecting inheritance dependencies via topological sort. This makes regeneration from a reordered OpenAPI spec produce minimal diffs. Also makes add_docs_group_decorators idempotent. Co-Authored-By: Claude Opus 4.6 (1M context) --- scripts/postprocess_generated_models.py | 127 +- src/apify_client/_models.py | 4890 +++++++++++------------ 2 files changed, 2559 insertions(+), 2458 deletions(-) diff --git a/scripts/postprocess_generated_models.py b/scripts/postprocess_generated_models.py index 9c363335..86cd3b34 100644 --- a/scripts/postprocess_generated_models.py +++ b/scripts/postprocess_generated_models.py @@ -10,14 +10,20 @@ class alongside the canonical `ErrorType(StrEnum)`. This script removes the dupl rewires references to use `ErrorType`. - Missing @docs_group decorator: Adds `@docs_group('Models')` to all model classes for API reference documentation grouping, along with the required import. +- Class sorting: Sorts class definitions alphabetically (with topological ordering to respect + inheritance dependencies), so that regeneration from a reordered OpenAPI spec produces + minimal diffs. """ from __future__ import annotations +import heapq import re +from collections import defaultdict from pathlib import Path MODELS_PATH = Path(__file__).resolve().parent.parent / 'src' / 'apify_client' / '_models.py' +DOCS_GROUP_DECORATOR = "@docs_group('Models')" # Map of camelCase discriminator values to their snake_case equivalents. # Add new entries here as needed when the OpenAPI spec introduces new discriminators. @@ -54,19 +60,113 @@ def deduplicate_error_type_enum(content: str) -> str: def add_docs_group_decorators(content: str) -> str: - """Add `@docs_group('Models')` decorator to all model classes and the required import.""" - # Add the import after the existing imports. - content = re.sub( - r'(from pydantic import [^\n]+\n)', - r'\1\nfrom apify_client._docs import docs_group\n', - content, - ) - # Add @docs_group('Models') before every class definition. - return re.sub( - r'\nclass ', - "\n@docs_group('Models')\nclass ", - content, - ) + """Add `@docs_group('Models')` decorator to all model classes and the required import. + + This function is idempotent — it skips the import and decorators if they + already exist. + """ + # Add the import after the existing imports (only if not already present). + if 'from apify_client._docs import docs_group' not in content: + content = re.sub( + r'(from pydantic import [^\n]+\n)', + r'\1\nfrom apify_client._docs import docs_group\n', + content, + ) + # Add @docs_group('Models') before class definitions not already preceded by it. + lines = content.split('\n') + result: list[str] = [] + for line in lines: + if line.startswith('class ') and (not result or result[-1] != DOCS_GROUP_DECORATOR): + result.append(DOCS_GROUP_DECORATOR) + result.append(line) + return '\n'.join(result) + + +def sort_classes(content: str) -> str: + """Sort class definitions alphabetically while respecting inheritance order. + + Uses topological sorting so that base classes always appear before their + subclasses, with alphabetical ordering as the tie-breaker. This makes the + output deterministic regardless of the order in the OpenAPI spec, which + keeps diffs minimal across regenerations. + + Only the class statement's base-class expression creates an ordering + constraint — field type annotations are lazy strings thanks to + ``from __future__ import annotations`` and don't require forward + declaration. + """ + lines = content.split('\n') + + # Find where class blocks start (first @docs_group decorator). + header_end = 0 + for i, line in enumerate(lines): + if line == DOCS_GROUP_DECORATOR: + header_end = i + break + + # Strip trailing blank lines from the header; we re-add spacing later. + header_lines = lines[:header_end] + while header_lines and not header_lines[-1].strip(): + header_lines.pop() + header = '\n'.join(header_lines) + + # Split the remainder into class blocks. + # Each block starts with ``@docs_group('Models')`` on its own line. + rest = '\n'.join(lines[header_end:]) + decorator_escaped = re.escape(DOCS_GROUP_DECORATOR) + raw_blocks = re.split(rf'(?=^{decorator_escaped}$)', rest, flags=re.MULTILINE) + blocks = [b.strip() for b in raw_blocks if b.strip()] + + # Parse each block: extract class name and base-class dependencies. + class_blocks: dict[str, str] = {} + class_deps: dict[str, set[str]] = {} + + for block in blocks: + match = re.search(r'^class\s+(\w+)\(([^)]+)\):', block, re.MULTILINE) + if not match: + continue + class_name = match.group(1) + base_expr = match.group(2) + # Collect all capitalized identifiers from the base-class expression. + referenced = set(re.findall(r'\b([A-Z]\w+)\b', base_expr)) + class_blocks[class_name] = block + class_deps[class_name] = referenced + + if len(class_blocks) != len(blocks): + # Some blocks didn't match the class regex — fall back to avoid data loss. + return content + + all_names = set(class_blocks) + + # Build the dependency graph (only in-file references matter). + in_degree: dict[str, int] = {} + reverse: dict[str, set[str]] = defaultdict(set) + + for name, refs in class_deps.items(): + local_deps = (refs & all_names) - {name} + in_degree[name] = len(local_deps) + for dep in local_deps: + reverse[dep].add(name) + + # Kahn's algorithm with a min-heap for alphabetical tie-breaking. + heap = sorted(name for name, degree in in_degree.items() if degree == 0) + heapq.heapify(heap) + + sorted_names: list[str] = [] + while heap: + name = heapq.heappop(heap) + sorted_names.append(name) + for dependent in reverse[name]: + in_degree[dependent] -= 1 + if in_degree[dependent] == 0: + heapq.heappush(heap, dependent) + + if len(sorted_names) != len(class_blocks): + # Cycle detected — fall back to the original order to avoid data loss. + return content + + sorted_blocks = [class_blocks[name] for name in sorted_names] + return header + '\n\n\n' + '\n\n\n'.join(sorted_blocks) + '\n' def main() -> None: @@ -74,6 +174,7 @@ def main() -> None: fixed = fix_discriminators(content) fixed = deduplicate_error_type_enum(fixed) fixed = add_docs_group_decorators(fixed) + fixed = sort_classes(fixed) if fixed != content: MODELS_PATH.write_text(fixed) diff --git a/src/apify_client/_models.py b/src/apify_client/_models.py index ef84f0b5..fb418cdc 100644 --- a/src/apify_client/_models.py +++ b/src/apify_client/_models.py @@ -11,33 +11,218 @@ @docs_group('Models') -class PaginationResponse(BaseModel): - """Common pagination fields for list responses.""" +class AccountLimits(BaseModel): + model_config = ConfigDict( + extra='allow', + populate_by_name=True, + ) + monthly_usage_cycle: Annotated[UsageCycle, Field(alias='monthlyUsageCycle')] + limits: Limits + current: Current + +@docs_group('Models') +class Actor(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - total: Annotated[int, Field(examples=[1], ge=0)] + id: Annotated[str, Field(examples=['zdc3Pyhyz3m8vjDeM'])] + user_id: Annotated[str, Field(alias='userId', examples=['wRsJZtadYvn4mBZmm'])] + name: Annotated[str, Field(examples=['MyActor'])] + username: Annotated[str, Field(examples=['jane35'])] + description: Annotated[str | None, Field(examples=['My favourite actor!'])] = None + restart_on_error: Annotated[bool | None, Field(alias='restartOnError', deprecated=True, examples=[False])] = None + is_public: Annotated[bool, Field(alias='isPublic', examples=[False])] + actor_permission_level: Annotated[ActorPermissionLevel | None, Field(alias='actorPermissionLevel')] = None + created_at: Annotated[AwareDatetime, Field(alias='createdAt', examples=['2019-07-08T11:27:57.401Z'])] + modified_at: Annotated[AwareDatetime, Field(alias='modifiedAt', examples=['2019-07-08T14:01:05.546Z'])] + stats: ActorStats + versions: list[Version] + pricing_infos: Annotated[ + list[ + Annotated[ + PayPerEventActorPricingInfo + | PricePerDatasetItemActorPricingInfo + | FlatPricePerMonthActorPricingInfo + | FreeActorPricingInfo, + Field(discriminator='pricing_model'), + ] + ] + | None, + Field(alias='pricingInfos'), + ] = None + default_run_options: Annotated[DefaultRunOptions, Field(alias='defaultRunOptions')] + example_run_input: Annotated[ExampleRunInput | None, Field(alias='exampleRunInput')] = None + is_deprecated: Annotated[bool | None, Field(alias='isDeprecated', examples=[False])] = None + deployment_key: Annotated[str | None, Field(alias='deploymentKey', examples=['ssh-rsa AAAA ...'])] = None + title: Annotated[str | None, Field(examples=['My Actor'])] = None + tagged_builds: Annotated[dict[str, TaggedBuildInfo | None] | None, Field(alias='taggedBuilds')] = None + actor_standby: Annotated[ActorStandby | None, Field(alias='actorStandby')] = None + readme_summary: Annotated[str | None, Field(alias='readmeSummary')] = None """ - The total number of items available across all pages. + A brief, LLM-generated readme summary """ - offset: Annotated[int, Field(examples=[0], ge=0)] + + +@docs_group('Models') +class ActorChargeEvent(BaseModel): + model_config = ConfigDict( + extra='allow', + populate_by_name=True, + ) + event_price_usd: Annotated[float, Field(alias='eventPriceUsd')] + event_title: Annotated[str, Field(alias='eventTitle')] + event_description: Annotated[str, Field(alias='eventDescription')] + + +@docs_group('Models') +class ActorDefinition(BaseModel): + """The definition of the Actor, the full specification of this field can be found in [Apify docs](https://docs.apify.com/platform/actors/development/actor-definition/actor-json).""" + + model_config = ConfigDict( + extra='allow', + populate_by_name=True, + ) + actor_specification: Annotated[Literal[1], Field(alias='actorSpecification')] = 1 """ - The starting position for this page of results. + The Actor specification version that this Actor follows. This property must be set to 1. """ - limit: Annotated[int, Field(examples=[1000], ge=1)] + name: str | None = None """ - The maximum number of items returned per page. + The name of the Actor. """ - desc: Annotated[bool, Field(examples=[False])] + version: Annotated[str | None, Field(pattern='^[0-9]+\\.[0-9]+$')] = None """ - Whether the results are sorted in descending order. + The version of the Actor, specified in the format [Number].[Number], e.g., 0.1, 1.0. """ - count: Annotated[int, Field(examples=[1], ge=0)] + build_tag: Annotated[str | None, Field(alias='buildTag')] = None """ - The number of items returned in this response. + The tag name to be applied to a successful build of the Actor. Defaults to 'latest' if not specified. + """ + environment_variables: Annotated[dict[str, str] | None, Field(alias='environmentVariables')] = None + """ + A map of environment variables to be used during local development and deployment. + """ + dockerfile: str | None = None + """ + The path to the Dockerfile used for building the Actor on the platform. + """ + docker_context_dir: Annotated[str | None, Field(alias='dockerContextDir')] = None """ + The path to the directory used as the Docker context when building the Actor. + """ + readme: str | None = None + """ + The path to the README file for the Actor. + """ + input: dict[str, Any] | None = None + """ + The input schema object, the full specification can be found in [Apify docs](https://docs.apify.com/platform/actors/development/actor-definition/input-schema) + """ + changelog: str | None = None + """ + The path to the CHANGELOG file displayed in the Actor's information tab. + """ + storages: Storages | None = None + default_memory_mbytes: Annotated[str | int | None, Field(alias='defaultMemoryMbytes')] = None + """ + Specifies the default amount of memory in megabytes to be used when the Actor is started. Can be an integer or a [dynamic memory expression](/platform/actors/development/actor-definition/dynamic-actor-memory). + """ + min_memory_mbytes: Annotated[int | None, Field(alias='minMemoryMbytes', ge=256)] = None + """ + Specifies the minimum amount of memory in megabytes required by the Actor. + """ + max_memory_mbytes: Annotated[int | None, Field(alias='maxMemoryMbytes', ge=256)] = None + """ + Specifies the maximum amount of memory in megabytes required by the Actor. + """ + uses_standby_mode: Annotated[bool | None, Field(alias='usesStandbyMode')] = None + """ + Specifies whether Standby mode is enabled for the Actor. + """ + + +@docs_group('Models') +class ActorJobStatus(StrEnum): + """Status of an Actor job (run or build).""" + + READY = 'READY' + RUNNING = 'RUNNING' + SUCCEEDED = 'SUCCEEDED' + FAILED = 'FAILED' + TIMING_OUT = 'TIMING-OUT' + TIMED_OUT = 'TIMED-OUT' + ABORTING = 'ABORTING' + ABORTED = 'ABORTED' + + +@docs_group('Models') +class ActorPermissionLevel(StrEnum): + """Determines permissions that the Actor requires to run. For more information, see the [Actor permissions documentation](https://docs.apify.com/platform/actors/development/permissions).""" + + LIMITED_PERMISSIONS = 'LIMITED_PERMISSIONS' + FULL_PERMISSIONS = 'FULL_PERMISSIONS' + + +@docs_group('Models') +class ActorResponse(BaseModel): + """Response containing Actor data.""" + + model_config = ConfigDict( + extra='allow', + populate_by_name=True, + ) + data: Actor + + +@docs_group('Models') +class ActorRunFailedError(BaseModel): + model_config = ConfigDict( + extra='allow', + populate_by_name=True, + ) + error: RunFailedErrorDetail | None = None + + +@docs_group('Models') +class ActorRunTimeoutExceededError(BaseModel): + model_config = ConfigDict( + extra='allow', + populate_by_name=True, + ) + error: RunTimeoutExceededErrorDetail | None = None + + +@docs_group('Models') +class ActorShort(BaseModel): + model_config = ConfigDict( + extra='allow', + populate_by_name=True, + ) + id: Annotated[str, Field(examples=['br9CKmk457'])] + created_at: Annotated[AwareDatetime, Field(alias='createdAt', examples=['2019-10-29T07:34:24.202Z'])] + modified_at: Annotated[AwareDatetime, Field(alias='modifiedAt', examples=['2019-10-30T07:34:24.202Z'])] + name: Annotated[str, Field(examples=['MyAct'])] + username: Annotated[str, Field(examples=['janedoe'])] + title: Annotated[str | None, Field(examples=['Hello World Example'])] = None + stats: ActorStats | None = None + + +@docs_group('Models') +class ActorStandby(BaseModel): + model_config = ConfigDict( + extra='allow', + populate_by_name=True, + ) + is_enabled: Annotated[bool | None, Field(alias='isEnabled')] = None + desired_requests_per_actor_run: Annotated[int | None, Field(alias='desiredRequestsPerActorRun')] = None + max_requests_per_actor_run: Annotated[int | None, Field(alias='maxRequestsPerActorRun')] = None + idle_timeout_secs: Annotated[int | None, Field(alias='idleTimeoutSecs')] = None + build: str | None = None + memory_mbytes: Annotated[int | None, Field(alias='memoryMbytes')] = None + disable_standby_fields_override: Annotated[bool | None, Field(alias='disableStandbyFieldsOverride')] = None + should_pass_actor_input: Annotated[bool | None, Field(alias='shouldPassActorInput')] = None @docs_group('Models') @@ -59,762 +244,313 @@ class ActorStats(BaseModel): @docs_group('Models') -class ActorShort(BaseModel): +class AddRequestResponse(BaseModel): + """Response containing the result of adding a request to the request queue.""" + model_config = ConfigDict( extra='allow', populate_by_name=True, ) - id: Annotated[str, Field(examples=['br9CKmk457'])] - created_at: Annotated[AwareDatetime, Field(alias='createdAt', examples=['2019-10-29T07:34:24.202Z'])] - modified_at: Annotated[AwareDatetime, Field(alias='modifiedAt', examples=['2019-10-30T07:34:24.202Z'])] - name: Annotated[str, Field(examples=['MyAct'])] - username: Annotated[str, Field(examples=['janedoe'])] - title: Annotated[str | None, Field(examples=['Hello World Example'])] = None - stats: ActorStats | None = None + data: RequestRegistration @docs_group('Models') -class ListOfActors(PaginationResponse): +class AddedRequest(BaseModel): + """Information about a request that was successfully added to a request queue.""" + model_config = ConfigDict( extra='allow', populate_by_name=True, ) - items: list[ActorShort] + request_id: Annotated[str, Field(alias='requestId', examples=['sbJ7klsdf7ujN9l'])] + """ + A unique identifier assigned to the request. + """ + unique_key: Annotated[str, Field(alias='uniqueKey', examples=['GET|60d83e70|e3b0c442|https://apify.com'])] + """ + A unique key used for request de-duplication. Requests with the same unique key are considered identical. + """ + was_already_present: Annotated[bool, Field(alias='wasAlreadyPresent', examples=[False])] + """ + Indicates whether a request with the same unique key already existed in the request queue. If true, no new request was created. + """ + was_already_handled: Annotated[bool, Field(alias='wasAlreadyHandled', examples=[False])] + """ + Indicates whether a request with the same unique key has already been processed by the request queue. + """ @docs_group('Models') -class ListOfActorsResponse(BaseModel): +class BatchAddResponse(BaseModel): + """Response containing the result of a batch add operation.""" + model_config = ConfigDict( extra='allow', populate_by_name=True, ) - data: ListOfActors + data: BatchAddResult @docs_group('Models') -class ErrorType(StrEnum): - """Machine-processable error type identifier.""" +class BatchAddResult(BaseModel): + """Result of a batch add operation containing successfully processed and failed requests.""" - FIELD_3D_SECURE_AUTH_FAILED = '3d-secure-auth-failed' - ACCESS_RIGHT_ALREADY_EXISTS = 'access-right-already-exists' - ACTION_NOT_FOUND = 'action-not-found' - ACTOR_ALREADY_RENTED = 'actor-already-rented' - ACTOR_CAN_NOT_BE_RENTED = 'actor-can-not-be-rented' - ACTOR_DISABLED = 'actor-disabled' - ACTOR_IS_NOT_RENTED = 'actor-is-not-rented' - ACTOR_MEMORY_LIMIT_EXCEEDED = 'actor-memory-limit-exceeded' - ACTOR_NAME_EXISTS_NEW_OWNER = 'actor-name-exists-new-owner' - ACTOR_NAME_NOT_UNIQUE = 'actor-name-not-unique' - ACTOR_NOT_FOUND = 'actor-not-found' - ACTOR_NOT_GITHUB_ACTOR = 'actor-not-github-actor' - ACTOR_NOT_PUBLIC = 'actor-not-public' - ACTOR_PERMISSION_LEVEL_NOT_SUPPORTED_FOR_AGENTIC_PAYMENTS = ( - 'actor-permission-level-not-supported-for-agentic-payments' + model_config = ConfigDict( + extra='allow', + populate_by_name=True, ) - ACTOR_REVIEW_ALREADY_EXISTS = 'actor-review-already-exists' - ACTOR_RUN_FAILED = 'actor-run-failed' - ACTOR_STANDBY_NOT_SUPPORTED_FOR_AGENTIC_PAYMENTS = 'actor-standby-not-supported-for-agentic-payments' - ACTOR_TASK_NAME_NOT_UNIQUE = 'actor-task-name-not-unique' - AGENTIC_PAYMENT_INFO_RETRIEVAL_ERROR = 'agentic-payment-info-retrieval-error' - AGENTIC_PAYMENT_INFORMATION_MISSING = 'agentic-payment-information-missing' - AGENTIC_PAYMENT_INSUFFICIENT_AMOUNT = 'agentic-payment-insufficient-amount' - AGENTIC_PAYMENT_PROVIDER_INTERNAL_ERROR = 'agentic-payment-provider-internal-error' - AGENTIC_PAYMENT_PROVIDER_UNAUTHORIZED = 'agentic-payment-provider-unauthorized' - AIRTABLE_WEBHOOK_DEPRECATED = 'airtable-webhook-deprecated' - ALREADY_SUBSCRIBED_TO_PAID_ACTOR = 'already-subscribed-to-paid-actor' - APIFY_PLAN_REQUIRED_TO_USE_PAID_ACTOR = 'apify-plan-required-to-use-paid-actor' - APIFY_SIGNUP_NOT_ALLOWED = 'apify-signup-not-allowed' - AUTH_METHOD_NOT_SUPPORTED = 'auth-method-not-supported' - AUTHORIZATION_SERVER_NOT_FOUND = 'authorization-server-not-found' - AUTO_ISSUE_DATE_INVALID = 'auto-issue-date-invalid' - BACKGROUND_CHECK_REQUIRED = 'background-check-required' - BILLING_SYSTEM_ERROR = 'billing-system-error' - BLACK_FRIDAY_PLAN_EXPIRED = 'black-friday-plan-expired' - BRAINTREE_ERROR = 'braintree-error' - BRAINTREE_NOT_LINKED = 'braintree-not-linked' - BRAINTREE_OPERATION_TIMED_OUT = 'braintree-operation-timed-out' - BRAINTREE_UNSUPPORTED_CURRENCY = 'braintree-unsupported-currency' - BUILD_NOT_FOUND = 'build-not-found' - BUILD_OUTDATED = 'build-outdated' - CANNOT_ADD_APIFY_EVENTS_TO_PPE_ACTOR = 'cannot-add-apify-events-to-ppe-actor' - CANNOT_ADD_MULTIPLE_PRICING_INFOS = 'cannot-add-multiple-pricing-infos' - CANNOT_ADD_PRICING_INFO_THAT_ALTERS_PAST = 'cannot-add-pricing-info-that-alters-past' - CANNOT_ADD_SECOND_FUTURE_PRICING_INFO = 'cannot-add-second-future-pricing-info' - CANNOT_BUILD_ACTOR_FROM_WEBHOOK = 'cannot-build-actor-from-webhook' - CANNOT_CHANGE_BILLING_INTERVAL = 'cannot-change-billing-interval' - CANNOT_CHANGE_OWNER = 'cannot-change-owner' - CANNOT_CHARGE_APIFY_EVENT = 'cannot-charge-apify-event' - CANNOT_CHARGE_NON_PAY_PER_EVENT_ACTOR = 'cannot-charge-non-pay-per-event-actor' - CANNOT_COMMENT_AS_OTHER_USER = 'cannot-comment-as-other-user' - CANNOT_COPY_ACTOR_TASK = 'cannot-copy-actor-task' - CANNOT_CREATE_PAYOUT = 'cannot-create-payout' - CANNOT_CREATE_PUBLIC_ACTOR = 'cannot-create-public-actor' - CANNOT_CREATE_TAX_TRANSACTION = 'cannot-create-tax-transaction' - CANNOT_DELETE_CRITICAL_ACTOR = 'cannot-delete-critical-actor' - CANNOT_DELETE_INVOICE = 'cannot-delete-invoice' - CANNOT_DELETE_PAID_ACTOR = 'cannot-delete-paid-actor' - CANNOT_DISABLE_ONE_TIME_EVENT_FOR_APIFY_START_EVENT = 'cannot-disable-one-time-event-for-apify-start-event' - CANNOT_DISABLE_ORGANIZATION_WITH_ENABLED_MEMBERS = 'cannot-disable-organization-with-enabled-members' - CANNOT_DISABLE_USER_WITH_SUBSCRIPTION = 'cannot-disable-user-with-subscription' - CANNOT_LINK_OAUTH_TO_UNVERIFIED_EMAIL = 'cannot-link-oauth-to-unverified-email' - CANNOT_METAMORPH_TO_PAY_PER_RESULT_ACTOR = 'cannot-metamorph-to-pay-per-result-actor' - CANNOT_MODIFY_ACTOR_PRICING_TOO_FREQUENTLY = 'cannot-modify-actor-pricing-too-frequently' - CANNOT_MODIFY_ACTOR_PRICING_WITH_IMMEDIATE_EFFECT = 'cannot-modify-actor-pricing-with-immediate-effect' - CANNOT_OVERRIDE_PAID_ACTOR_TRIAL = 'cannot-override-paid-actor-trial' - CANNOT_PERMANENTLY_DELETE_SUBSCRIPTION = 'cannot-permanently-delete-subscription' - CANNOT_PUBLISH_ACTOR = 'cannot-publish-actor' - CANNOT_REDUCE_LAST_FULL_TOKEN = 'cannot-reduce-last-full-token' - CANNOT_REIMBURSE_MORE_THAN_ORIGINAL_CHARGE = 'cannot-reimburse-more-than-original-charge' - CANNOT_REIMBURSE_NON_RENTAL_CHARGE = 'cannot-reimburse-non-rental-charge' - CANNOT_REMOVE_OWN_ACTOR_FROM_RECENTLY_USED = 'cannot-remove-own-actor-from-recently-used' - CANNOT_REMOVE_PAYMENT_METHOD = 'cannot-remove-payment-method' - CANNOT_REMOVE_PRICING_INFO = 'cannot-remove-pricing-info' - CANNOT_REMOVE_RUNNING_RUN = 'cannot-remove-running-run' - CANNOT_REMOVE_USER_WITH_PUBLIC_ACTORS = 'cannot-remove-user-with-public-actors' - CANNOT_REMOVE_USER_WITH_SUBSCRIPTION = 'cannot-remove-user-with-subscription' - CANNOT_REMOVE_USER_WITH_UNPAID_INVOICE = 'cannot-remove-user-with-unpaid-invoice' - CANNOT_RENAME_ENV_VAR = 'cannot-rename-env-var' - CANNOT_RENT_PAID_ACTOR = 'cannot-rent-paid-actor' - CANNOT_REVIEW_OWN_ACTOR = 'cannot-review-own-actor' - CANNOT_SET_ACCESS_RIGHTS_FOR_OWNER = 'cannot-set-access-rights-for-owner' - CANNOT_SET_IS_STATUS_MESSAGE_TERMINAL = 'cannot-set-is-status-message-terminal' - CANNOT_UNPUBLISH_CRITICAL_ACTOR = 'cannot-unpublish-critical-actor' - CANNOT_UNPUBLISH_PAID_ACTOR = 'cannot-unpublish-paid-actor' - CANNOT_UNPUBLISH_PROFILE = 'cannot-unpublish-profile' - CANNOT_UPDATE_INVOICE_FIELD = 'cannot-update-invoice-field' - CONCURRENT_RUNS_LIMIT_EXCEEDED = 'concurrent-runs-limit-exceeded' - CONCURRENT_UPDATE_DETECTED = 'concurrent-update-detected' - CONFERENCE_TOKEN_NOT_FOUND = 'conference-token-not-found' - CONTENT_ENCODING_FORBIDDEN_FOR_HTML = 'content-encoding-forbidden-for-html' - COUPON_ALREADY_REDEEMED = 'coupon-already-redeemed' - COUPON_EXPIRED = 'coupon-expired' - COUPON_FOR_NEW_CUSTOMERS = 'coupon-for-new-customers' - COUPON_FOR_SUBSCRIBED_USERS = 'coupon-for-subscribed-users' - COUPON_LIMITS_ARE_IN_CONFLICT_WITH_CURRENT_LIMITS = 'coupon-limits-are-in-conflict-with-current-limits' - COUPON_MAX_NUMBER_OF_REDEMPTIONS_REACHED = 'coupon-max-number-of-redemptions-reached' - COUPON_NOT_FOUND = 'coupon-not-found' - COUPON_NOT_UNIQUE = 'coupon-not-unique' - COUPONS_DISABLED = 'coupons-disabled' - CREATE_GITHUB_ISSUE_NOT_ALLOWED = 'create-github-issue-not-allowed' - CREATOR_PLAN_NOT_AVAILABLE = 'creator-plan-not-available' - CRON_EXPRESSION_INVALID = 'cron-expression-invalid' - DAILY_AI_TOKEN_LIMIT_EXCEEDED = 'daily-ai-token-limit-exceeded' - DAILY_PUBLICATION_LIMIT_EXCEEDED = 'daily-publication-limit-exceeded' - DATASET_DOES_NOT_HAVE_FIELDS_SCHEMA = 'dataset-does-not-have-fields-schema' - DATASET_DOES_NOT_HAVE_SCHEMA = 'dataset-does-not-have-schema' - DATASET_LOCKED = 'dataset-locked' - DATASET_SCHEMA_INVALID = 'dataset-schema-invalid' - DCR_NOT_SUPPORTED = 'dcr-not-supported' - DEFAULT_DATASET_NOT_FOUND = 'default-dataset-not-found' - DELETING_DEFAULT_BUILD = 'deleting-default-build' - DELETING_UNFINISHED_BUILD = 'deleting-unfinished-build' - EMAIL_ALREADY_TAKEN = 'email-already-taken' - EMAIL_ALREADY_TAKEN_REMOVED_USER = 'email-already-taken-removed-user' - EMAIL_DOMAIN_NOT_ALLOWED_FOR_COUPON = 'email-domain-not-allowed-for-coupon' - EMAIL_INVALID = 'email-invalid' - EMAIL_NOT_ALLOWED = 'email-not-allowed' - EMAIL_NOT_VALID = 'email-not-valid' - EMAIL_UPDATE_TOO_SOON = 'email-update-too-soon' - ELEVATED_PERMISSIONS_NEEDED = 'elevated-permissions-needed' - ENV_VAR_ALREADY_EXISTS = 'env-var-already-exists' - EXCHANGE_RATE_FETCH_FAILED = 'exchange-rate-fetch-failed' - EXPIRED_CONFERENCE_TOKEN = 'expired-conference-token' - FAILED_TO_CHARGE_USER = 'failed-to-charge-user' - FINAL_INVOICE_NEGATIVE = 'final-invoice-negative' - GITHUB_BRANCH_EMPTY = 'github-branch-empty' - GITHUB_ISSUE_ALREADY_EXISTS = 'github-issue-already-exists' - GITHUB_PUBLIC_KEY_NOT_FOUND = 'github-public-key-not-found' - GITHUB_REPOSITORY_NOT_FOUND = 'github-repository-not-found' - GITHUB_SIGNATURE_DOES_NOT_MATCH_PAYLOAD = 'github-signature-does-not-match-payload' - GITHUB_USER_NOT_AUTHORIZED_FOR_ISSUES = 'github-user-not-authorized-for-issues' - GMAIL_NOT_ALLOWED = 'gmail-not-allowed' - ID_DOES_NOT_MATCH = 'id-does-not-match' - INCOMPATIBLE_BILLING_INTERVAL = 'incompatible-billing-interval' - INCOMPLETE_PAYOUT_BILLING_INFO = 'incomplete-payout-billing-info' - INCONSISTENT_CURRENCIES = 'inconsistent-currencies' - INCORRECT_PRICING_MODIFIER_PREFIX = 'incorrect-pricing-modifier-prefix' - INPUT_JSON_INVALID_CHARACTERS = 'input-json-invalid-characters' - INPUT_JSON_NOT_OBJECT = 'input-json-not-object' - INPUT_JSON_TOO_LONG = 'input-json-too-long' - INPUT_UPDATE_COLLISION = 'input-update-collision' - INSUFFICIENT_PERMISSIONS = 'insufficient-permissions' - INSUFFICIENT_PERMISSIONS_TO_CHANGE_FIELD = 'insufficient-permissions-to-change-field' - INSUFFICIENT_SECURITY_MEASURES = 'insufficient-security-measures' - INSUFFICIENT_TAX_COUNTRY_EVIDENCE = 'insufficient-tax-country-evidence' - INTEGRATION_AUTH_ERROR = 'integration-auth-error' - INTERNAL_SERVER_ERROR = 'internal-server-error' - INVALID_BILLING_INFO = 'invalid-billing-info' - INVALID_BILLING_PERIOD_FOR_PAYOUT = 'invalid-billing-period-for-payout' - INVALID_BUILD = 'invalid-build' - INVALID_CLIENT_KEY = 'invalid-client-key' - INVALID_COLLECTION = 'invalid-collection' - INVALID_CONFERENCE_LOGIN_PASSWORD = 'invalid-conference-login-password' - INVALID_CONTENT_TYPE_HEADER = 'invalid-content-type-header' - INVALID_CREDENTIALS = 'invalid-credentials' - INVALID_GIT_AUTH_TOKEN = 'invalid-git-auth-token' - INVALID_GITHUB_ISSUE_URL = 'invalid-github-issue-url' - INVALID_HEADER = 'invalid-header' - INVALID_ID = 'invalid-id' - INVALID_IDEMPOTENCY_KEY = 'invalid-idempotency-key' - INVALID_INPUT = 'invalid-input' - INVALID_INPUT_SCHEMA = 'invalid-input-schema' - INVALID_INVOICE = 'invalid-invoice' - INVALID_INVOICE_TYPE = 'invalid-invoice-type' - INVALID_ISSUE_DATE = 'invalid-issue-date' - INVALID_LABEL_PARAMS = 'invalid-label-params' - INVALID_MAIN_ACCOUNT_USER_ID = 'invalid-main-account-user-id' - INVALID_OAUTH_APP = 'invalid-oauth-app' - INVALID_OAUTH_SCOPE = 'invalid-oauth-scope' - INVALID_ONE_TIME_INVOICE = 'invalid-one-time-invoice' - INVALID_PARAMETER = 'invalid-parameter' - INVALID_PAYOUT_STATUS = 'invalid-payout-status' - INVALID_PICTURE_URL = 'invalid-picture-url' - INVALID_RECORD_KEY = 'invalid-record-key' - INVALID_REQUEST = 'invalid-request' - INVALID_RESOURCE_TYPE = 'invalid-resource-type' - INVALID_SIGNATURE = 'invalid-signature' - INVALID_SUBSCRIPTION_PLAN = 'invalid-subscription-plan' - INVALID_TAX_NUMBER = 'invalid-tax-number' - INVALID_TAX_NUMBER_FORMAT = 'invalid-tax-number-format' - INVALID_TOKEN = 'invalid-token' - INVALID_TOKEN_TYPE = 'invalid-token-type' - INVALID_TWO_FACTOR_CODE = 'invalid-two-factor-code' - INVALID_TWO_FACTOR_CODE_OR_RECOVERY_CODE = 'invalid-two-factor-code-or-recovery-code' - INVALID_TWO_FACTOR_RECOVERY_CODE = 'invalid-two-factor-recovery-code' - INVALID_USERNAME = 'invalid-username' - INVALID_VALUE = 'invalid-value' - INVITATION_INVALID_RESOURCE_TYPE = 'invitation-invalid-resource-type' - INVITATION_NO_LONGER_VALID = 'invitation-no-longer-valid' - INVOICE_CANCELED = 'invoice-canceled' - INVOICE_CANNOT_BE_REFUNDED_DUE_TO_TOO_HIGH_AMOUNT = 'invoice-cannot-be-refunded-due-to-too-high-amount' - INVOICE_INCOMPLETE = 'invoice-incomplete' - INVOICE_IS_DRAFT = 'invoice-is-draft' - INVOICE_LOCKED = 'invoice-locked' - INVOICE_MUST_BE_BUFFER = 'invoice-must-be-buffer' - INVOICE_NOT_CANCELED = 'invoice-not-canceled' - INVOICE_NOT_DRAFT = 'invoice-not-draft' - INVOICE_NOT_FOUND = 'invoice-not-found' - INVOICE_OUTDATED = 'invoice-outdated' - INVOICE_PAID_ALREADY = 'invoice-paid-already' - ISSUE_ALREADY_CONNECTED_TO_GITHUB = 'issue-already-connected-to-github' - ISSUE_NOT_FOUND = 'issue-not-found' - ISSUES_BAD_REQUEST = 'issues-bad-request' - ISSUER_NOT_REGISTERED = 'issuer-not-registered' - JOB_FINISHED = 'job-finished' - LABEL_ALREADY_LINKED = 'label-already-linked' - LAST_API_TOKEN = 'last-api-token' - LIMIT_REACHED = 'limit-reached' - MAX_ITEMS_MUST_BE_GREATER_THAN_ZERO = 'max-items-must-be-greater-than-zero' - MAX_METAMORPHS_EXCEEDED = 'max-metamorphs-exceeded' - MAX_TOTAL_CHARGE_USD_BELOW_MINIMUM = 'max-total-charge-usd-below-minimum' - MAX_TOTAL_CHARGE_USD_MUST_BE_GREATER_THAN_ZERO = 'max-total-charge-usd-must-be-greater-than-zero' - METHOD_NOT_ALLOWED = 'method-not-allowed' - MIGRATION_DISABLED = 'migration-disabled' - MISSING_ACTOR_RIGHTS = 'missing-actor-rights' - MISSING_API_TOKEN = 'missing-api-token' - MISSING_BILLING_INFO = 'missing-billing-info' - MISSING_LINE_ITEMS = 'missing-line-items' - MISSING_PAYMENT_DATE = 'missing-payment-date' - MISSING_PAYOUT_BILLING_INFO = 'missing-payout-billing-info' - MISSING_PROXY_PASSWORD = 'missing-proxy-password' - MISSING_REPORTING_FIELDS = 'missing-reporting-fields' - MISSING_RESOURCE_NAME = 'missing-resource-name' - MISSING_SETTINGS = 'missing-settings' - MISSING_USERNAME = 'missing-username' - MONTHLY_USAGE_LIMIT_TOO_LOW = 'monthly-usage-limit-too-low' - MORE_THAN_ONE_UPDATE_NOT_ALLOWED = 'more-than-one-update-not-allowed' - MULTIPLE_RECORDS_FOUND = 'multiple-records-found' - MUST_BE_ADMIN = 'must-be-admin' - NAME_NOT_UNIQUE = 'name-not-unique' - NEXT_RUNTIME_COMPUTATION_FAILED = 'next-runtime-computation-failed' - NO_COLUMNS_IN_EXPORTED_DATASET = 'no-columns-in-exported-dataset' - NO_PAYMENT_ATTEMPT_FOR_REFUND_FOUND = 'no-payment-attempt-for-refund-found' - NO_PAYMENT_METHOD_AVAILABLE = 'no-payment-method-available' - NO_TEAM_ACCOUNT_SEATS_AVAILABLE = 'no-team-account-seats-available' - NON_TEMPORARY_EMAIL = 'non-temporary-email' - NOT_ENOUGH_USAGE_TO_RUN_PAID_ACTOR = 'not-enough-usage-to-run-paid-actor' - NOT_IMPLEMENTED = 'not-implemented' - NOT_SUPPORTED_CURRENCIES = 'not-supported-currencies' - O_AUTH_SERVICE_ALREADY_CONNECTED = 'o-auth-service-already-connected' - O_AUTH_SERVICE_NOT_CONNECTED = 'o-auth-service-not-connected' - OAUTH_RESOURCE_ACCESS_FAILED = 'oauth-resource-access-failed' - ONE_TIME_INVOICE_ALREADY_MARKED_PAID = 'one-time-invoice-already-marked-paid' - ONLY_DRAFTS_CAN_BE_DELETED = 'only-drafts-can-be-deleted' - OPERATION_CANCELED = 'operation-canceled' - OPERATION_NOT_ALLOWED = 'operation-not-allowed' - OPERATION_TIMED_OUT = 'operation-timed-out' - ORGANIZATION_CANNOT_OWN_ITSELF = 'organization-cannot-own-itself' - ORGANIZATION_ROLE_NOT_FOUND = 'organization-role-not-found' - OVERLAPPING_PAYOUT_BILLING_PERIODS = 'overlapping-payout-billing-periods' - OWN_TOKEN_REQUIRED = 'own-token-required' - PAGE_NOT_FOUND = 'page-not-found' - PARAM_NOT_ONE_OF = 'param-not-one-of' - PARAMETER_REQUIRED = 'parameter-required' - PARAMETERS_MISMATCHED = 'parameters-mismatched' - PASSWORD_RESET_EMAIL_ALREADY_SENT = 'password-reset-email-already-sent' - PASSWORD_RESET_TOKEN_EXPIRED = 'password-reset-token-expired' - PAY_AS_YOU_GO_WITHOUT_MONTHLY_INTERVAL = 'pay-as-you-go-without-monthly-interval' - PAYMENT_ATTEMPT_STATUS_MESSAGE_REQUIRED = 'payment-attempt-status-message-required' - PAYOUT_ALREADY_PAID = 'payout-already-paid' - PAYOUT_CANCELED = 'payout-canceled' - PAYOUT_INVALID_STATE = 'payout-invalid-state' - PAYOUT_MUST_BE_APPROVED_TO_BE_MARKED_PAID = 'payout-must-be-approved-to-be-marked-paid' - PAYOUT_NOT_FOUND = 'payout-not-found' - PAYOUT_NUMBER_ALREADY_EXISTS = 'payout-number-already-exists' - PHONE_NUMBER_INVALID = 'phone-number-invalid' - PHONE_NUMBER_LANDLINE = 'phone-number-landline' - PHONE_NUMBER_OPTED_OUT = 'phone-number-opted-out' - PHONE_VERIFICATION_DISABLED = 'phone-verification-disabled' - PLATFORM_FEATURE_DISABLED = 'platform-feature-disabled' - PRICE_OVERRIDES_VALIDATION_FAILED = 'price-overrides-validation-failed' - PRICING_MODEL_NOT_SUPPORTED = 'pricing-model-not-supported' - PROMOTIONAL_PLAN_NOT_AVAILABLE = 'promotional-plan-not-available' - PROXY_AUTH_IP_NOT_UNIQUE = 'proxy-auth-ip-not-unique' - PUBLIC_ACTOR_DISABLED = 'public-actor-disabled' - QUERY_TIMEOUT = 'query-timeout' - QUOTED_PRICE_OUTDATED = 'quoted-price-outdated' - RATE_LIMIT_EXCEEDED = 'rate-limit-exceeded' - RECAPTCHA_INVALID = 'recaptcha-invalid' - RECAPTCHA_REQUIRED = 'recaptcha-required' - RECORD_NOT_FOUND = 'record-not-found' - RECORD_NOT_PUBLIC = 'record-not-public' - RECORD_OR_TOKEN_NOT_FOUND = 'record-or-token-not-found' - RECORD_TOO_LARGE = 'record-too-large' - REDIRECT_URI_MISMATCH = 'redirect-uri-mismatch' - REDUCED_PLAN_NOT_AVAILABLE = 'reduced-plan-not-available' - RENTAL_CHARGE_ALREADY_REIMBURSED = 'rental-charge-already-reimbursed' - RENTAL_NOT_ALLOWED = 'rental-not-allowed' - REQUEST_ABORTED_PREMATURELY = 'request-aborted-prematurely' - REQUEST_HANDLED_OR_LOCKED = 'request-handled-or-locked' - REQUEST_ID_INVALID = 'request-id-invalid' - REQUEST_QUEUE_DUPLICATE_REQUESTS = 'request-queue-duplicate-requests' - REQUEST_TOO_LARGE = 'request-too-large' - REQUESTED_DATASET_VIEW_DOES_NOT_EXIST = 'requested-dataset-view-does-not-exist' - RESUME_TOKEN_EXPIRED = 'resume-token-expired' - RUN_FAILED = 'run-failed' - RUN_TIMEOUT_EXCEEDED = 'run-timeout-exceeded' - RUSSIA_IS_EVIL = 'russia-is-evil' - SAME_USER = 'same-user' - SCHEDULE_ACTOR_NOT_FOUND = 'schedule-actor-not-found' - SCHEDULE_ACTOR_TASK_NOT_FOUND = 'schedule-actor-task-not-found' - SCHEDULE_NAME_NOT_UNIQUE = 'schedule-name-not-unique' - SCHEMA_VALIDATION = 'schema-validation' - SCHEMA_VALIDATION_FAILED = 'schema-validation-failed' - SIGN_UP_METHOD_NOT_ALLOWED = 'sign-up-method-not-allowed' - SLACK_INTEGRATION_NOT_CUSTOM = 'slack-integration-not-custom' - SOCKET_CLOSED = 'socket-closed' - SOCKET_DESTROYED = 'socket-destroyed' - STORE_SCHEMA_INVALID = 'store-schema-invalid' - STORE_TERMS_NOT_ACCEPTED = 'store-terms-not-accepted' - STRIPE_ENABLED = 'stripe-enabled' - STRIPE_GENERIC_DECLINE = 'stripe-generic-decline' - STRIPE_NOT_ENABLED = 'stripe-not-enabled' - STRIPE_NOT_ENABLED_FOR_USER = 'stripe-not-enabled-for-user' - TAGGED_BUILD_REQUIRED = 'tagged-build-required' - TAX_COUNTRY_INVALID = 'tax-country-invalid' - TAX_NUMBER_INVALID = 'tax-number-invalid' - TAX_NUMBER_VALIDATION_FAILED = 'tax-number-validation-failed' - TAXAMO_CALL_FAILED = 'taxamo-call-failed' - TAXAMO_REQUEST_FAILED = 'taxamo-request-failed' - TESTING_ERROR = 'testing-error' - TOKEN_NOT_PROVIDED = 'token-not-provided' - TOO_FEW_VERSIONS = 'too-few-versions' - TOO_MANY_ACTOR_TASKS = 'too-many-actor-tasks' - TOO_MANY_ACTORS = 'too-many-actors' - TOO_MANY_LABELS_ON_RESOURCE = 'too-many-labels-on-resource' - TOO_MANY_MCP_CONNECTORS = 'too-many-mcp-connectors' - TOO_MANY_O_AUTH_APPS = 'too-many-o-auth-apps' - TOO_MANY_ORGANIZATIONS = 'too-many-organizations' - TOO_MANY_REQUESTS = 'too-many-requests' - TOO_MANY_SCHEDULES = 'too-many-schedules' - TOO_MANY_UI_ACCESS_KEYS = 'too-many-ui-access-keys' - TOO_MANY_USER_LABELS = 'too-many-user-labels' - TOO_MANY_VALUES = 'too-many-values' - TOO_MANY_VERSIONS = 'too-many-versions' - TOO_MANY_WEBHOOKS = 'too-many-webhooks' - UNEXPECTED_ROUTE = 'unexpected-route' - UNKNOWN_BUILD_TAG = 'unknown-build-tag' - UNKNOWN_PAYMENT_PROVIDER = 'unknown-payment-provider' - UNSUBSCRIBE_TOKEN_INVALID = 'unsubscribe-token-invalid' - UNSUPPORTED_ACTOR_PRICING_MODEL_FOR_AGENTIC_PAYMENTS = 'unsupported-actor-pricing-model-for-agentic-payments' - UNSUPPORTED_CONTENT_ENCODING = 'unsupported-content-encoding' - UNSUPPORTED_FILE_TYPE_FOR_ISSUE = 'unsupported-file-type-for-issue' - UNSUPPORTED_FILE_TYPE_IMAGE_EXPECTED = 'unsupported-file-type-image-expected' - UNSUPPORTED_FILE_TYPE_TEXT_OR_JSON_EXPECTED = 'unsupported-file-type-text-or-json-expected' - UNSUPPORTED_PERMISSION = 'unsupported-permission' - UPCOMING_SUBSCRIPTION_BILL_NOT_UP_TO_DATE = 'upcoming-subscription-bill-not-up-to-date' - USER_ALREADY_EXISTS = 'user-already-exists' - USER_ALREADY_VERIFIED = 'user-already-verified' - USER_CREATES_ORGANIZATIONS_TOO_FAST = 'user-creates-organizations-too-fast' - USER_DISABLED = 'user-disabled' - USER_EMAIL_IS_DISPOSABLE = 'user-email-is-disposable' - USER_EMAIL_NOT_SET = 'user-email-not-set' - USER_EMAIL_NOT_VERIFIED = 'user-email-not-verified' - USER_HAS_NO_SUBSCRIPTION = 'user-has-no-subscription' - USER_INTEGRATION_NOT_FOUND = 'user-integration-not-found' - USER_IS_ALREADY_INVITED = 'user-is-already-invited' - USER_IS_ALREADY_ORGANIZATION_MEMBER = 'user-is-already-organization-member' - USER_IS_NOT_MEMBER_OF_ORGANIZATION = 'user-is-not-member-of-organization' - USER_IS_NOT_ORGANIZATION = 'user-is-not-organization' - USER_IS_ORGANIZATION = 'user-is-organization' - USER_IS_ORGANIZATION_OWNER = 'user-is-organization-owner' - USER_IS_REMOVED = 'user-is-removed' - USER_NOT_FOUND = 'user-not-found' - USER_NOT_LOGGED_IN = 'user-not-logged-in' - USER_NOT_VERIFIED = 'user-not-verified' - USER_OR_TOKEN_NOT_FOUND = 'user-or-token-not-found' - USER_PLAN_NOT_ALLOWED_FOR_COUPON = 'user-plan-not-allowed-for-coupon' - USER_PROBLEM_WITH_CARD = 'user-problem-with-card' - USER_RECORD_NOT_FOUND = 'user-record-not-found' - USERNAME_ALREADY_TAKEN = 'username-already-taken' - USERNAME_MISSING = 'username-missing' - USERNAME_NOT_ALLOWED = 'username-not-allowed' - USERNAME_REMOVAL_FORBIDDEN = 'username-removal-forbidden' - USERNAME_REQUIRED = 'username-required' - VERIFICATION_EMAIL_ALREADY_SENT = 'verification-email-already-sent' - VERIFICATION_TOKEN_EXPIRED = 'verification-token-expired' - VERSION_ALREADY_EXISTS = 'version-already-exists' - VERSIONS_SIZE_EXCEEDED = 'versions-size-exceeded' - WEAK_PASSWORD = 'weak-password' - X402_AGENTIC_PAYMENT_ALREADY_FINALIZED = 'x402-agentic-payment-already-finalized' - X402_AGENTIC_PAYMENT_INSUFFICIENT_AMOUNT = 'x402-agentic-payment-insufficient-amount' - X402_AGENTIC_PAYMENT_MALFORMED_TOKEN = 'x402-agentic-payment-malformed-token' - X402_AGENTIC_PAYMENT_SETTLEMENT_FAILED = 'x402-agentic-payment-settlement-failed' - X402_AGENTIC_PAYMENT_SETTLEMENT_IN_PROGRESS = 'x402-agentic-payment-settlement-in-progress' - X402_AGENTIC_PAYMENT_SETTLEMENT_STUCK = 'x402-agentic-payment-settlement-stuck' - X402_AGENTIC_PAYMENT_UNAUTHORIZED = 'x402-agentic-payment-unauthorized' - X402_PAYMENT_REQUIRED = 'x402-payment-required' - ZERO_INVOICE = 'zero-invoice' - - -@docs_group('Models') -class ErrorDetail(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - type: ErrorType | None = None - message: str | None = None + processed_requests: Annotated[list[AddedRequest], Field(alias='processedRequests')] """ - Human-readable error message describing what went wrong. + Requests that were successfully added to the request queue. """ - - -@docs_group('Models') -class ErrorResponse(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - error: ErrorDetail - - -@docs_group('Models') -class VersionSourceType(StrEnum): - SOURCE_FILES = 'SOURCE_FILES' - GIT_REPO = 'GIT_REPO' - TARBALL = 'TARBALL' - GITHUB_GIST = 'GITHUB_GIST' - - -@docs_group('Models') -class EnvVar(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - name: Annotated[str, Field(examples=['MY_ENV_VAR'])] - value: Annotated[str | None, Field(examples=['my-value'])] = None + unprocessed_requests: Annotated[list[RequestDraft], Field(alias='unprocessedRequests')] """ - The environment variable value. This field is absent in responses when `isSecret` is `true`, as secret values are never returned by the API. + Requests that failed to be added and can be retried. """ - is_secret: Annotated[bool | None, Field(alias='isSecret', examples=[False])] = None @docs_group('Models') -class SourceCodeFileFormat(StrEnum): - BASE64 = 'BASE64' - TEXT = 'TEXT' - +class BatchDeleteResponse(BaseModel): + """Response containing the result of a batch delete operation.""" -@docs_group('Models') -class SourceCodeFile(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - format: SourceCodeFileFormat | None = None - content: Annotated[str | None, Field(examples=["console.log('This is the main.js file');"])] = None - name: Annotated[str, Field(examples=['src/main.js'])] + data: BatchDeleteResult @docs_group('Models') -class SourceCodeFolder(BaseModel): - """Represents a folder in the Actor's source code structure. Distinguished from - SourceCodeFile by the presence of the `folder` property set to `true`. - - """ +class BatchDeleteResult(BaseModel): + """Result of a batch delete operation containing successfully deleted and failed requests.""" model_config = ConfigDict( extra='allow', populate_by_name=True, ) - name: Annotated[str, Field(examples=['src/utils'])] + processed_requests: Annotated[ + list[DeletedRequestById | DeletedRequestByUniqueKey], Field(alias='processedRequests') + ] """ - The folder path relative to the Actor's root directory. + Requests that were successfully deleted from the request queue. """ - folder: Annotated[bool, Field(examples=[True])] + unprocessed_requests: Annotated[list[RequestDraft], Field(alias='unprocessedRequests')] """ - Always `true` for folders. Used to distinguish folders from files. + Requests that failed to be deleted and can be retried. """ @docs_group('Models') -class Version(BaseModel): +class BrowserInfoResponse(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - version_number: Annotated[str, Field(alias='versionNumber', examples=['0.0'])] - source_type: Annotated[VersionSourceType | None, Field(alias='sourceType')] - env_vars: Annotated[list[EnvVar] | None, Field(alias='envVars')] = None - apply_env_vars_to_build: Annotated[bool | None, Field(alias='applyEnvVarsToBuild', examples=[False])] = None - build_tag: Annotated[str | None, Field(alias='buildTag', examples=['latest'])] = None - source_files: Annotated[ - list[SourceCodeFile | SourceCodeFolder] | None, Field(alias='sourceFiles', title='VersionSourceFiles') - ] = None - git_repo_url: Annotated[str | None, Field(alias='gitRepoUrl')] = None + method: Annotated[str, Field(examples=['GET'])] """ - URL of the Git repository when sourceType is GIT_REPO. + HTTP method of the request. """ - tarball_url: Annotated[str | None, Field(alias='tarballUrl')] = None + client_ip: Annotated[str | None, Field(alias='clientIp', examples=['1.2.3.4'])] """ - URL of the tarball when sourceType is TARBALL. + IP address of the client. """ - github_gist_url: Annotated[str | None, Field(alias='gitHubGistUrl')] = None + country_code: Annotated[str | None, Field(alias='countryCode', examples=['US'])] """ - URL of the GitHub Gist when sourceType is GITHUB_GIST. + Two-letter country code resolved from the client IP address. """ - - -@docs_group('Models') -class CommonActorPricingInfo(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - apify_margin_percentage: Annotated[float, Field(alias='apifyMarginPercentage')] + body_length: Annotated[int, Field(alias='bodyLength', examples=[0])] """ - In [0, 1], fraction of pricePerUnitUsd that goes to Apify + Length of the request body in bytes. """ - created_at: Annotated[AwareDatetime, Field(alias='createdAt')] + headers: dict[str, str | list[str]] | None = None """ - When this pricing info record has been created + Request headers. Omitted when `skipHeaders=true`. + """ - started_at: Annotated[AwareDatetime, Field(alias='startedAt')] + raw_headers: Annotated[list[str] | None, Field(alias='rawHeaders')] = None """ - Since when is this pricing info record effective for a given Actor + Raw request headers as a flat list of alternating name/value strings. + Included only when `rawHeaders=true`. + """ - notified_about_future_change_at: Annotated[AwareDatetime | None, Field(alias='notifiedAboutFutureChangeAt')] = None - notified_about_change_at: Annotated[AwareDatetime | None, Field(alias='notifiedAboutChangeAt')] = None - reason_for_change: Annotated[str | None, Field(alias='reasonForChange')] = None @docs_group('Models') -class ActorChargeEvent(BaseModel): +class Build(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - event_price_usd: Annotated[float, Field(alias='eventPriceUsd')] - event_title: Annotated[str, Field(alias='eventTitle')] - event_description: Annotated[str, Field(alias='eventDescription')] + id: Annotated[str, Field(examples=['HG7ML7M8z78YcAPEB'])] + act_id: Annotated[str, Field(alias='actId', examples=['janedoe~my-actor'])] + user_id: Annotated[str, Field(alias='userId', examples=['klmdEpoiojmdEMlk3'])] + started_at: Annotated[AwareDatetime, Field(alias='startedAt', examples=['2019-11-30T07:34:24.202Z'])] + finished_at: Annotated[AwareDatetime | None, Field(alias='finishedAt', examples=['2019-12-12T09:30:12.202Z'])] = ( + None + ) + status: ActorJobStatus + meta: BuildsMeta + stats: BuildStats | None = None + options: BuildOptions | None = None + usage: BuildUsage | None = None + usage_total_usd: Annotated[float | None, Field(alias='usageTotalUsd', examples=[0.02])] = None + usage_usd: Annotated[BuildUsage | None, Field(alias='usageUsd')] = None + input_schema: Annotated[ + str | None, Field(alias='inputSchema', deprecated=True, examples=['{\\n "title": "Schema for ... }']) + ] = None + readme: Annotated[str | None, Field(deprecated=True, examples=['# Magic Actor\\nThis Actor is magic.'])] = None + build_number: Annotated[str, Field(alias='buildNumber', examples=['0.1.1'])] + actor_definition: Annotated[ActorDefinition | None, Field(alias='actorDefinition')] = None @docs_group('Models') -class PricingPerEvent(BaseModel): +class BuildOptions(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - actor_charge_events: Annotated[dict[str, ActorChargeEvent] | None, Field(alias='actorChargeEvents')] = None + use_cache: Annotated[bool | None, Field(alias='useCache', examples=[False])] = None + beta_packages: Annotated[bool | None, Field(alias='betaPackages', examples=[False])] = None + memory_mbytes: Annotated[int | None, Field(alias='memoryMbytes', examples=[1024])] = None + disk_mbytes: Annotated[int | None, Field(alias='diskMbytes', examples=[2048])] = None @docs_group('Models') -class PayPerEventActorPricingInfo(CommonActorPricingInfo): +class BuildResponse(BaseModel): + """Response containing Actor build data.""" + model_config = ConfigDict( extra='allow', populate_by_name=True, ) - pricing_model: Annotated[Literal['PAY_PER_EVENT'], Field(alias='pricingModel')] - pricing_per_event: Annotated[PricingPerEvent, Field(alias='pricingPerEvent')] - minimal_max_total_charge_usd: Annotated[float | None, Field(alias='minimalMaxTotalChargeUsd')] = None + data: Build @docs_group('Models') -class PricePerDatasetItemActorPricingInfo(CommonActorPricingInfo): +class BuildShort(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - pricing_model: Annotated[Literal['PRICE_PER_DATASET_ITEM'], Field(alias='pricingModel')] - unit_name: Annotated[str, Field(alias='unitName')] - """ - Name of the unit that is being charged - """ - price_per_unit_usd: Annotated[float, Field(alias='pricePerUnitUsd')] + id: Annotated[str, Field(examples=['HG7ML7M8z78YcAPEB'])] + act_id: Annotated[str | None, Field(alias='actId', examples=['janedoe~my-actor'])] = None + status: ActorJobStatus + started_at: Annotated[AwareDatetime, Field(alias='startedAt', examples=['2019-11-30T07:34:24.202Z'])] + finished_at: Annotated[AwareDatetime | None, Field(alias='finishedAt', examples=['2019-12-12T09:30:12.202Z'])] = ( + None + ) + usage_total_usd: Annotated[float, Field(alias='usageTotalUsd', examples=[0.02])] + meta: BuildsMeta | None = None @docs_group('Models') -class FlatPricePerMonthActorPricingInfo(CommonActorPricingInfo): +class BuildStats(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - pricing_model: Annotated[Literal['FLAT_PRICE_PER_MONTH'], Field(alias='pricingModel')] - trial_minutes: Annotated[int, Field(alias='trialMinutes')] - """ - For how long this Actor can be used for free in trial period - """ - price_per_unit_usd: Annotated[float, Field(alias='pricePerUnitUsd')] - """ - Monthly flat price in USD - """ + duration_millis: Annotated[int | None, Field(alias='durationMillis', examples=[1000])] = None + run_time_secs: Annotated[float | None, Field(alias='runTimeSecs', examples=[45.718])] = None + compute_units: Annotated[float, Field(alias='computeUnits', examples=[0.0126994444444444])] @docs_group('Models') -class FreeActorPricingInfo(CommonActorPricingInfo): +class BuildTag(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - pricing_model: Annotated[Literal['FREE'], Field(alias='pricingModel')] - - -@docs_group('Models') -class ActorPermissionLevel(StrEnum): - """Determines permissions that the Actor requires to run. For more information, see the [Actor permissions documentation](https://docs.apify.com/platform/actors/development/permissions).""" - - LIMITED_PERMISSIONS = 'LIMITED_PERMISSIONS' - FULL_PERMISSIONS = 'FULL_PERMISSIONS' + build_id: Annotated[str, Field(alias='buildId')] @docs_group('Models') -class DefaultRunOptions(BaseModel): +class BuildUsage(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - build: Annotated[str | None, Field(examples=['latest'])] = None - timeout_secs: Annotated[int | None, Field(alias='timeoutSecs', examples=[3600])] = None - memory_mbytes: Annotated[int | None, Field(alias='memoryMbytes', examples=[2048])] = None - restart_on_error: Annotated[bool | None, Field(alias='restartOnError', examples=[False])] = None - max_items: Annotated[int | None, Field(alias='maxItems')] = None - force_permission_level: Annotated[ActorPermissionLevel | None, Field(alias='forcePermissionLevel')] = None + actor_compute_units: Annotated[float | None, Field(alias='ACTOR_COMPUTE_UNITS', examples=[0.08])] = None @docs_group('Models') -class ActorStandby(BaseModel): +class BuildsMeta(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - is_enabled: Annotated[bool | None, Field(alias='isEnabled')] = None - desired_requests_per_actor_run: Annotated[int | None, Field(alias='desiredRequestsPerActorRun')] = None - max_requests_per_actor_run: Annotated[int | None, Field(alias='maxRequestsPerActorRun')] = None - idle_timeout_secs: Annotated[int | None, Field(alias='idleTimeoutSecs')] = None - build: str | None = None - memory_mbytes: Annotated[int | None, Field(alias='memoryMbytes')] = None - disable_standby_fields_override: Annotated[bool | None, Field(alias='disableStandbyFieldsOverride')] = None - should_pass_actor_input: Annotated[bool | None, Field(alias='shouldPassActorInput')] = None + origin: RunOrigin + client_ip: Annotated[str | None, Field(alias='clientIp', examples=['172.234.12.34'])] = None + """ + IP address of the client that started the build. + """ + user_agent: Annotated[str | None, Field(alias='userAgent', examples=['Mozilla/5.0 (iPad)'])] = None + """ + User agent of the client that started the build. + """ @docs_group('Models') -class ExampleRunInput(BaseModel): +class Call(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - body: Annotated[str | None, Field(examples=['{ "helloWorld": 123 }'])] = None - content_type: Annotated[str | None, Field(alias='contentType', examples=['application/json; charset=utf-8'])] = None + started_at: Annotated[AwareDatetime | None, Field(alias='startedAt', examples=['2019-12-12T07:34:14.202Z'])] = None + finished_at: Annotated[AwareDatetime | None, Field(alias='finishedAt', examples=['2019-12-12T07:34:14.202Z'])] = ( + None + ) + error_message: Annotated[str | None, Field(alias='errorMessage', examples=['Cannot send request'])] = None + response_status: Annotated[int | None, Field(alias='responseStatus', examples=[200])] = None + response_body: Annotated[str | None, Field(alias='responseBody', examples=['{"foo": "bar"}'])] = None @docs_group('Models') -class CreateActorRequest(BaseModel): +class ChargeRunRequest(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - name: Annotated[str | None, Field(examples=['MyActor'])] = None - description: Annotated[str | None, Field(examples=['My favourite actor!'])] = None - title: Annotated[str | None, Field(examples=['My actor'])] = None - is_public: Annotated[bool | None, Field(alias='isPublic', examples=[False])] = None - seo_title: Annotated[str | None, Field(alias='seoTitle', examples=['My actor'])] = None - seo_description: Annotated[str | None, Field(alias='seoDescription', examples=['My actor is the best'])] = None - restart_on_error: Annotated[bool | None, Field(alias='restartOnError', deprecated=True, examples=[False])] = None - versions: list[Version] | None = None - pricing_infos: Annotated[ - list[ - Annotated[ - PayPerEventActorPricingInfo - | PricePerDatasetItemActorPricingInfo - | FlatPricePerMonthActorPricingInfo - | FreeActorPricingInfo, - Field(discriminator='pricing_model'), - ] - ] - | None, - Field(alias='pricingInfos'), - ] = None - categories: list[str] | None = None - default_run_options: Annotated[DefaultRunOptions | None, Field(alias='defaultRunOptions')] = None - actor_standby: Annotated[ActorStandby | None, Field(alias='actorStandby')] = None - example_run_input: Annotated[ExampleRunInput | None, Field(alias='exampleRunInput')] = None - is_deprecated: Annotated[bool | None, Field(alias='isDeprecated')] = None + event_name: Annotated[str, Field(alias='eventName', examples=['ANALYZE_PAGE'])] + count: Annotated[int, Field(examples=[1])] @docs_group('Models') -class TaggedBuildInfo(BaseModel): - """Information about a tagged build.""" - +class CommonActorPricingInfo(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - build_id: Annotated[str | None, Field(alias='buildId', examples=['z2EryhbfhgSyqj6Hn'])] = None + apify_margin_percentage: Annotated[float, Field(alias='apifyMarginPercentage')] """ - The ID of the build associated with this tag. + In [0, 1], fraction of pricePerUnitUsd that goes to Apify """ - build_number: Annotated[str | None, Field(alias='buildNumber', examples=['0.0.2'])] = None + created_at: Annotated[AwareDatetime, Field(alias='createdAt')] """ - The build number/version string. + When this pricing info record has been created """ - finished_at: Annotated[AwareDatetime | None, Field(alias='finishedAt', examples=['2019-06-10T11:15:49.286Z'])] = ( - None - ) + started_at: Annotated[AwareDatetime, Field(alias='startedAt')] """ - The timestamp when the build finished. + Since when is this pricing info record effective for a given Actor """ + notified_about_future_change_at: Annotated[AwareDatetime | None, Field(alias='notifiedAboutFutureChangeAt')] = None + notified_about_change_at: Annotated[AwareDatetime | None, Field(alias='notifiedAboutChangeAt')] = None + reason_for_change: Annotated[str | None, Field(alias='reasonForChange')] = None @docs_group('Models') -class Actor(BaseModel): +class CreateActorRequest(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - id: Annotated[str, Field(examples=['zdc3Pyhyz3m8vjDeM'])] - user_id: Annotated[str, Field(alias='userId', examples=['wRsJZtadYvn4mBZmm'])] - name: Annotated[str, Field(examples=['MyActor'])] - username: Annotated[str, Field(examples=['jane35'])] + name: Annotated[str | None, Field(examples=['MyActor'])] = None description: Annotated[str | None, Field(examples=['My favourite actor!'])] = None + title: Annotated[str | None, Field(examples=['My actor'])] = None + is_public: Annotated[bool | None, Field(alias='isPublic', examples=[False])] = None + seo_title: Annotated[str | None, Field(alias='seoTitle', examples=['My actor'])] = None + seo_description: Annotated[str | None, Field(alias='seoDescription', examples=['My actor is the best'])] = None restart_on_error: Annotated[bool | None, Field(alias='restartOnError', deprecated=True, examples=[False])] = None - is_public: Annotated[bool, Field(alias='isPublic', examples=[False])] - actor_permission_level: Annotated[ActorPermissionLevel | None, Field(alias='actorPermissionLevel')] = None - created_at: Annotated[AwareDatetime, Field(alias='createdAt', examples=['2019-07-08T11:27:57.401Z'])] - modified_at: Annotated[AwareDatetime, Field(alias='modifiedAt', examples=['2019-07-08T14:01:05.546Z'])] - stats: ActorStats - versions: list[Version] + versions: list[Version] | None = None pricing_infos: Annotated[ list[ Annotated[ @@ -828,36 +564,11 @@ class Actor(BaseModel): | None, Field(alias='pricingInfos'), ] = None - default_run_options: Annotated[DefaultRunOptions, Field(alias='defaultRunOptions')] - example_run_input: Annotated[ExampleRunInput | None, Field(alias='exampleRunInput')] = None - is_deprecated: Annotated[bool | None, Field(alias='isDeprecated', examples=[False])] = None - deployment_key: Annotated[str | None, Field(alias='deploymentKey', examples=['ssh-rsa AAAA ...'])] = None - title: Annotated[str | None, Field(examples=['My Actor'])] = None - tagged_builds: Annotated[dict[str, TaggedBuildInfo | None] | None, Field(alias='taggedBuilds')] = None + categories: list[str] | None = None + default_run_options: Annotated[DefaultRunOptions | None, Field(alias='defaultRunOptions')] = None actor_standby: Annotated[ActorStandby | None, Field(alias='actorStandby')] = None - readme_summary: Annotated[str | None, Field(alias='readmeSummary')] = None - """ - A brief, LLM-generated readme summary - """ - - -@docs_group('Models') -class ActorResponse(BaseModel): - """Response containing Actor data.""" - - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - data: Actor - - -@docs_group('Models') -class EnvVarRequest(EnvVar): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) + example_run_input: Annotated[ExampleRunInput | None, Field(alias='exampleRunInput')] = None + is_deprecated: Annotated[bool | None, Field(alias='isDeprecated')] = None @docs_group('Models') @@ -889,1429 +600,1752 @@ class CreateOrUpdateVersionRequest(BaseModel): @docs_group('Models') -class BuildTag(BaseModel): +class CreateTaskRequest(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - build_id: Annotated[str, Field(alias='buildId')] + act_id: Annotated[str, Field(alias='actId', examples=['asADASadYvn4mBZmm'])] + name: Annotated[str | None, Field(examples=['my-task'])] = None + options: TaskOptions | None = None + input: TaskInput | None = None + title: str | None = None + actor_standby: Annotated[ActorStandby | None, Field(alias='actorStandby')] = None @docs_group('Models') -class UpdateActorRequest(BaseModel): +class Current(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - name: Annotated[str | None, Field(examples=['MyActor'])] = None - description: Annotated[str | None, Field(examples=['My favourite actor!'])] = None - is_public: Annotated[bool | None, Field(alias='isPublic', examples=[False])] = None - actor_permission_level: Annotated[ActorPermissionLevel | None, Field(alias='actorPermissionLevel')] = None - seo_title: Annotated[str | None, Field(alias='seoTitle', examples=['My actor'])] = None - seo_description: Annotated[str | None, Field(alias='seoDescription', examples=['My actor is the best'])] = None - title: Annotated[str | None, Field(examples=['My Actor'])] = None - restart_on_error: Annotated[bool | None, Field(alias='restartOnError', deprecated=True, examples=[False])] = None - versions: list[CreateOrUpdateVersionRequest] | None = None - pricing_infos: Annotated[ - list[ - Annotated[ - PayPerEventActorPricingInfo - | PricePerDatasetItemActorPricingInfo - | FlatPricePerMonthActorPricingInfo - | FreeActorPricingInfo, - Field(discriminator='pricing_model'), - ] - ] - | None, - Field(alias='pricingInfos'), - ] = None - categories: list[str] | None = None - default_run_options: Annotated[DefaultRunOptions | None, Field(alias='defaultRunOptions')] = None - tagged_builds: Annotated[ - dict[str, Any] | None, - Field(alias='taggedBuilds', examples=[{'latest': {'buildId': 'z2EryhbfhgSyqj6Hn'}, 'beta': None}]), - ] = None - """ - An object to modify tags on the Actor's builds. The key is the tag name (e.g., _latest_), and the value is either an object with a `buildId` or `null`. - - This operation is a patch; any existing tags that you omit from this object will be preserved. - - - **To create or reassign a tag**, provide the tag name with a `buildId`. e.g., to assign the _latest_ tag: - -   + monthly_usage_usd: Annotated[float, Field(alias='monthlyUsageUsd', examples=[43])] + monthly_actor_compute_units: Annotated[float, Field(alias='monthlyActorComputeUnits', examples=[500.784475])] + monthly_external_data_transfer_gbytes: Annotated[ + float, Field(alias='monthlyExternalDataTransferGbytes', examples=[3.00861903931946]) + ] + monthly_proxy_serps: Annotated[int, Field(alias='monthlyProxySerps', examples=[34])] + monthly_residential_proxy_gbytes: Annotated[float, Field(alias='monthlyResidentialProxyGbytes', examples=[0.4])] + actor_memory_gbytes: Annotated[float, Field(alias='actorMemoryGbytes', examples=[8])] + actor_count: Annotated[int, Field(alias='actorCount', examples=[31])] + actor_task_count: Annotated[int, Field(alias='actorTaskCount', examples=[130])] + active_actor_job_count: Annotated[int, Field(alias='activeActorJobCount', examples=[0])] + team_account_seat_count: Annotated[int, Field(alias='teamAccountSeatCount', examples=[5])] - ```json - { - "latest": { - "buildId": "z2EryhbfhgSyqj6Hn" - } - } - ``` - - **To remove a tag**, provide the tag name with a `null` value. e.g., to remove the _beta_ tag: +@docs_group('Models') +class CurrentPricingInfo(BaseModel): + model_config = ConfigDict( + extra='allow', + populate_by_name=True, + ) + pricing_model: Annotated[str, Field(alias='pricingModel', examples=['FREE'])] -   - ```json - { - "beta": null - } - ``` +@docs_group('Models') +class DailyServiceUsages(BaseModel): + model_config = ConfigDict( + extra='allow', + populate_by_name=True, + ) + date: Annotated[str, Field(examples=['2022-10-02T00:00:00.000Z'])] + service_usage: Annotated[dict[str, UsageItem], Field(alias='serviceUsage')] + total_usage_credits_usd: Annotated[float, Field(alias='totalUsageCreditsUsd', examples=[0.0474385791970591])] - - **To perform multiple operations**, combine them. The following reassigns _latest_ and removes _beta_, while preserving any other existing tags. -   +@docs_group('Models') +class Dataset(BaseModel): + model_config = ConfigDict( + extra='allow', + populate_by_name=True, + ) + id: Annotated[str, Field(examples=['WkzbQMuFYuamGv3YF'])] + name: Annotated[str | None, Field(examples=['d7b9MDYsbtX5L7XAj'])] = None + user_id: Annotated[str, Field(alias='userId', examples=['wRsJZtadYvn4mBZmm'])] + created_at: Annotated[AwareDatetime, Field(alias='createdAt', examples=['2019-12-12T07:34:14.202Z'])] + modified_at: Annotated[AwareDatetime, Field(alias='modifiedAt', examples=['2019-12-13T08:36:13.202Z'])] + accessed_at: Annotated[AwareDatetime, Field(alias='accessedAt', examples=['2019-12-14T08:36:13.202Z'])] + item_count: Annotated[int, Field(alias='itemCount', examples=[7], ge=0)] + clean_item_count: Annotated[int, Field(alias='cleanItemCount', examples=[5], ge=0)] + act_id: Annotated[str | None, Field(alias='actId')] = None + act_run_id: Annotated[str | None, Field(alias='actRunId')] = None + fields: list[str] | None = None + schema_: Annotated[ + dict[str, Any] | None, + Field( + alias='schema', + examples=[ + { + 'actorSpecification': 1, + 'title': 'My dataset', + 'views': { + 'overview': { + 'title': 'Overview', + 'transformation': {'fields': ['linkUrl']}, + 'display': { + 'component': 'table', + 'properties': {'linkUrl': {'label': 'Link URL', 'format': 'link'}}, + }, + } + }, + } + ], + ), + ] = None + """ + Defines the schema of items in your dataset, the full specification can be found in [Apify docs](/platform/actors/development/actor-definition/dataset-schema) + """ + console_url: Annotated[ + AnyUrl, Field(alias='consoleUrl', examples=['https://console.apify.com/storage/datasets/27TmTznX9YPeAYhkC']) + ] + items_public_url: Annotated[ + AnyUrl | None, + Field( + alias='itemsPublicUrl', + examples=['https://api.apify.com/v2/datasets/WkzbQMuFYuamGv3YF/items?signature=abc123'], + ), + ] = None + """ + A public link to access the dataset items directly. + """ + url_signing_secret_key: Annotated[str | None, Field(alias='urlSigningSecretKey')] = None + """ + A secret key for generating signed public URLs. It is only provided to clients with WRITE permission for the dataset. + """ + general_access: Annotated[GeneralAccess | None, Field(alias='generalAccess')] = None + stats: DatasetStats | None = None - ```json - { - "latest": { - "buildId": "z2EryhbfhgSyqj6Hn" - }, - "beta": null - } - ``` +@docs_group('Models') +class DatasetFieldStatistics(BaseModel): + model_config = ConfigDict( + extra='allow', + populate_by_name=True, + ) + min: float | None = None + """ + Minimum value of the field. For numbers, this is calculated directly. For strings, this is the length of the shortest string. For arrays, this is the length of the shortest array. For objects, this is the number of keys in the smallest object. + """ + max: float | None = None + """ + Maximum value of the field. For numbers, this is calculated directly. For strings, this is the length of the longest string. For arrays, this is the length of the longest array. For objects, this is the number of keys in the largest object. + """ + null_count: Annotated[int | None, Field(alias='nullCount')] = None + """ + How many items in the dataset have a null value for this field. + """ + empty_count: Annotated[int | None, Field(alias='emptyCount')] = None + """ + How many items in the dataset are `undefined`, meaning that for example empty string is not considered empty. """ - actor_standby: Annotated[ActorStandby | None, Field(alias='actorStandby')] = None - example_run_input: Annotated[ExampleRunInput | None, Field(alias='exampleRunInput')] = None - is_deprecated: Annotated[bool | None, Field(alias='isDeprecated')] = None @docs_group('Models') -class ListOfVersions(BaseModel): +class DatasetListItem(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - total: Annotated[int, Field(examples=[5])] - items: list[Version] + id: Annotated[str, Field(examples=['WkzbQMuFYuamGv3YF'])] + name: Annotated[str, Field(examples=['d7b9MDYsbtX5L7XAj'])] + user_id: Annotated[str, Field(alias='userId', examples=['tbXmWu7GCxnyYtSiL'])] + created_at: Annotated[AwareDatetime, Field(alias='createdAt', examples=['2019-12-12T07:34:14.202Z'])] + modified_at: Annotated[AwareDatetime, Field(alias='modifiedAt', examples=['2019-12-13T08:36:13.202Z'])] + accessed_at: Annotated[AwareDatetime, Field(alias='accessedAt', examples=['2019-12-14T08:36:13.202Z'])] + item_count: Annotated[int, Field(alias='itemCount', examples=[7])] + clean_item_count: Annotated[int, Field(alias='cleanItemCount', examples=[5])] + act_id: Annotated[str | None, Field(alias='actId', examples=['zdc3Pyhyz3m8vjDeM'])] = None + act_run_id: Annotated[str | None, Field(alias='actRunId', examples=['HG7ML7M8z78YcAPEB'])] = None @docs_group('Models') -class ListOfVersionsResponse(BaseModel): +class DatasetResponse(BaseModel): + """Response containing dataset metadata.""" + model_config = ConfigDict( extra='allow', populate_by_name=True, ) - data: ListOfVersions + data: Dataset @docs_group('Models') -class VersionResponse(BaseModel): +class DatasetSchemaValidationError(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - data: Version + type: Annotated[str | None, Field(examples=['schema-validation-error'])] = None + """ + The type of the error. + """ + message: Annotated[str | None, Field(examples=['Schema validation failed'])] = None + """ + A human-readable message describing the error. + """ + data: SchemaValidationErrorData | None = None @docs_group('Models') -class ListOfEnvVars(BaseModel): +class DatasetStatistics(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - total: Annotated[int, Field(examples=[5])] - items: list[EnvVar] + field_statistics: Annotated[dict[str, Any] | None, Field(alias='fieldStatistics')] = None + """ + When you configure the dataset [fields schema](https://docs.apify.com/platform/actors/development/actor-definition/dataset-schema/validation), we measure the statistics such as `min`, `max`, `nullCount` and `emptyCount` for each field. This property provides statistics for each field from dataset fields schema.

See dataset field statistics [documentation](https://docs.apify.com/platform/actors/development/actor-definition/dataset-schema/validation#dataset-field-statistics) for more information. + """ @docs_group('Models') -class ListOfEnvVarsResponse(BaseModel): +class DatasetStatisticsResponse(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - data: ListOfEnvVars + data: DatasetStatistics @docs_group('Models') -class EnvVarResponse(BaseModel): +class DatasetStats(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - data: EnvVar + read_count: Annotated[int, Field(alias='readCount', examples=[22])] + write_count: Annotated[int, Field(alias='writeCount', examples=[3])] + storage_bytes: Annotated[int, Field(alias='storageBytes', examples=[783])] @docs_group('Models') -class WebhookEventType(StrEnum): - """Type of event that triggers the webhook.""" +class Datasets(BaseModel): + """Aliased dataset IDs for this run.""" - ACTOR_BUILD_ABORTED = 'ACTOR.BUILD.ABORTED' - ACTOR_BUILD_CREATED = 'ACTOR.BUILD.CREATED' - ACTOR_BUILD_FAILED = 'ACTOR.BUILD.FAILED' - ACTOR_BUILD_SUCCEEDED = 'ACTOR.BUILD.SUCCEEDED' - ACTOR_BUILD_TIMED_OUT = 'ACTOR.BUILD.TIMED_OUT' - ACTOR_RUN_ABORTED = 'ACTOR.RUN.ABORTED' - ACTOR_RUN_CREATED = 'ACTOR.RUN.CREATED' - ACTOR_RUN_FAILED = 'ACTOR.RUN.FAILED' - ACTOR_RUN_RESURRECTED = 'ACTOR.RUN.RESURRECTED' - ACTOR_RUN_SUCCEEDED = 'ACTOR.RUN.SUCCEEDED' - ACTOR_RUN_TIMED_OUT = 'ACTOR.RUN.TIMED_OUT' - TEST = 'TEST' + model_config = ConfigDict( + extra='allow', + populate_by_name=True, + ) + default: Annotated[str | None, Field(examples=['wmKPijuyDnPZAPRMk'])] = None + """ + ID of the default dataset for this run. + """ @docs_group('Models') -class WebhookCondition(BaseModel): +class DecodeAndVerifyData(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - actor_id: Annotated[str | None, Field(alias='actorId', examples=['hksJZtadYvn4mBuin'])] = None - actor_task_id: Annotated[str | None, Field(alias='actorTaskId', examples=['asdLZtadYvn4mBZmm'])] = None - actor_run_id: Annotated[str | None, Field(alias='actorRunId', examples=['hgdKZtadYvn4mBpoi'])] = None + decoded: Any + """ + The original object that was encoded. + """ + encoded_by_user_id: Annotated[str | None, Field(alias='encodedByUserId', examples=['wRwJZtadYvn4mBZmm'])] + is_verified_user: Annotated[bool, Field(alias='isVerifiedUser', examples=[False])] @docs_group('Models') -class WebhookDispatchStatus(StrEnum): - """Status of the webhook dispatch indicating whether the HTTP request was successful.""" +class DecodeAndVerifyRequest(BaseModel): + model_config = ConfigDict( + extra='allow', + populate_by_name=True, + ) + encoded: Annotated[str, Field(examples=['eyJwYXlsb2FkIjoiLi4uIiwic2lnbmF0dXJlIjoiLi4uIn0='])] - ACTIVE = 'ACTIVE' - SUCCEEDED = 'SUCCEEDED' - FAILED = 'FAILED' + +@docs_group('Models') +class DecodeAndVerifyResponse(BaseModel): + model_config = ConfigDict( + extra='allow', + populate_by_name=True, + ) + data: DecodeAndVerifyData @docs_group('Models') -class ExampleWebhookDispatch(BaseModel): +class DefaultRunOptions(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - status: WebhookDispatchStatus - finished_at: Annotated[AwareDatetime | None, Field(alias='finishedAt', examples=['2019-12-13T08:36:13.202Z'])] = ( - None + build: Annotated[str | None, Field(examples=['latest'])] = None + timeout_secs: Annotated[int | None, Field(alias='timeoutSecs', examples=[3600])] = None + memory_mbytes: Annotated[int | None, Field(alias='memoryMbytes', examples=[2048])] = None + restart_on_error: Annotated[bool | None, Field(alias='restartOnError', examples=[False])] = None + max_items: Annotated[int | None, Field(alias='maxItems')] = None + force_permission_level: Annotated[ActorPermissionLevel | None, Field(alias='forcePermissionLevel')] = None + + +@docs_group('Models') +class DeletedRequestById(BaseModel): + """Confirmation of a request that was successfully deleted, identified by its ID.""" + + model_config = ConfigDict( + extra='allow', + populate_by_name=True, + ) + unique_key: Annotated[ + str | None, Field(alias='uniqueKey', examples=['GET|60d83e70|e3b0c442|https://apify.com']) + ] = None + """ + A unique key used for request de-duplication. Requests with the same unique key are considered identical. + """ + id: Annotated[str, Field(examples=['sbJ7klsdf7ujN9l'])] + """ + A unique identifier assigned to the request. + """ + + +@docs_group('Models') +class DeletedRequestByUniqueKey(BaseModel): + """Confirmation of a request that was successfully deleted, identified by its unique key.""" + + model_config = ConfigDict( + extra='allow', + populate_by_name=True, + ) + unique_key: Annotated[str, Field(alias='uniqueKey', examples=['GET|60d83e70|e3b0c442|https://apify.com'])] + """ + A unique key used for request de-duplication. Requests with the same unique key are considered identical. + """ + id: Annotated[str | None, Field(examples=['sbJ7klsdf7ujN9l'])] = None + """ + A unique identifier assigned to the request. + """ + + +@docs_group('Models') +class EffectivePlatformFeature(BaseModel): + model_config = ConfigDict( + extra='allow', + populate_by_name=True, + ) + is_enabled: Annotated[bool, Field(alias='isEnabled', examples=[True])] + disabled_reason: Annotated[ + str | None, + Field( + alias='disabledReason', + examples=[ + 'The "Selected public Actors for developers" feature is not enabled for your account. Please upgrade your plan or contact support@apify.com' + ], + ), + ] + disabled_reason_type: Annotated[str | None, Field(alias='disabledReasonType', examples=['DISABLED'])] + is_trial: Annotated[bool, Field(alias='isTrial', examples=[False])] + trial_expiration_at: Annotated[ + AwareDatetime | None, Field(alias='trialExpirationAt', examples=['2025-01-01T14:00:00.000Z']) + ] + + +@docs_group('Models') +class EffectivePlatformFeatures(BaseModel): + model_config = ConfigDict( + extra='allow', + populate_by_name=True, + ) + actors: Annotated[EffectivePlatformFeature, Field(alias='ACTORS')] + storage: Annotated[EffectivePlatformFeature, Field(alias='STORAGE')] + scheduler: Annotated[EffectivePlatformFeature, Field(alias='SCHEDULER')] + proxy: Annotated[EffectivePlatformFeature, Field(alias='PROXY')] + proxy_external_access: Annotated[EffectivePlatformFeature, Field(alias='PROXY_EXTERNAL_ACCESS')] + proxy_residential: Annotated[EffectivePlatformFeature, Field(alias='PROXY_RESIDENTIAL')] + proxy_serps: Annotated[EffectivePlatformFeature, Field(alias='PROXY_SERPS')] + webhooks: Annotated[EffectivePlatformFeature, Field(alias='WEBHOOKS')] + actors_public_all: Annotated[EffectivePlatformFeature, Field(alias='ACTORS_PUBLIC_ALL')] + actors_public_developer: Annotated[EffectivePlatformFeature, Field(alias='ACTORS_PUBLIC_DEVELOPER')] + + +@docs_group('Models') +class EncodeAndSignData(BaseModel): + model_config = ConfigDict( + extra='allow', + populate_by_name=True, + ) + encoded: Annotated[str, Field(examples=['eyJwYXlsb2FkIjoiLi4uIiwic2lnbmF0dXJlIjoiLi4uIn0='])] + + +@docs_group('Models') +class EncodeAndSignResponse(BaseModel): + model_config = ConfigDict( + extra='allow', + populate_by_name=True, + ) + data: EncodeAndSignData + + +@docs_group('Models') +class EnvVar(BaseModel): + model_config = ConfigDict( + extra='allow', + populate_by_name=True, + ) + name: Annotated[str, Field(examples=['MY_ENV_VAR'])] + value: Annotated[str | None, Field(examples=['my-value'])] = None + """ + The environment variable value. This field is absent in responses when `isSecret` is `true`, as secret values are never returned by the API. + """ + is_secret: Annotated[bool | None, Field(alias='isSecret', examples=[False])] = None + + +@docs_group('Models') +class EnvVarRequest(EnvVar): + model_config = ConfigDict( + extra='allow', + populate_by_name=True, + ) + + +@docs_group('Models') +class EnvVarResponse(BaseModel): + model_config = ConfigDict( + extra='allow', + populate_by_name=True, + ) + data: EnvVar + + +@docs_group('Models') +class ErrorDetail(BaseModel): + model_config = ConfigDict( + extra='allow', + populate_by_name=True, + ) + type: ErrorType | None = None + message: str | None = None + """ + Human-readable error message describing what went wrong. + """ + + +@docs_group('Models') +class ErrorResponse(BaseModel): + model_config = ConfigDict( + extra='allow', + populate_by_name=True, + ) + error: ErrorDetail + + +@docs_group('Models') +class ErrorType(StrEnum): + """Machine-processable error type identifier.""" + + FIELD_3D_SECURE_AUTH_FAILED = '3d-secure-auth-failed' + ACCESS_RIGHT_ALREADY_EXISTS = 'access-right-already-exists' + ACTION_NOT_FOUND = 'action-not-found' + ACTOR_ALREADY_RENTED = 'actor-already-rented' + ACTOR_CAN_NOT_BE_RENTED = 'actor-can-not-be-rented' + ACTOR_DISABLED = 'actor-disabled' + ACTOR_IS_NOT_RENTED = 'actor-is-not-rented' + ACTOR_MEMORY_LIMIT_EXCEEDED = 'actor-memory-limit-exceeded' + ACTOR_NAME_EXISTS_NEW_OWNER = 'actor-name-exists-new-owner' + ACTOR_NAME_NOT_UNIQUE = 'actor-name-not-unique' + ACTOR_NOT_FOUND = 'actor-not-found' + ACTOR_NOT_GITHUB_ACTOR = 'actor-not-github-actor' + ACTOR_NOT_PUBLIC = 'actor-not-public' + ACTOR_PERMISSION_LEVEL_NOT_SUPPORTED_FOR_AGENTIC_PAYMENTS = ( + 'actor-permission-level-not-supported-for-agentic-payments' ) + ACTOR_REVIEW_ALREADY_EXISTS = 'actor-review-already-exists' + ACTOR_RUN_FAILED = 'actor-run-failed' + ACTOR_STANDBY_NOT_SUPPORTED_FOR_AGENTIC_PAYMENTS = 'actor-standby-not-supported-for-agentic-payments' + ACTOR_TASK_NAME_NOT_UNIQUE = 'actor-task-name-not-unique' + AGENTIC_PAYMENT_INFO_RETRIEVAL_ERROR = 'agentic-payment-info-retrieval-error' + AGENTIC_PAYMENT_INFORMATION_MISSING = 'agentic-payment-information-missing' + AGENTIC_PAYMENT_INSUFFICIENT_AMOUNT = 'agentic-payment-insufficient-amount' + AGENTIC_PAYMENT_PROVIDER_INTERNAL_ERROR = 'agentic-payment-provider-internal-error' + AGENTIC_PAYMENT_PROVIDER_UNAUTHORIZED = 'agentic-payment-provider-unauthorized' + AIRTABLE_WEBHOOK_DEPRECATED = 'airtable-webhook-deprecated' + ALREADY_SUBSCRIBED_TO_PAID_ACTOR = 'already-subscribed-to-paid-actor' + APIFY_PLAN_REQUIRED_TO_USE_PAID_ACTOR = 'apify-plan-required-to-use-paid-actor' + APIFY_SIGNUP_NOT_ALLOWED = 'apify-signup-not-allowed' + AUTH_METHOD_NOT_SUPPORTED = 'auth-method-not-supported' + AUTHORIZATION_SERVER_NOT_FOUND = 'authorization-server-not-found' + AUTO_ISSUE_DATE_INVALID = 'auto-issue-date-invalid' + BACKGROUND_CHECK_REQUIRED = 'background-check-required' + BILLING_SYSTEM_ERROR = 'billing-system-error' + BLACK_FRIDAY_PLAN_EXPIRED = 'black-friday-plan-expired' + BRAINTREE_ERROR = 'braintree-error' + BRAINTREE_NOT_LINKED = 'braintree-not-linked' + BRAINTREE_OPERATION_TIMED_OUT = 'braintree-operation-timed-out' + BRAINTREE_UNSUPPORTED_CURRENCY = 'braintree-unsupported-currency' + BUILD_NOT_FOUND = 'build-not-found' + BUILD_OUTDATED = 'build-outdated' + CANNOT_ADD_APIFY_EVENTS_TO_PPE_ACTOR = 'cannot-add-apify-events-to-ppe-actor' + CANNOT_ADD_MULTIPLE_PRICING_INFOS = 'cannot-add-multiple-pricing-infos' + CANNOT_ADD_PRICING_INFO_THAT_ALTERS_PAST = 'cannot-add-pricing-info-that-alters-past' + CANNOT_ADD_SECOND_FUTURE_PRICING_INFO = 'cannot-add-second-future-pricing-info' + CANNOT_BUILD_ACTOR_FROM_WEBHOOK = 'cannot-build-actor-from-webhook' + CANNOT_CHANGE_BILLING_INTERVAL = 'cannot-change-billing-interval' + CANNOT_CHANGE_OWNER = 'cannot-change-owner' + CANNOT_CHARGE_APIFY_EVENT = 'cannot-charge-apify-event' + CANNOT_CHARGE_NON_PAY_PER_EVENT_ACTOR = 'cannot-charge-non-pay-per-event-actor' + CANNOT_COMMENT_AS_OTHER_USER = 'cannot-comment-as-other-user' + CANNOT_COPY_ACTOR_TASK = 'cannot-copy-actor-task' + CANNOT_CREATE_PAYOUT = 'cannot-create-payout' + CANNOT_CREATE_PUBLIC_ACTOR = 'cannot-create-public-actor' + CANNOT_CREATE_TAX_TRANSACTION = 'cannot-create-tax-transaction' + CANNOT_DELETE_CRITICAL_ACTOR = 'cannot-delete-critical-actor' + CANNOT_DELETE_INVOICE = 'cannot-delete-invoice' + CANNOT_DELETE_PAID_ACTOR = 'cannot-delete-paid-actor' + CANNOT_DISABLE_ONE_TIME_EVENT_FOR_APIFY_START_EVENT = 'cannot-disable-one-time-event-for-apify-start-event' + CANNOT_DISABLE_ORGANIZATION_WITH_ENABLED_MEMBERS = 'cannot-disable-organization-with-enabled-members' + CANNOT_DISABLE_USER_WITH_SUBSCRIPTION = 'cannot-disable-user-with-subscription' + CANNOT_LINK_OAUTH_TO_UNVERIFIED_EMAIL = 'cannot-link-oauth-to-unverified-email' + CANNOT_METAMORPH_TO_PAY_PER_RESULT_ACTOR = 'cannot-metamorph-to-pay-per-result-actor' + CANNOT_MODIFY_ACTOR_PRICING_TOO_FREQUENTLY = 'cannot-modify-actor-pricing-too-frequently' + CANNOT_MODIFY_ACTOR_PRICING_WITH_IMMEDIATE_EFFECT = 'cannot-modify-actor-pricing-with-immediate-effect' + CANNOT_OVERRIDE_PAID_ACTOR_TRIAL = 'cannot-override-paid-actor-trial' + CANNOT_PERMANENTLY_DELETE_SUBSCRIPTION = 'cannot-permanently-delete-subscription' + CANNOT_PUBLISH_ACTOR = 'cannot-publish-actor' + CANNOT_REDUCE_LAST_FULL_TOKEN = 'cannot-reduce-last-full-token' + CANNOT_REIMBURSE_MORE_THAN_ORIGINAL_CHARGE = 'cannot-reimburse-more-than-original-charge' + CANNOT_REIMBURSE_NON_RENTAL_CHARGE = 'cannot-reimburse-non-rental-charge' + CANNOT_REMOVE_OWN_ACTOR_FROM_RECENTLY_USED = 'cannot-remove-own-actor-from-recently-used' + CANNOT_REMOVE_PAYMENT_METHOD = 'cannot-remove-payment-method' + CANNOT_REMOVE_PRICING_INFO = 'cannot-remove-pricing-info' + CANNOT_REMOVE_RUNNING_RUN = 'cannot-remove-running-run' + CANNOT_REMOVE_USER_WITH_PUBLIC_ACTORS = 'cannot-remove-user-with-public-actors' + CANNOT_REMOVE_USER_WITH_SUBSCRIPTION = 'cannot-remove-user-with-subscription' + CANNOT_REMOVE_USER_WITH_UNPAID_INVOICE = 'cannot-remove-user-with-unpaid-invoice' + CANNOT_RENAME_ENV_VAR = 'cannot-rename-env-var' + CANNOT_RENT_PAID_ACTOR = 'cannot-rent-paid-actor' + CANNOT_REVIEW_OWN_ACTOR = 'cannot-review-own-actor' + CANNOT_SET_ACCESS_RIGHTS_FOR_OWNER = 'cannot-set-access-rights-for-owner' + CANNOT_SET_IS_STATUS_MESSAGE_TERMINAL = 'cannot-set-is-status-message-terminal' + CANNOT_UNPUBLISH_CRITICAL_ACTOR = 'cannot-unpublish-critical-actor' + CANNOT_UNPUBLISH_PAID_ACTOR = 'cannot-unpublish-paid-actor' + CANNOT_UNPUBLISH_PROFILE = 'cannot-unpublish-profile' + CANNOT_UPDATE_INVOICE_FIELD = 'cannot-update-invoice-field' + CONCURRENT_RUNS_LIMIT_EXCEEDED = 'concurrent-runs-limit-exceeded' + CONCURRENT_UPDATE_DETECTED = 'concurrent-update-detected' + CONFERENCE_TOKEN_NOT_FOUND = 'conference-token-not-found' + CONTENT_ENCODING_FORBIDDEN_FOR_HTML = 'content-encoding-forbidden-for-html' + COUPON_ALREADY_REDEEMED = 'coupon-already-redeemed' + COUPON_EXPIRED = 'coupon-expired' + COUPON_FOR_NEW_CUSTOMERS = 'coupon-for-new-customers' + COUPON_FOR_SUBSCRIBED_USERS = 'coupon-for-subscribed-users' + COUPON_LIMITS_ARE_IN_CONFLICT_WITH_CURRENT_LIMITS = 'coupon-limits-are-in-conflict-with-current-limits' + COUPON_MAX_NUMBER_OF_REDEMPTIONS_REACHED = 'coupon-max-number-of-redemptions-reached' + COUPON_NOT_FOUND = 'coupon-not-found' + COUPON_NOT_UNIQUE = 'coupon-not-unique' + COUPONS_DISABLED = 'coupons-disabled' + CREATE_GITHUB_ISSUE_NOT_ALLOWED = 'create-github-issue-not-allowed' + CREATOR_PLAN_NOT_AVAILABLE = 'creator-plan-not-available' + CRON_EXPRESSION_INVALID = 'cron-expression-invalid' + DAILY_AI_TOKEN_LIMIT_EXCEEDED = 'daily-ai-token-limit-exceeded' + DAILY_PUBLICATION_LIMIT_EXCEEDED = 'daily-publication-limit-exceeded' + DATASET_DOES_NOT_HAVE_FIELDS_SCHEMA = 'dataset-does-not-have-fields-schema' + DATASET_DOES_NOT_HAVE_SCHEMA = 'dataset-does-not-have-schema' + DATASET_LOCKED = 'dataset-locked' + DATASET_SCHEMA_INVALID = 'dataset-schema-invalid' + DCR_NOT_SUPPORTED = 'dcr-not-supported' + DEFAULT_DATASET_NOT_FOUND = 'default-dataset-not-found' + DELETING_DEFAULT_BUILD = 'deleting-default-build' + DELETING_UNFINISHED_BUILD = 'deleting-unfinished-build' + EMAIL_ALREADY_TAKEN = 'email-already-taken' + EMAIL_ALREADY_TAKEN_REMOVED_USER = 'email-already-taken-removed-user' + EMAIL_DOMAIN_NOT_ALLOWED_FOR_COUPON = 'email-domain-not-allowed-for-coupon' + EMAIL_INVALID = 'email-invalid' + EMAIL_NOT_ALLOWED = 'email-not-allowed' + EMAIL_NOT_VALID = 'email-not-valid' + EMAIL_UPDATE_TOO_SOON = 'email-update-too-soon' + ELEVATED_PERMISSIONS_NEEDED = 'elevated-permissions-needed' + ENV_VAR_ALREADY_EXISTS = 'env-var-already-exists' + EXCHANGE_RATE_FETCH_FAILED = 'exchange-rate-fetch-failed' + EXPIRED_CONFERENCE_TOKEN = 'expired-conference-token' + FAILED_TO_CHARGE_USER = 'failed-to-charge-user' + FINAL_INVOICE_NEGATIVE = 'final-invoice-negative' + GITHUB_BRANCH_EMPTY = 'github-branch-empty' + GITHUB_ISSUE_ALREADY_EXISTS = 'github-issue-already-exists' + GITHUB_PUBLIC_KEY_NOT_FOUND = 'github-public-key-not-found' + GITHUB_REPOSITORY_NOT_FOUND = 'github-repository-not-found' + GITHUB_SIGNATURE_DOES_NOT_MATCH_PAYLOAD = 'github-signature-does-not-match-payload' + GITHUB_USER_NOT_AUTHORIZED_FOR_ISSUES = 'github-user-not-authorized-for-issues' + GMAIL_NOT_ALLOWED = 'gmail-not-allowed' + ID_DOES_NOT_MATCH = 'id-does-not-match' + INCOMPATIBLE_BILLING_INTERVAL = 'incompatible-billing-interval' + INCOMPLETE_PAYOUT_BILLING_INFO = 'incomplete-payout-billing-info' + INCONSISTENT_CURRENCIES = 'inconsistent-currencies' + INCORRECT_PRICING_MODIFIER_PREFIX = 'incorrect-pricing-modifier-prefix' + INPUT_JSON_INVALID_CHARACTERS = 'input-json-invalid-characters' + INPUT_JSON_NOT_OBJECT = 'input-json-not-object' + INPUT_JSON_TOO_LONG = 'input-json-too-long' + INPUT_UPDATE_COLLISION = 'input-update-collision' + INSUFFICIENT_PERMISSIONS = 'insufficient-permissions' + INSUFFICIENT_PERMISSIONS_TO_CHANGE_FIELD = 'insufficient-permissions-to-change-field' + INSUFFICIENT_SECURITY_MEASURES = 'insufficient-security-measures' + INSUFFICIENT_TAX_COUNTRY_EVIDENCE = 'insufficient-tax-country-evidence' + INTEGRATION_AUTH_ERROR = 'integration-auth-error' + INTERNAL_SERVER_ERROR = 'internal-server-error' + INVALID_BILLING_INFO = 'invalid-billing-info' + INVALID_BILLING_PERIOD_FOR_PAYOUT = 'invalid-billing-period-for-payout' + INVALID_BUILD = 'invalid-build' + INVALID_CLIENT_KEY = 'invalid-client-key' + INVALID_COLLECTION = 'invalid-collection' + INVALID_CONFERENCE_LOGIN_PASSWORD = 'invalid-conference-login-password' + INVALID_CONTENT_TYPE_HEADER = 'invalid-content-type-header' + INVALID_CREDENTIALS = 'invalid-credentials' + INVALID_GIT_AUTH_TOKEN = 'invalid-git-auth-token' + INVALID_GITHUB_ISSUE_URL = 'invalid-github-issue-url' + INVALID_HEADER = 'invalid-header' + INVALID_ID = 'invalid-id' + INVALID_IDEMPOTENCY_KEY = 'invalid-idempotency-key' + INVALID_INPUT = 'invalid-input' + INVALID_INPUT_SCHEMA = 'invalid-input-schema' + INVALID_INVOICE = 'invalid-invoice' + INVALID_INVOICE_TYPE = 'invalid-invoice-type' + INVALID_ISSUE_DATE = 'invalid-issue-date' + INVALID_LABEL_PARAMS = 'invalid-label-params' + INVALID_MAIN_ACCOUNT_USER_ID = 'invalid-main-account-user-id' + INVALID_OAUTH_APP = 'invalid-oauth-app' + INVALID_OAUTH_SCOPE = 'invalid-oauth-scope' + INVALID_ONE_TIME_INVOICE = 'invalid-one-time-invoice' + INVALID_PARAMETER = 'invalid-parameter' + INVALID_PAYOUT_STATUS = 'invalid-payout-status' + INVALID_PICTURE_URL = 'invalid-picture-url' + INVALID_RECORD_KEY = 'invalid-record-key' + INVALID_REQUEST = 'invalid-request' + INVALID_RESOURCE_TYPE = 'invalid-resource-type' + INVALID_SIGNATURE = 'invalid-signature' + INVALID_SUBSCRIPTION_PLAN = 'invalid-subscription-plan' + INVALID_TAX_NUMBER = 'invalid-tax-number' + INVALID_TAX_NUMBER_FORMAT = 'invalid-tax-number-format' + INVALID_TOKEN = 'invalid-token' + INVALID_TOKEN_TYPE = 'invalid-token-type' + INVALID_TWO_FACTOR_CODE = 'invalid-two-factor-code' + INVALID_TWO_FACTOR_CODE_OR_RECOVERY_CODE = 'invalid-two-factor-code-or-recovery-code' + INVALID_TWO_FACTOR_RECOVERY_CODE = 'invalid-two-factor-recovery-code' + INVALID_USERNAME = 'invalid-username' + INVALID_VALUE = 'invalid-value' + INVITATION_INVALID_RESOURCE_TYPE = 'invitation-invalid-resource-type' + INVITATION_NO_LONGER_VALID = 'invitation-no-longer-valid' + INVOICE_CANCELED = 'invoice-canceled' + INVOICE_CANNOT_BE_REFUNDED_DUE_TO_TOO_HIGH_AMOUNT = 'invoice-cannot-be-refunded-due-to-too-high-amount' + INVOICE_INCOMPLETE = 'invoice-incomplete' + INVOICE_IS_DRAFT = 'invoice-is-draft' + INVOICE_LOCKED = 'invoice-locked' + INVOICE_MUST_BE_BUFFER = 'invoice-must-be-buffer' + INVOICE_NOT_CANCELED = 'invoice-not-canceled' + INVOICE_NOT_DRAFT = 'invoice-not-draft' + INVOICE_NOT_FOUND = 'invoice-not-found' + INVOICE_OUTDATED = 'invoice-outdated' + INVOICE_PAID_ALREADY = 'invoice-paid-already' + ISSUE_ALREADY_CONNECTED_TO_GITHUB = 'issue-already-connected-to-github' + ISSUE_NOT_FOUND = 'issue-not-found' + ISSUES_BAD_REQUEST = 'issues-bad-request' + ISSUER_NOT_REGISTERED = 'issuer-not-registered' + JOB_FINISHED = 'job-finished' + LABEL_ALREADY_LINKED = 'label-already-linked' + LAST_API_TOKEN = 'last-api-token' + LIMIT_REACHED = 'limit-reached' + MAX_ITEMS_MUST_BE_GREATER_THAN_ZERO = 'max-items-must-be-greater-than-zero' + MAX_METAMORPHS_EXCEEDED = 'max-metamorphs-exceeded' + MAX_TOTAL_CHARGE_USD_BELOW_MINIMUM = 'max-total-charge-usd-below-minimum' + MAX_TOTAL_CHARGE_USD_MUST_BE_GREATER_THAN_ZERO = 'max-total-charge-usd-must-be-greater-than-zero' + METHOD_NOT_ALLOWED = 'method-not-allowed' + MIGRATION_DISABLED = 'migration-disabled' + MISSING_ACTOR_RIGHTS = 'missing-actor-rights' + MISSING_API_TOKEN = 'missing-api-token' + MISSING_BILLING_INFO = 'missing-billing-info' + MISSING_LINE_ITEMS = 'missing-line-items' + MISSING_PAYMENT_DATE = 'missing-payment-date' + MISSING_PAYOUT_BILLING_INFO = 'missing-payout-billing-info' + MISSING_PROXY_PASSWORD = 'missing-proxy-password' + MISSING_REPORTING_FIELDS = 'missing-reporting-fields' + MISSING_RESOURCE_NAME = 'missing-resource-name' + MISSING_SETTINGS = 'missing-settings' + MISSING_USERNAME = 'missing-username' + MONTHLY_USAGE_LIMIT_TOO_LOW = 'monthly-usage-limit-too-low' + MORE_THAN_ONE_UPDATE_NOT_ALLOWED = 'more-than-one-update-not-allowed' + MULTIPLE_RECORDS_FOUND = 'multiple-records-found' + MUST_BE_ADMIN = 'must-be-admin' + NAME_NOT_UNIQUE = 'name-not-unique' + NEXT_RUNTIME_COMPUTATION_FAILED = 'next-runtime-computation-failed' + NO_COLUMNS_IN_EXPORTED_DATASET = 'no-columns-in-exported-dataset' + NO_PAYMENT_ATTEMPT_FOR_REFUND_FOUND = 'no-payment-attempt-for-refund-found' + NO_PAYMENT_METHOD_AVAILABLE = 'no-payment-method-available' + NO_TEAM_ACCOUNT_SEATS_AVAILABLE = 'no-team-account-seats-available' + NON_TEMPORARY_EMAIL = 'non-temporary-email' + NOT_ENOUGH_USAGE_TO_RUN_PAID_ACTOR = 'not-enough-usage-to-run-paid-actor' + NOT_IMPLEMENTED = 'not-implemented' + NOT_SUPPORTED_CURRENCIES = 'not-supported-currencies' + O_AUTH_SERVICE_ALREADY_CONNECTED = 'o-auth-service-already-connected' + O_AUTH_SERVICE_NOT_CONNECTED = 'o-auth-service-not-connected' + OAUTH_RESOURCE_ACCESS_FAILED = 'oauth-resource-access-failed' + ONE_TIME_INVOICE_ALREADY_MARKED_PAID = 'one-time-invoice-already-marked-paid' + ONLY_DRAFTS_CAN_BE_DELETED = 'only-drafts-can-be-deleted' + OPERATION_CANCELED = 'operation-canceled' + OPERATION_NOT_ALLOWED = 'operation-not-allowed' + OPERATION_TIMED_OUT = 'operation-timed-out' + ORGANIZATION_CANNOT_OWN_ITSELF = 'organization-cannot-own-itself' + ORGANIZATION_ROLE_NOT_FOUND = 'organization-role-not-found' + OVERLAPPING_PAYOUT_BILLING_PERIODS = 'overlapping-payout-billing-periods' + OWN_TOKEN_REQUIRED = 'own-token-required' + PAGE_NOT_FOUND = 'page-not-found' + PARAM_NOT_ONE_OF = 'param-not-one-of' + PARAMETER_REQUIRED = 'parameter-required' + PARAMETERS_MISMATCHED = 'parameters-mismatched' + PASSWORD_RESET_EMAIL_ALREADY_SENT = 'password-reset-email-already-sent' + PASSWORD_RESET_TOKEN_EXPIRED = 'password-reset-token-expired' + PAY_AS_YOU_GO_WITHOUT_MONTHLY_INTERVAL = 'pay-as-you-go-without-monthly-interval' + PAYMENT_ATTEMPT_STATUS_MESSAGE_REQUIRED = 'payment-attempt-status-message-required' + PAYOUT_ALREADY_PAID = 'payout-already-paid' + PAYOUT_CANCELED = 'payout-canceled' + PAYOUT_INVALID_STATE = 'payout-invalid-state' + PAYOUT_MUST_BE_APPROVED_TO_BE_MARKED_PAID = 'payout-must-be-approved-to-be-marked-paid' + PAYOUT_NOT_FOUND = 'payout-not-found' + PAYOUT_NUMBER_ALREADY_EXISTS = 'payout-number-already-exists' + PHONE_NUMBER_INVALID = 'phone-number-invalid' + PHONE_NUMBER_LANDLINE = 'phone-number-landline' + PHONE_NUMBER_OPTED_OUT = 'phone-number-opted-out' + PHONE_VERIFICATION_DISABLED = 'phone-verification-disabled' + PLATFORM_FEATURE_DISABLED = 'platform-feature-disabled' + PRICE_OVERRIDES_VALIDATION_FAILED = 'price-overrides-validation-failed' + PRICING_MODEL_NOT_SUPPORTED = 'pricing-model-not-supported' + PROMOTIONAL_PLAN_NOT_AVAILABLE = 'promotional-plan-not-available' + PROXY_AUTH_IP_NOT_UNIQUE = 'proxy-auth-ip-not-unique' + PUBLIC_ACTOR_DISABLED = 'public-actor-disabled' + QUERY_TIMEOUT = 'query-timeout' + QUOTED_PRICE_OUTDATED = 'quoted-price-outdated' + RATE_LIMIT_EXCEEDED = 'rate-limit-exceeded' + RECAPTCHA_INVALID = 'recaptcha-invalid' + RECAPTCHA_REQUIRED = 'recaptcha-required' + RECORD_NOT_FOUND = 'record-not-found' + RECORD_NOT_PUBLIC = 'record-not-public' + RECORD_OR_TOKEN_NOT_FOUND = 'record-or-token-not-found' + RECORD_TOO_LARGE = 'record-too-large' + REDIRECT_URI_MISMATCH = 'redirect-uri-mismatch' + REDUCED_PLAN_NOT_AVAILABLE = 'reduced-plan-not-available' + RENTAL_CHARGE_ALREADY_REIMBURSED = 'rental-charge-already-reimbursed' + RENTAL_NOT_ALLOWED = 'rental-not-allowed' + REQUEST_ABORTED_PREMATURELY = 'request-aborted-prematurely' + REQUEST_HANDLED_OR_LOCKED = 'request-handled-or-locked' + REQUEST_ID_INVALID = 'request-id-invalid' + REQUEST_QUEUE_DUPLICATE_REQUESTS = 'request-queue-duplicate-requests' + REQUEST_TOO_LARGE = 'request-too-large' + REQUESTED_DATASET_VIEW_DOES_NOT_EXIST = 'requested-dataset-view-does-not-exist' + RESUME_TOKEN_EXPIRED = 'resume-token-expired' + RUN_FAILED = 'run-failed' + RUN_TIMEOUT_EXCEEDED = 'run-timeout-exceeded' + RUSSIA_IS_EVIL = 'russia-is-evil' + SAME_USER = 'same-user' + SCHEDULE_ACTOR_NOT_FOUND = 'schedule-actor-not-found' + SCHEDULE_ACTOR_TASK_NOT_FOUND = 'schedule-actor-task-not-found' + SCHEDULE_NAME_NOT_UNIQUE = 'schedule-name-not-unique' + SCHEMA_VALIDATION = 'schema-validation' + SCHEMA_VALIDATION_FAILED = 'schema-validation-failed' + SIGN_UP_METHOD_NOT_ALLOWED = 'sign-up-method-not-allowed' + SLACK_INTEGRATION_NOT_CUSTOM = 'slack-integration-not-custom' + SOCKET_CLOSED = 'socket-closed' + SOCKET_DESTROYED = 'socket-destroyed' + STORE_SCHEMA_INVALID = 'store-schema-invalid' + STORE_TERMS_NOT_ACCEPTED = 'store-terms-not-accepted' + STRIPE_ENABLED = 'stripe-enabled' + STRIPE_GENERIC_DECLINE = 'stripe-generic-decline' + STRIPE_NOT_ENABLED = 'stripe-not-enabled' + STRIPE_NOT_ENABLED_FOR_USER = 'stripe-not-enabled-for-user' + TAGGED_BUILD_REQUIRED = 'tagged-build-required' + TAX_COUNTRY_INVALID = 'tax-country-invalid' + TAX_NUMBER_INVALID = 'tax-number-invalid' + TAX_NUMBER_VALIDATION_FAILED = 'tax-number-validation-failed' + TAXAMO_CALL_FAILED = 'taxamo-call-failed' + TAXAMO_REQUEST_FAILED = 'taxamo-request-failed' + TESTING_ERROR = 'testing-error' + TOKEN_NOT_PROVIDED = 'token-not-provided' + TOO_FEW_VERSIONS = 'too-few-versions' + TOO_MANY_ACTOR_TASKS = 'too-many-actor-tasks' + TOO_MANY_ACTORS = 'too-many-actors' + TOO_MANY_LABELS_ON_RESOURCE = 'too-many-labels-on-resource' + TOO_MANY_MCP_CONNECTORS = 'too-many-mcp-connectors' + TOO_MANY_O_AUTH_APPS = 'too-many-o-auth-apps' + TOO_MANY_ORGANIZATIONS = 'too-many-organizations' + TOO_MANY_REQUESTS = 'too-many-requests' + TOO_MANY_SCHEDULES = 'too-many-schedules' + TOO_MANY_UI_ACCESS_KEYS = 'too-many-ui-access-keys' + TOO_MANY_USER_LABELS = 'too-many-user-labels' + TOO_MANY_VALUES = 'too-many-values' + TOO_MANY_VERSIONS = 'too-many-versions' + TOO_MANY_WEBHOOKS = 'too-many-webhooks' + UNEXPECTED_ROUTE = 'unexpected-route' + UNKNOWN_BUILD_TAG = 'unknown-build-tag' + UNKNOWN_PAYMENT_PROVIDER = 'unknown-payment-provider' + UNSUBSCRIBE_TOKEN_INVALID = 'unsubscribe-token-invalid' + UNSUPPORTED_ACTOR_PRICING_MODEL_FOR_AGENTIC_PAYMENTS = 'unsupported-actor-pricing-model-for-agentic-payments' + UNSUPPORTED_CONTENT_ENCODING = 'unsupported-content-encoding' + UNSUPPORTED_FILE_TYPE_FOR_ISSUE = 'unsupported-file-type-for-issue' + UNSUPPORTED_FILE_TYPE_IMAGE_EXPECTED = 'unsupported-file-type-image-expected' + UNSUPPORTED_FILE_TYPE_TEXT_OR_JSON_EXPECTED = 'unsupported-file-type-text-or-json-expected' + UNSUPPORTED_PERMISSION = 'unsupported-permission' + UPCOMING_SUBSCRIPTION_BILL_NOT_UP_TO_DATE = 'upcoming-subscription-bill-not-up-to-date' + USER_ALREADY_EXISTS = 'user-already-exists' + USER_ALREADY_VERIFIED = 'user-already-verified' + USER_CREATES_ORGANIZATIONS_TOO_FAST = 'user-creates-organizations-too-fast' + USER_DISABLED = 'user-disabled' + USER_EMAIL_IS_DISPOSABLE = 'user-email-is-disposable' + USER_EMAIL_NOT_SET = 'user-email-not-set' + USER_EMAIL_NOT_VERIFIED = 'user-email-not-verified' + USER_HAS_NO_SUBSCRIPTION = 'user-has-no-subscription' + USER_INTEGRATION_NOT_FOUND = 'user-integration-not-found' + USER_IS_ALREADY_INVITED = 'user-is-already-invited' + USER_IS_ALREADY_ORGANIZATION_MEMBER = 'user-is-already-organization-member' + USER_IS_NOT_MEMBER_OF_ORGANIZATION = 'user-is-not-member-of-organization' + USER_IS_NOT_ORGANIZATION = 'user-is-not-organization' + USER_IS_ORGANIZATION = 'user-is-organization' + USER_IS_ORGANIZATION_OWNER = 'user-is-organization-owner' + USER_IS_REMOVED = 'user-is-removed' + USER_NOT_FOUND = 'user-not-found' + USER_NOT_LOGGED_IN = 'user-not-logged-in' + USER_NOT_VERIFIED = 'user-not-verified' + USER_OR_TOKEN_NOT_FOUND = 'user-or-token-not-found' + USER_PLAN_NOT_ALLOWED_FOR_COUPON = 'user-plan-not-allowed-for-coupon' + USER_PROBLEM_WITH_CARD = 'user-problem-with-card' + USER_RECORD_NOT_FOUND = 'user-record-not-found' + USERNAME_ALREADY_TAKEN = 'username-already-taken' + USERNAME_MISSING = 'username-missing' + USERNAME_NOT_ALLOWED = 'username-not-allowed' + USERNAME_REMOVAL_FORBIDDEN = 'username-removal-forbidden' + USERNAME_REQUIRED = 'username-required' + VERIFICATION_EMAIL_ALREADY_SENT = 'verification-email-already-sent' + VERIFICATION_TOKEN_EXPIRED = 'verification-token-expired' + VERSION_ALREADY_EXISTS = 'version-already-exists' + VERSIONS_SIZE_EXCEEDED = 'versions-size-exceeded' + WEAK_PASSWORD = 'weak-password' + X402_AGENTIC_PAYMENT_ALREADY_FINALIZED = 'x402-agentic-payment-already-finalized' + X402_AGENTIC_PAYMENT_INSUFFICIENT_AMOUNT = 'x402-agentic-payment-insufficient-amount' + X402_AGENTIC_PAYMENT_MALFORMED_TOKEN = 'x402-agentic-payment-malformed-token' + X402_AGENTIC_PAYMENT_SETTLEMENT_FAILED = 'x402-agentic-payment-settlement-failed' + X402_AGENTIC_PAYMENT_SETTLEMENT_IN_PROGRESS = 'x402-agentic-payment-settlement-in-progress' + X402_AGENTIC_PAYMENT_SETTLEMENT_STUCK = 'x402-agentic-payment-settlement-stuck' + X402_AGENTIC_PAYMENT_UNAUTHORIZED = 'x402-agentic-payment-unauthorized' + X402_PAYMENT_REQUIRED = 'x402-payment-required' + ZERO_INVOICE = 'zero-invoice' @docs_group('Models') -class WebhookStats(BaseModel): +class EventData(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - total_dispatches: Annotated[int, Field(alias='totalDispatches', examples=[1])] + actor_id: Annotated[str, Field(alias='actorId', examples=['vvE7iMKuMc5qTHHsR'])] + actor_run_id: Annotated[str, Field(alias='actorRunId', examples=['JgwXN9BdwxGcu9MMF'])] @docs_group('Models') -class WebhookShort(BaseModel): +class ExampleRunInput(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - id: Annotated[str, Field(examples=['YiKoxjkaS9gjGTqhF'])] - created_at: Annotated[AwareDatetime, Field(alias='createdAt', examples=['2019-12-12T07:34:14.202Z'])] - modified_at: Annotated[AwareDatetime, Field(alias='modifiedAt', examples=['2019-12-13T08:36:13.202Z'])] - user_id: Annotated[str, Field(alias='userId', examples=['wRsJZtadYvn4mBZmm'])] - is_ad_hoc: Annotated[bool | None, Field(alias='isAdHoc', examples=[False])] = None - should_interpolate_strings: Annotated[bool | None, Field(alias='shouldInterpolateStrings', examples=[False])] = None - event_types: Annotated[list[WebhookEventType], Field(alias='eventTypes', examples=[['ACTOR.RUN.SUCCEEDED']])] - condition: WebhookCondition - ignore_ssl_errors: Annotated[bool, Field(alias='ignoreSslErrors', examples=[False])] - do_not_retry: Annotated[bool, Field(alias='doNotRetry', examples=[False])] - request_url: Annotated[AnyUrl, Field(alias='requestUrl', examples=['http://example.com/'])] - last_dispatch: Annotated[ExampleWebhookDispatch | None, Field(alias='lastDispatch')] = None - stats: WebhookStats | None = None + body: Annotated[str | None, Field(examples=['{ "helloWorld": 123 }'])] = None + content_type: Annotated[str | None, Field(alias='contentType', examples=['application/json; charset=utf-8'])] = None @docs_group('Models') -class ListOfWebhooks(PaginationResponse): +class ExampleWebhookDispatch(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - items: list[WebhookShort] - - -@docs_group('Models') -class ListOfWebhooksResponse(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, + status: WebhookDispatchStatus + finished_at: Annotated[AwareDatetime | None, Field(alias='finishedAt', examples=['2019-12-13T08:36:13.202Z'])] = ( + None ) - data: ListOfWebhooks - - -@docs_group('Models') -class ActorJobStatus(StrEnum): - """Status of an Actor job (run or build).""" - - READY = 'READY' - RUNNING = 'RUNNING' - SUCCEEDED = 'SUCCEEDED' - FAILED = 'FAILED' - TIMING_OUT = 'TIMING-OUT' - TIMED_OUT = 'TIMED-OUT' - ABORTING = 'ABORTING' - ABORTED = 'ABORTED' - - -@docs_group('Models') -class RunOrigin(StrEnum): - DEVELOPMENT = 'DEVELOPMENT' - WEB = 'WEB' - API = 'API' - SCHEDULER = 'SCHEDULER' - TEST = 'TEST' - WEBHOOK = 'WEBHOOK' - ACTOR = 'ACTOR' - CLI = 'CLI' - STANDBY = 'STANDBY' @docs_group('Models') -class BuildsMeta(BaseModel): +class FlatPricePerMonthActorPricingInfo(CommonActorPricingInfo): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - origin: RunOrigin - client_ip: Annotated[str | None, Field(alias='clientIp', examples=['172.234.12.34'])] = None - """ - IP address of the client that started the build. - """ - user_agent: Annotated[str | None, Field(alias='userAgent', examples=['Mozilla/5.0 (iPad)'])] = None + pricing_model: Annotated[Literal['FLAT_PRICE_PER_MONTH'], Field(alias='pricingModel')] + trial_minutes: Annotated[int, Field(alias='trialMinutes')] """ - User agent of the client that started the build. + For how long this Actor can be used for free in trial period """ - - -@docs_group('Models') -class BuildShort(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - id: Annotated[str, Field(examples=['HG7ML7M8z78YcAPEB'])] - act_id: Annotated[str | None, Field(alias='actId', examples=['janedoe~my-actor'])] = None - status: ActorJobStatus - started_at: Annotated[AwareDatetime, Field(alias='startedAt', examples=['2019-11-30T07:34:24.202Z'])] - finished_at: Annotated[AwareDatetime | None, Field(alias='finishedAt', examples=['2019-12-12T09:30:12.202Z'])] = ( - None - ) - usage_total_usd: Annotated[float, Field(alias='usageTotalUsd', examples=[0.02])] - meta: BuildsMeta | None = None - - -@docs_group('Models') -class ListOfBuilds(PaginationResponse): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - items: list[BuildShort] - - -@docs_group('Models') -class ListOfBuildsResponse(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - data: ListOfBuilds - - -@docs_group('Models') -class BuildStats(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - duration_millis: Annotated[int | None, Field(alias='durationMillis', examples=[1000])] = None - run_time_secs: Annotated[float | None, Field(alias='runTimeSecs', examples=[45.718])] = None - compute_units: Annotated[float, Field(alias='computeUnits', examples=[0.0126994444444444])] - - -@docs_group('Models') -class BuildOptions(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - use_cache: Annotated[bool | None, Field(alias='useCache', examples=[False])] = None - beta_packages: Annotated[bool | None, Field(alias='betaPackages', examples=[False])] = None - memory_mbytes: Annotated[int | None, Field(alias='memoryMbytes', examples=[1024])] = None - disk_mbytes: Annotated[int | None, Field(alias='diskMbytes', examples=[2048])] = None - - -@docs_group('Models') -class BuildUsage(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - actor_compute_units: Annotated[float | None, Field(alias='ACTOR_COMPUTE_UNITS', examples=[0.08])] = None - - -@docs_group('Models') -class Storages(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - dataset: dict[str, Any] | None = None + price_per_unit_usd: Annotated[float, Field(alias='pricePerUnitUsd')] """ - Defines the schema of items in your dataset, the full specification can be found in [Apify docs](https://docs.apify.com/platform/actors/development/actor-definition/dataset-schema) + Monthly flat price in USD """ @docs_group('Models') -class ActorDefinition(BaseModel): - """The definition of the Actor, the full specification of this field can be found in [Apify docs](https://docs.apify.com/platform/actors/development/actor-definition/actor-json).""" - +class FreeActorPricingInfo(CommonActorPricingInfo): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - actor_specification: Annotated[Literal[1], Field(alias='actorSpecification')] = 1 - """ - The Actor specification version that this Actor follows. This property must be set to 1. - """ - name: str | None = None - """ - The name of the Actor. - """ - version: Annotated[str | None, Field(pattern='^[0-9]+\\.[0-9]+$')] = None - """ - The version of the Actor, specified in the format [Number].[Number], e.g., 0.1, 1.0. - """ - build_tag: Annotated[str | None, Field(alias='buildTag')] = None - """ - The tag name to be applied to a successful build of the Actor. Defaults to 'latest' if not specified. - """ - environment_variables: Annotated[dict[str, str] | None, Field(alias='environmentVariables')] = None - """ - A map of environment variables to be used during local development and deployment. - """ - dockerfile: str | None = None - """ - The path to the Dockerfile used for building the Actor on the platform. - """ - docker_context_dir: Annotated[str | None, Field(alias='dockerContextDir')] = None - """ - The path to the directory used as the Docker context when building the Actor. - """ - readme: str | None = None - """ - The path to the README file for the Actor. - """ - input: dict[str, Any] | None = None - """ - The input schema object, the full specification can be found in [Apify docs](https://docs.apify.com/platform/actors/development/actor-definition/input-schema) - """ - changelog: str | None = None - """ - The path to the CHANGELOG file displayed in the Actor's information tab. - """ - storages: Storages | None = None - default_memory_mbytes: Annotated[str | int | None, Field(alias='defaultMemoryMbytes')] = None - """ - Specifies the default amount of memory in megabytes to be used when the Actor is started. Can be an integer or a [dynamic memory expression](/platform/actors/development/actor-definition/dynamic-actor-memory). - """ - min_memory_mbytes: Annotated[int | None, Field(alias='minMemoryMbytes', ge=256)] = None - """ - Specifies the minimum amount of memory in megabytes required by the Actor. - """ - max_memory_mbytes: Annotated[int | None, Field(alias='maxMemoryMbytes', ge=256)] = None - """ - Specifies the maximum amount of memory in megabytes required by the Actor. - """ - uses_standby_mode: Annotated[bool | None, Field(alias='usesStandbyMode')] = None - """ - Specifies whether Standby mode is enabled for the Actor. - """ + pricing_model: Annotated[Literal['FREE'], Field(alias='pricingModel')] @docs_group('Models') -class Build(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - id: Annotated[str, Field(examples=['HG7ML7M8z78YcAPEB'])] - act_id: Annotated[str, Field(alias='actId', examples=['janedoe~my-actor'])] - user_id: Annotated[str, Field(alias='userId', examples=['klmdEpoiojmdEMlk3'])] - started_at: Annotated[AwareDatetime, Field(alias='startedAt', examples=['2019-11-30T07:34:24.202Z'])] - finished_at: Annotated[AwareDatetime | None, Field(alias='finishedAt', examples=['2019-12-12T09:30:12.202Z'])] = ( - None - ) - status: ActorJobStatus - meta: BuildsMeta - stats: BuildStats | None = None - options: BuildOptions | None = None - usage: BuildUsage | None = None - usage_total_usd: Annotated[float | None, Field(alias='usageTotalUsd', examples=[0.02])] = None - usage_usd: Annotated[BuildUsage | None, Field(alias='usageUsd')] = None - input_schema: Annotated[ - str | None, Field(alias='inputSchema', deprecated=True, examples=['{\\n "title": "Schema for ... }']) - ] = None - readme: Annotated[str | None, Field(deprecated=True, examples=['# Magic Actor\\nThis Actor is magic.'])] = None - build_number: Annotated[str, Field(alias='buildNumber', examples=['0.1.1'])] - actor_definition: Annotated[ActorDefinition | None, Field(alias='actorDefinition')] = None +class GeneralAccess(StrEnum): + """Defines the general access level for the resource.""" + + ANYONE_WITH_ID_CAN_READ = 'ANYONE_WITH_ID_CAN_READ' + ANYONE_WITH_NAME_CAN_READ = 'ANYONE_WITH_NAME_CAN_READ' + FOLLOW_USER_SETTING = 'FOLLOW_USER_SETTING' + RESTRICTED = 'RESTRICTED' @docs_group('Models') -class BuildResponse(BaseModel): - """Response containing Actor build data.""" +class HeadAndLockResponse(BaseModel): + """Response containing locked requests from the request queue head.""" model_config = ConfigDict( extra='allow', populate_by_name=True, ) - data: Build + data: LockedRequestQueueHead @docs_group('Models') -class UnknownBuildTagErrorDetail(ErrorDetail): +class HeadRequest(BaseModel): + """A request from the request queue head without lock information.""" + model_config = ConfigDict( extra='allow', populate_by_name=True, ) - type: Annotated[Literal['unknown-build-tag'], Field(title='ErrorType')] = 'unknown-build-tag' + id: Annotated[str, Field(examples=['sbJ7klsdf7ujN9l'])] """ - Machine-processable error type identifier. + A unique identifier assigned to the request. + """ + unique_key: Annotated[str, Field(alias='uniqueKey', examples=['GET|60d83e70|e3b0c442|https://apify.com'])] + """ + A unique key used for request de-duplication. Requests with the same unique key are considered identical. + """ + url: Annotated[str, Field(examples=['https://apify.com'])] + """ + The URL of the request. + """ + method: HttpMethod | None = None + retry_count: Annotated[int | None, Field(alias='retryCount', examples=[0])] = None + """ + The number of times this request has been retried. """ @docs_group('Models') -class UnknownBuildTagError(BaseModel): +class HeadResponse(BaseModel): + """Response containing requests from the request queue head without locking.""" + model_config = ConfigDict( extra='allow', populate_by_name=True, ) - error: UnknownBuildTagErrorDetail | None = None + data: RequestQueueHead @docs_group('Models') -class RunMeta(BaseModel): +class HttpMethod(StrEnum): + GET = 'GET' + HEAD = 'HEAD' + POST = 'POST' + PUT = 'PUT' + DELETE = 'DELETE' + CONNECT = 'CONNECT' + OPTIONS = 'OPTIONS' + TRACE = 'TRACE' + PATCH = 'PATCH' + + +@docs_group('Models') +class InvalidItem(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - origin: RunOrigin - client_ip: Annotated[str | None, Field(alias='clientIp')] = None + item_position: Annotated[int | None, Field(alias='itemPosition', examples=[2])] = None """ - IP address of the client that started the run. + The position of the invalid item in the array. """ - user_agent: Annotated[str | None, Field(alias='userAgent')] = None + validation_errors: Annotated[list[ValidationError] | None, Field(alias='validationErrors')] = None """ - User agent of the client that started the run. + A complete list of AJV validation error objects for the invalid item. """ - schedule_id: Annotated[str | None, Field(alias='scheduleId')] = None + + +@docs_group('Models') +class KeyValueStore(BaseModel): + model_config = ConfigDict( + extra='allow', + populate_by_name=True, + ) + id: Annotated[str, Field(examples=['WkzbQMuFYuamGv3YF'])] + name: Annotated[str | None, Field(examples=['d7b9MDYsbtX5L7XAj'])] = None + user_id: Annotated[str | None, Field(alias='userId', examples=['BPWDBd7Z9c746JAnF'])] = None + username: Annotated[str | None, Field(examples=['janedoe'])] = None + created_at: Annotated[AwareDatetime, Field(alias='createdAt', examples=['2019-12-12T07:34:14.202Z'])] + modified_at: Annotated[AwareDatetime, Field(alias='modifiedAt', examples=['2019-12-13T08:36:13.202Z'])] + accessed_at: Annotated[AwareDatetime, Field(alias='accessedAt', examples=['2019-12-14T08:36:13.202Z'])] + act_id: Annotated[str | None, Field(alias='actId', examples=[None])] = None + act_run_id: Annotated[str | None, Field(alias='actRunId', examples=[None])] = None + console_url: Annotated[ + AnyUrl | None, + Field(alias='consoleUrl', examples=['https://console.apify.com/storage/key-value-stores/27TmTznX9YPeAYhkC']), + ] = None + keys_public_url: Annotated[ + AnyUrl | None, + Field( + alias='keysPublicUrl', + examples=['https://api.apify.com/v2/key-value-stores/WkzbQMuFYuamGv3YF/keys?signature=abc123'], + ), + ] = None """ - ID of the schedule that triggered the run. + A public link to access keys of the key-value store directly. """ - scheduled_at: Annotated[AwareDatetime | None, Field(alias='scheduledAt')] = None + url_signing_secret_key: Annotated[str | None, Field(alias='urlSigningSecretKey')] = None """ - Time when the run was scheduled. + A secret key for generating signed public URLs. It is only provided to clients with WRITE permission for the key-value store. """ + general_access: Annotated[GeneralAccess | None, Field(alias='generalAccess')] = None + stats: KeyValueStoreStats | None = None @docs_group('Models') -class RunShort(BaseModel): +class KeyValueStoreKey(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - id: Annotated[str, Field(examples=['HG7ML7M8z78YcAPEB'])] - act_id: Annotated[str, Field(alias='actId', examples=['HDSasDasz78YcAPEB'])] - actor_task_id: Annotated[str | None, Field(alias='actorTaskId', examples=['KJHSKHausidyaJKHs'])] = None - status: ActorJobStatus - started_at: Annotated[AwareDatetime, Field(alias='startedAt', examples=['2019-11-30T07:34:24.202Z'])] - finished_at: Annotated[AwareDatetime | None, Field(alias='finishedAt', examples=['2019-12-12T09:30:12.202Z'])] = ( - None - ) - build_id: Annotated[str, Field(alias='buildId', examples=['HG7ML7M8z78YcAPEB'])] - build_number: Annotated[str | None, Field(alias='buildNumber', examples=['0.0.2'])] = None - meta: RunMeta - usage_total_usd: Annotated[float, Field(alias='usageTotalUsd', examples=[0.2])] - default_key_value_store_id: Annotated[str, Field(alias='defaultKeyValueStoreId', examples=['sfAjeR4QmeJCQzTfe'])] - default_dataset_id: Annotated[str, Field(alias='defaultDatasetId', examples=['3ZojQDdFTsyE7Moy4'])] - default_request_queue_id: Annotated[str, Field(alias='defaultRequestQueueId', examples=['so93g2shcDzK3pA85'])] + key: Annotated[str, Field(examples=['second-key'])] + size: Annotated[int, Field(examples=[36])] + record_public_url: Annotated[ + AnyUrl, + Field( + alias='recordPublicUrl', + examples=['https://api.apify.com/v2/key-value-stores/WkzbQMuFYuamGv3YF/records/some-key?signature=abc123'], + ), + ] + """ + A public link to access this record directly. + """ @docs_group('Models') -class ListOfRuns(PaginationResponse): +class KeyValueStoreResponse(BaseModel): + """Response containing key-value store data.""" + model_config = ConfigDict( extra='allow', populate_by_name=True, ) - items: list[RunShort] + data: KeyValueStore @docs_group('Models') -class ListOfRunsResponse(BaseModel): +class KeyValueStoreStats(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - data: ListOfRuns + read_count: Annotated[int, Field(alias='readCount', examples=[9])] + write_count: Annotated[int, Field(alias='writeCount', examples=[3])] + delete_count: Annotated[int, Field(alias='deleteCount', examples=[6])] + list_count: Annotated[int, Field(alias='listCount', examples=[2])] + s3_storage_bytes: Annotated[int | None, Field(alias='s3StorageBytes', examples=[18])] = None @docs_group('Models') -class RunStats(BaseModel): +class KeyValueStores(BaseModel): + """Aliased key-value store IDs for this run.""" + model_config = ConfigDict( extra='allow', populate_by_name=True, ) - input_body_len: Annotated[int | None, Field(alias='inputBodyLen', examples=[240], ge=0)] = None - migration_count: Annotated[int | None, Field(alias='migrationCount', examples=[0], ge=0)] = None - reboot_count: Annotated[int | None, Field(alias='rebootCount', examples=[0], ge=0)] = None - restart_count: Annotated[int, Field(alias='restartCount', examples=[0], ge=0)] - resurrect_count: Annotated[int, Field(alias='resurrectCount', examples=[2], ge=0)] - mem_avg_bytes: Annotated[float | None, Field(alias='memAvgBytes', examples=[267874071.9])] = None - mem_max_bytes: Annotated[int | None, Field(alias='memMaxBytes', examples=[404713472], ge=0)] = None - mem_current_bytes: Annotated[int | None, Field(alias='memCurrentBytes', examples=[0], ge=0)] = None - cpu_avg_usage: Annotated[float | None, Field(alias='cpuAvgUsage', examples=[33.7532101107538])] = None - cpu_max_usage: Annotated[float | None, Field(alias='cpuMaxUsage', examples=[169.650735534941])] = None - cpu_current_usage: Annotated[float | None, Field(alias='cpuCurrentUsage', examples=[0])] = None - net_rx_bytes: Annotated[int | None, Field(alias='netRxBytes', examples=[103508042], ge=0)] = None - net_tx_bytes: Annotated[int | None, Field(alias='netTxBytes', examples=[4854600], ge=0)] = None - duration_millis: Annotated[int | None, Field(alias='durationMillis', examples=[248472], ge=0)] = None - run_time_secs: Annotated[float | None, Field(alias='runTimeSecs', examples=[248.472], ge=0.0)] = None - metamorph: Annotated[int | None, Field(examples=[0], ge=0)] = None - compute_units: Annotated[float, Field(alias='computeUnits', examples=[0.13804], ge=0.0)] + default: Annotated[str | None, Field(examples=['eJNzqsbPiopwJcgGQ'])] = None + """ + ID of the default key-value store for this run. + """ @docs_group('Models') -class RunOptions(BaseModel): +class Limits(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - build: Annotated[str, Field(examples=['latest'])] - timeout_secs: Annotated[int, Field(alias='timeoutSecs', examples=[300], ge=0)] - memory_mbytes: Annotated[int, Field(alias='memoryMbytes', examples=[1024], ge=128, le=32768)] - disk_mbytes: Annotated[int, Field(alias='diskMbytes', examples=[2048], ge=0)] - max_items: Annotated[int | None, Field(alias='maxItems', examples=[1000], ge=1)] = None - max_total_charge_usd: Annotated[float | None, Field(alias='maxTotalChargeUsd', examples=[5], ge=0.0)] = None + max_monthly_usage_usd: Annotated[float, Field(alias='maxMonthlyUsageUsd', examples=[300])] + max_monthly_actor_compute_units: Annotated[float, Field(alias='maxMonthlyActorComputeUnits', examples=[1000])] + max_monthly_external_data_transfer_gbytes: Annotated[ + float, Field(alias='maxMonthlyExternalDataTransferGbytes', examples=[7]) + ] + max_monthly_proxy_serps: Annotated[int, Field(alias='maxMonthlyProxySerps', examples=[50])] + max_monthly_residential_proxy_gbytes: Annotated[ + float, Field(alias='maxMonthlyResidentialProxyGbytes', examples=[0.5]) + ] + max_actor_memory_gbytes: Annotated[float, Field(alias='maxActorMemoryGbytes', examples=[16])] + max_actor_count: Annotated[int, Field(alias='maxActorCount', examples=[100])] + max_actor_task_count: Annotated[int, Field(alias='maxActorTaskCount', examples=[1000])] + max_concurrent_actor_jobs: Annotated[int, Field(alias='maxConcurrentActorJobs', examples=[256])] + max_team_account_seat_count: Annotated[int, Field(alias='maxTeamAccountSeatCount', examples=[9])] + data_retention_days: Annotated[int, Field(alias='dataRetentionDays', examples=[90])] @docs_group('Models') -class GeneralAccess(StrEnum): - """Defines the general access level for the resource.""" - - ANYONE_WITH_ID_CAN_READ = 'ANYONE_WITH_ID_CAN_READ' - ANYONE_WITH_NAME_CAN_READ = 'ANYONE_WITH_NAME_CAN_READ' - FOLLOW_USER_SETTING = 'FOLLOW_USER_SETTING' - RESTRICTED = 'RESTRICTED' +class LimitsResponse(BaseModel): + model_config = ConfigDict( + extra='allow', + populate_by_name=True, + ) + data: AccountLimits @docs_group('Models') -class RunUsage(BaseModel): +class ListOfActorsInStoreResponse(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - actor_compute_units: Annotated[float | None, Field(alias='ACTOR_COMPUTE_UNITS', examples=[3])] = None - dataset_reads: Annotated[int | None, Field(alias='DATASET_READS', examples=[4])] = None - dataset_writes: Annotated[int | None, Field(alias='DATASET_WRITES', examples=[4])] = None - key_value_store_reads: Annotated[int | None, Field(alias='KEY_VALUE_STORE_READS', examples=[5])] = None - key_value_store_writes: Annotated[int | None, Field(alias='KEY_VALUE_STORE_WRITES', examples=[3])] = None - key_value_store_lists: Annotated[int | None, Field(alias='KEY_VALUE_STORE_LISTS', examples=[5])] = None - request_queue_reads: Annotated[int | None, Field(alias='REQUEST_QUEUE_READS', examples=[2])] = None - request_queue_writes: Annotated[int | None, Field(alias='REQUEST_QUEUE_WRITES', examples=[1])] = None - data_transfer_internal_gbytes: Annotated[ - float | None, Field(alias='DATA_TRANSFER_INTERNAL_GBYTES', examples=[1]) - ] = None - data_transfer_external_gbytes: Annotated[ - float | None, Field(alias='DATA_TRANSFER_EXTERNAL_GBYTES', examples=[3]) - ] = None - proxy_residential_transfer_gbytes: Annotated[ - float | None, Field(alias='PROXY_RESIDENTIAL_TRANSFER_GBYTES', examples=[34]) - ] = None - proxy_serps: Annotated[int | None, Field(alias='PROXY_SERPS', examples=[3])] = None + data: ListOfStoreActors @docs_group('Models') -class RunUsageUsd(BaseModel): - """Resource usage costs in USD. All values are monetary amounts in US dollars.""" +class ListOfActorsResponse(BaseModel): + model_config = ConfigDict( + extra='allow', + populate_by_name=True, + ) + data: ListOfActors + +@docs_group('Models') +class ListOfBuildsResponse(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - actor_compute_units: Annotated[float | None, Field(alias='ACTOR_COMPUTE_UNITS', examples=[0.0003])] = None - dataset_reads: Annotated[float | None, Field(alias='DATASET_READS', examples=[0.0001])] = None - dataset_writes: Annotated[float | None, Field(alias='DATASET_WRITES', examples=[0.0001])] = None - key_value_store_reads: Annotated[float | None, Field(alias='KEY_VALUE_STORE_READS', examples=[0.0001])] = None - key_value_store_writes: Annotated[float | None, Field(alias='KEY_VALUE_STORE_WRITES', examples=[5e-05])] = None - key_value_store_lists: Annotated[float | None, Field(alias='KEY_VALUE_STORE_LISTS', examples=[0.0001])] = None - request_queue_reads: Annotated[float | None, Field(alias='REQUEST_QUEUE_READS', examples=[0.0001])] = None - request_queue_writes: Annotated[float | None, Field(alias='REQUEST_QUEUE_WRITES', examples=[0.0001])] = None - data_transfer_internal_gbytes: Annotated[ - float | None, Field(alias='DATA_TRANSFER_INTERNAL_GBYTES', examples=[0.001]) - ] = None - data_transfer_external_gbytes: Annotated[ - float | None, Field(alias='DATA_TRANSFER_EXTERNAL_GBYTES', examples=[0.003]) - ] = None - proxy_residential_transfer_gbytes: Annotated[ - float | None, Field(alias='PROXY_RESIDENTIAL_TRANSFER_GBYTES', examples=[0.034]) - ] = None - proxy_serps: Annotated[float | None, Field(alias='PROXY_SERPS', examples=[0.003])] = None + data: ListOfBuilds @docs_group('Models') -class Metamorph(BaseModel): - """Information about a metamorph event that occurred during the run.""" - +class ListOfDatasetsResponse(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - created_at: Annotated[AwareDatetime, Field(alias='createdAt', examples=['2019-11-30T07:39:24.202Z'])] - """ - Time when the metamorph occurred. - """ - actor_id: Annotated[str, Field(alias='actorId', examples=['nspoEjklmnsF2oosD'])] - """ - ID of the Actor that the run was metamorphed to. - """ - build_id: Annotated[str, Field(alias='buildId', examples=['ME6oKecqy5kXDS4KQ'])] - """ - ID of the build used for the metamorphed Actor. - """ - input_key: Annotated[str | None, Field(alias='inputKey', examples=['INPUT-METAMORPH-1'])] = None - """ - Key of the input record in the key-value store. - """ + data: ListOfDatasets @docs_group('Models') -class Datasets(BaseModel): - """Aliased dataset IDs for this run.""" - +class ListOfEnvVars(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - default: Annotated[str | None, Field(examples=['wmKPijuyDnPZAPRMk'])] = None - """ - ID of the default dataset for this run. - """ + total: Annotated[int, Field(examples=[5])] + items: list[EnvVar] @docs_group('Models') -class KeyValueStores(BaseModel): - """Aliased key-value store IDs for this run.""" +class ListOfEnvVarsResponse(BaseModel): + model_config = ConfigDict( + extra='allow', + populate_by_name=True, + ) + data: ListOfEnvVars + +@docs_group('Models') +class ListOfKeyValueStoresResponse(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - default: Annotated[str | None, Field(examples=['eJNzqsbPiopwJcgGQ'])] = None - """ - ID of the default key-value store for this run. - """ + data: ListOfKeyValueStores @docs_group('Models') -class RequestQueues(BaseModel): - """Aliased request queue IDs for this run.""" +class ListOfKeys(BaseModel): + model_config = ConfigDict( + extra='allow', + populate_by_name=True, + ) + items: list[KeyValueStoreKey] + count: Annotated[int, Field(examples=[2])] + limit: Annotated[int, Field(examples=[2])] + exclusive_start_key: Annotated[str | None, Field(alias='exclusiveStartKey', examples=['some-key'])] = None + is_truncated: Annotated[bool, Field(alias='isTruncated', examples=[True])] + next_exclusive_start_key: Annotated[str | None, Field(alias='nextExclusiveStartKey', examples=['third-key'])] = None + +@docs_group('Models') +class ListOfKeysResponse(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - default: Annotated[str | None, Field(examples=['FL35cSF7jrxr3BY39'])] = None - """ - ID of the default request queue for this run. - """ + data: ListOfKeys @docs_group('Models') -class StorageIds(BaseModel): - """A map of aliased storage IDs associated with this run, grouped by storage type.""" +class ListOfRequestQueuesResponse(BaseModel): + """Response containing a list of request queues.""" model_config = ConfigDict( extra='allow', populate_by_name=True, ) - datasets: Datasets | None = None - """ - Aliased dataset IDs for this run. - """ - key_value_stores: Annotated[KeyValueStores | None, Field(alias='keyValueStores')] = None - """ - Aliased key-value store IDs for this run. - """ - request_queues: Annotated[RequestQueues | None, Field(alias='requestQueues')] = None - """ - Aliased request queue IDs for this run. - """ + data: ListOfRequestQueues @docs_group('Models') -class Run(BaseModel): - """Represents an Actor run and its associated data.""" +class ListOfRequests(BaseModel): + """A paginated list of requests from the request queue.""" model_config = ConfigDict( extra='allow', populate_by_name=True, ) - id: Annotated[str, Field(examples=['HG7ML7M8z78YcAPEB'])] - """ - Unique identifier of the Actor run. - """ - act_id: Annotated[str, Field(alias='actId', examples=['HDSasDasz78YcAPEB'])] - """ - ID of the Actor that was run. - """ - user_id: Annotated[str, Field(alias='userId', examples=['7sT5jcggjjA9fNcxF'])] - """ - ID of the user who started the run. - """ - actor_task_id: Annotated[str | None, Field(alias='actorTaskId', examples=['KJHSKHausidyaJKHs'])] = None - """ - ID of the Actor task, if the run was started from a task. - """ - started_at: Annotated[AwareDatetime, Field(alias='startedAt', examples=['2019-11-30T07:34:24.202Z'])] - """ - Time when the Actor run started. - """ - finished_at: Annotated[AwareDatetime | None, Field(alias='finishedAt', examples=['2019-12-12T09:30:12.202Z'])] = ( - None - ) - """ - Time when the Actor run finished. - """ - status: ActorJobStatus - """ - Current status of the Actor run. - """ - status_message: Annotated[str | None, Field(alias='statusMessage', examples=['Actor is running'])] = None - """ - Detailed message about the run status. - """ - is_status_message_terminal: Annotated[bool | None, Field(alias='isStatusMessageTerminal', examples=[False])] = None - """ - Whether the status message is terminal (final). - """ - meta: RunMeta + items: list[Request] """ - Metadata about the Actor run. + The array of requests. """ - pricing_info: Annotated[ - PayPerEventActorPricingInfo - | PricePerDatasetItemActorPricingInfo - | FlatPricePerMonthActorPricingInfo - | FreeActorPricingInfo - | None, - Field(alias='pricingInfo', discriminator='pricing_model', title='ActorRunPricingInfo'), - ] = None + count: Annotated[int | None, Field(examples=[2])] = None """ - Pricing information for the Actor. + The total number of requests matching the query. """ - stats: RunStats + limit: Annotated[int, Field(examples=[2])] """ - Statistics of the Actor run. + The maximum number of requests returned in this response. """ - charged_event_counts: Annotated[ - dict[str, int] | None, - Field(alias='chargedEventCounts', examples=[{'actor-start': 1, 'page-crawled': 150, 'data-extracted': 75}]), + exclusive_start_id: Annotated[ + str | None, Field(alias='exclusiveStartId', deprecated=True, examples=['Ihnsp8YrvJ8102Kj']) ] = None """ - A map of charged event types to their counts. The keys are event type identifiers defined by the Actor's pricing model (pay-per-event), and the values are the number of times each event was charged during this run. - """ - options: RunOptions - """ - Configuration options for the Actor run. - """ - build_id: Annotated[str, Field(alias='buildId', examples=['7sT5jcggjjA9fNcxF'])] - """ - ID of the Actor build used for this run. - """ - exit_code: Annotated[int | None, Field(alias='exitCode', examples=[0])] = None - """ - Exit code of the Actor run process. - """ - general_access: Annotated[GeneralAccess, Field(alias='generalAccess')] - """ - General access level for the Actor run. - """ - default_key_value_store_id: Annotated[str, Field(alias='defaultKeyValueStoreId', examples=['eJNzqsbPiopwJcgGQ'])] - """ - ID of the default key-value store for this run. - """ - default_dataset_id: Annotated[str, Field(alias='defaultDatasetId', examples=['wmKPijuyDnPZAPRMk'])] - """ - ID of the default dataset for this run. - """ - default_request_queue_id: Annotated[str, Field(alias='defaultRequestQueueId', examples=['FL35cSF7jrxr3BY39'])] - """ - ID of the default request queue for this run. - """ - storage_ids: Annotated[StorageIds | None, Field(alias='storageIds')] = None - """ - A map of aliased storage IDs associated with this run, grouped by storage type. + The ID of the last request from the previous page, used for pagination. """ - build_number: Annotated[str | None, Field(alias='buildNumber', examples=['0.0.36'])] = None + cursor: Annotated[str | None, Field(examples=['eyJyZXF1ZXN0SWQiOiI0SVlLUWFXZ2FKUUlWNlMifQ'])] = None """ - Build number of the Actor build used for this run. + A cursor string used for current page of results. """ - container_url: Annotated[ - AnyUrl | None, Field(alias='containerUrl', examples=['https://g8kd8kbc5ge8.runs.apify.net']) + next_cursor: Annotated[ + str | None, Field(alias='nextCursor', examples=['eyJyZXF1ZXN0SWQiOiI5eFNNc1BrN1J6VUxTNXoifQ']) ] = None """ - URL of the container running the Actor. - """ - is_container_server_ready: Annotated[bool | None, Field(alias='isContainerServerReady', examples=[True])] = None - """ - Whether the container's HTTP server is ready to accept requests. - """ - git_branch_name: Annotated[str | None, Field(alias='gitBranchName', examples=['master'])] = None - """ - Name of the git branch used for the Actor build. - """ - usage: RunUsage | None = None - """ - Resource usage statistics for the run. - """ - usage_total_usd: Annotated[float | None, Field(alias='usageTotalUsd', examples=[0.2654])] = None - """ - Total cost in USD for this run. Represents what you actually pay. For run owners: includes platform usage (compute units) and/or event costs depending on the Actor's pricing model. For run non-owners: only available for Pay-Per-Event Actors (event costs only). Not available for Pay-Per-Result Actors when you're not the Actor owner. - """ - usage_usd: Annotated[RunUsageUsd | None, Field(alias='usageUsd')] = None - """ - Platform usage costs breakdown in USD. Only present if you own the run AND are paying for platform usage (Pay-Per-Usage, Rental, or Pay-Per-Event with usage costs like standby Actors). Not available for standard Pay-Per-Event Actors or Pay-Per-Result Actors owned by others. - """ - metamorphs: list[Metamorph] | None = None - """ - List of metamorph events that occurred during the run. + A cursor string to be used to continue pagination. """ @docs_group('Models') -class RunResponse(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - data: Run - - -@docs_group('Models') -class RunFailedErrorDetail(ErrorDetail): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - type: Annotated[Literal['run-failed'], Field(title='ErrorType')] = 'run-failed' - """ - Machine-processable error type identifier. - """ - +class ListOfRequestsResponse(BaseModel): + """Response containing a list of requests from the request queue.""" -@docs_group('Models') -class ActorRunFailedError(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - error: RunFailedErrorDetail | None = None + data: ListOfRequests @docs_group('Models') -class RunTimeoutExceededErrorDetail(ErrorDetail): +class ListOfRunsResponse(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - type: Annotated[Literal['run-timeout-exceeded'], Field(title='ErrorType')] = 'run-timeout-exceeded' - """ - Machine-processable error type identifier. - """ + data: ListOfRuns @docs_group('Models') -class ActorRunTimeoutExceededError(BaseModel): +class ListOfSchedulesResponse(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - error: RunTimeoutExceededErrorDetail | None = None + data: ListOfSchedules @docs_group('Models') -class TaskStats(BaseModel): +class ListOfTasksResponse(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - total_runs: Annotated[int | None, Field(alias='totalRuns', examples=[15])] = None + data: ListOfTasks @docs_group('Models') -class TaskShort(BaseModel): +class ListOfVersions(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - id: Annotated[str, Field(examples=['zdc3Pyhyz3m8vjDeM'])] - user_id: Annotated[str, Field(alias='userId', examples=['wRsJZtadYvn4mBZmm'])] - act_id: Annotated[str, Field(alias='actId', examples=['asADASadYvn4mBZmm'])] - act_name: Annotated[str | None, Field(alias='actName', examples=['my-actor'])] = None - name: Annotated[str, Field(examples=['my-task'])] - username: Annotated[str | None, Field(examples=['janedoe'])] = None - act_username: Annotated[str | None, Field(alias='actUsername', examples=['janedoe'])] = None - created_at: Annotated[AwareDatetime, Field(alias='createdAt', examples=['2018-10-26T07:23:14.855Z'])] - modified_at: Annotated[AwareDatetime, Field(alias='modifiedAt', examples=['2018-10-26T13:30:49.578Z'])] - stats: TaskStats | None = None + total: Annotated[int, Field(examples=[5])] + items: list[Version] @docs_group('Models') -class ListOfTasks(PaginationResponse): +class ListOfVersionsResponse(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - items: list[TaskShort] + data: ListOfVersions @docs_group('Models') -class ListOfTasksResponse(BaseModel): +class ListOfWebhooksResponse(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - data: ListOfTasks + data: ListOfWebhooks @docs_group('Models') -class TaskOptions(BaseModel): +class LockedHeadRequest(BaseModel): + """A request from the request queue head that has been locked for processing.""" + model_config = ConfigDict( extra='allow', populate_by_name=True, ) - build: Annotated[str | None, Field(examples=['latest'])] = None - timeout_secs: Annotated[int | None, Field(alias='timeoutSecs', examples=[300])] = None - memory_mbytes: Annotated[int | None, Field(alias='memoryMbytes', examples=[1024])] = None - max_items: Annotated[int | None, Field(alias='maxItems', examples=[1000])] = None - max_total_charge_usd: Annotated[float | None, Field(alias='maxTotalChargeUsd', examples=[5])] = None - restart_on_error: Annotated[bool | None, Field(alias='restartOnError', examples=[False])] = None + id: Annotated[str, Field(examples=['sbJ7klsdf7ujN9l'])] + """ + A unique identifier assigned to the request. + """ + unique_key: Annotated[str, Field(alias='uniqueKey', examples=['GET|60d83e70|e3b0c442|https://apify.com'])] + """ + A unique key used for request de-duplication. Requests with the same unique key are considered identical. + """ + url: Annotated[str, Field(examples=['https://apify.com'])] + """ + The URL of the request. + """ + method: HttpMethod | None = None + retry_count: Annotated[int | None, Field(alias='retryCount', examples=[0])] = None + """ + The number of times this request has been retried. + """ + lock_expires_at: Annotated[AwareDatetime, Field(alias='lockExpiresAt', examples=['2022-06-14T23:00:00.000Z'])] + """ + The timestamp when the lock on this request expires. + """ @docs_group('Models') -class TaskInput(BaseModel): - """The input configuration for the Actor task. This is a user-defined JSON object - that will be passed to the Actor when the task is run. - - """ +class LockedRequestQueueHead(BaseModel): + """A batch of locked requests from the request queue head.""" model_config = ConfigDict( extra='allow', populate_by_name=True, ) + limit: Annotated[int, Field(examples=[1000])] + """ + The maximum number of requests returned. + """ + queue_modified_at: Annotated[AwareDatetime, Field(alias='queueModifiedAt', examples=['2019-12-13T08:36:13.202Z'])] + """ + The timestamp when the request queue was last modified. Modifications include adding, updating, or removing requests, as well as locking or unlocking requests in the request queue. + """ + queue_has_locked_requests: Annotated[bool | None, Field(alias='queueHasLockedRequests', examples=[True])] = None + """ + Whether the request queue contains requests locked by any client (either the one calling the endpoint or a different one). + """ + client_key: Annotated[str | None, Field(alias='clientKey', examples=['client-one'])] = None + """ + The client key used for locking the requests. + """ + had_multiple_clients: Annotated[bool, Field(alias='hadMultipleClients', examples=[True])] + """ + Whether the request queue has been accessed by multiple different clients. + """ + lock_secs: Annotated[int, Field(alias='lockSecs', examples=[60])] + """ + The number of seconds the locks will be held. + """ + items: list[LockedHeadRequest] + """ + The array of locked requests from the request queue head. + """ @docs_group('Models') -class CreateTaskRequest(BaseModel): +class Metamorph(BaseModel): + """Information about a metamorph event that occurred during the run.""" + model_config = ConfigDict( extra='allow', populate_by_name=True, ) - act_id: Annotated[str, Field(alias='actId', examples=['asADASadYvn4mBZmm'])] - name: Annotated[str | None, Field(examples=['my-task'])] = None - options: TaskOptions | None = None - input: TaskInput | None = None - title: str | None = None - actor_standby: Annotated[ActorStandby | None, Field(alias='actorStandby')] = None + created_at: Annotated[AwareDatetime, Field(alias='createdAt', examples=['2019-11-30T07:39:24.202Z'])] + """ + Time when the metamorph occurred. + """ + actor_id: Annotated[str, Field(alias='actorId', examples=['nspoEjklmnsF2oosD'])] + """ + ID of the Actor that the run was metamorphed to. + """ + build_id: Annotated[str, Field(alias='buildId', examples=['ME6oKecqy5kXDS4KQ'])] + """ + ID of the build used for the metamorphed Actor. + """ + input_key: Annotated[str | None, Field(alias='inputKey', examples=['INPUT-METAMORPH-1'])] = None + """ + Key of the input record in the key-value store. + """ @docs_group('Models') -class Task(BaseModel): +class MonthlyUsage(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - id: Annotated[str, Field(examples=['zdc3Pyhyz3m8vjDeM'])] - user_id: Annotated[str, Field(alias='userId', examples=['wRsJZtadYvn4mBZmm'])] - act_id: Annotated[str, Field(alias='actId', examples=['asADASadYvn4mBZmm'])] - name: Annotated[str, Field(examples=['my-task'])] - username: Annotated[str | None, Field(examples=['janedoe'])] = None - created_at: Annotated[AwareDatetime, Field(alias='createdAt', examples=['2018-10-26T07:23:14.855Z'])] - modified_at: Annotated[AwareDatetime, Field(alias='modifiedAt', examples=['2018-10-26T13:30:49.578Z'])] - removed_at: Annotated[AwareDatetime | None, Field(alias='removedAt')] = None - stats: TaskStats | None = None - options: TaskOptions | None = None - input: TaskInput | None = None - title: str | None = None - actor_standby: Annotated[ActorStandby | None, Field(alias='actorStandby')] = None - standby_url: Annotated[AnyUrl | None, Field(alias='standbyUrl')] = None + usage_cycle: Annotated[UsageCycle, Field(alias='usageCycle')] + monthly_service_usage: Annotated[dict[str, UsageItem], Field(alias='monthlyServiceUsage')] + daily_service_usages: Annotated[list[DailyServiceUsages], Field(alias='dailyServiceUsages')] + total_usage_credits_usd_before_volume_discount: Annotated[ + float, Field(alias='totalUsageCreditsUsdBeforeVolumeDiscount', examples=[0.786143673840067]) + ] + total_usage_credits_usd_after_volume_discount: Annotated[ + float, Field(alias='totalUsageCreditsUsdAfterVolumeDiscount', examples=[0.786143673840067]) + ] @docs_group('Models') -class TaskResponse(BaseModel): - """Response containing Actor task data.""" - +class MonthlyUsageResponse(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - data: Task + data: MonthlyUsage @docs_group('Models') -class UpdateTaskRequest(BaseModel): +class PaginationResponse(BaseModel): + """Common pagination fields for list responses.""" + model_config = ConfigDict( extra='allow', populate_by_name=True, ) - name: Annotated[str | None, Field(examples=['my-task'])] = None - options: TaskOptions | None = None - input: TaskInput | None = None - title: str | None = None - actor_standby: Annotated[ActorStandby | None, Field(alias='actorStandby')] = None + total: Annotated[int, Field(examples=[1], ge=0)] + """ + The total number of items available across all pages. + """ + offset: Annotated[int, Field(examples=[0], ge=0)] + """ + The starting position for this page of results. + """ + limit: Annotated[int, Field(examples=[1000], ge=1)] + """ + The maximum number of items returned per page. + """ + desc: Annotated[bool, Field(examples=[False])] + """ + Whether the results are sorted in descending order. + """ + count: Annotated[int, Field(examples=[1], ge=0)] + """ + The number of items returned in this response. + """ @docs_group('Models') -class Webhook(BaseModel): +class ListOfActors(PaginationResponse): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - id: Annotated[str, Field(examples=['YiKoxjkaS9gjGTqhF'])] - created_at: Annotated[AwareDatetime, Field(alias='createdAt', examples=['2019-12-12T07:34:14.202Z'])] - modified_at: Annotated[AwareDatetime, Field(alias='modifiedAt', examples=['2019-12-13T08:36:13.202Z'])] - user_id: Annotated[str, Field(alias='userId', examples=['wRsJZtadYvn4mBZmm'])] - is_ad_hoc: Annotated[bool | None, Field(alias='isAdHoc', examples=[False])] = None - should_interpolate_strings: Annotated[bool | None, Field(alias='shouldInterpolateStrings', examples=[False])] = None - event_types: Annotated[list[WebhookEventType], Field(alias='eventTypes', examples=[['ACTOR.RUN.SUCCEEDED']])] - condition: WebhookCondition - ignore_ssl_errors: Annotated[bool, Field(alias='ignoreSslErrors', examples=[False])] - do_not_retry: Annotated[bool | None, Field(alias='doNotRetry', examples=[False])] = None - request_url: Annotated[AnyUrl, Field(alias='requestUrl', examples=['http://example.com/'])] - payload_template: Annotated[ - str | None, Field(alias='payloadTemplate', examples=['{\\n "userId": {{userId}}...']) - ] = None - headers_template: Annotated[ - str | None, Field(alias='headersTemplate', examples=['{\\n "Authorization": "Bearer ..."}']) - ] = None - description: Annotated[str | None, Field(examples=['this is webhook description'])] = None - last_dispatch: Annotated[ExampleWebhookDispatch | None, Field(alias='lastDispatch')] = None - stats: WebhookStats | None = None + items: list[ActorShort] @docs_group('Models') -class UpdateRunRequest(BaseModel): +class ListOfBuilds(PaginationResponse): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - run_id: Annotated[str | None, Field(alias='runId', examples=['3KH8gEpp4d8uQSe8T'])] = None - status_message: Annotated[str | None, Field(alias='statusMessage', examples=['Actor has finished'])] = None - is_status_message_terminal: Annotated[bool | None, Field(alias='isStatusMessageTerminal', examples=[True])] = None - general_access: Annotated[GeneralAccess | None, Field(alias='generalAccess')] = None + items: list[BuildShort] @docs_group('Models') -class ChargeRunRequest(BaseModel): +class ListOfDatasets(PaginationResponse): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - event_name: Annotated[str, Field(alias='eventName', examples=['ANALYZE_PAGE'])] - count: Annotated[int, Field(examples=[1])] - - -@docs_group('Models') -class StorageOwnership(StrEnum): - OWNED_BY_ME = 'ownedByMe' - SHARED_WITH_ME = 'sharedWithMe' + items: list[DatasetListItem] @docs_group('Models') -class KeyValueStoreStats(BaseModel): +class ListOfKeyValueStores(PaginationResponse): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - read_count: Annotated[int, Field(alias='readCount', examples=[9])] - write_count: Annotated[int, Field(alias='writeCount', examples=[3])] - delete_count: Annotated[int, Field(alias='deleteCount', examples=[6])] - list_count: Annotated[int, Field(alias='listCount', examples=[2])] - s3_storage_bytes: Annotated[int | None, Field(alias='s3StorageBytes', examples=[18])] = None + items: list[KeyValueStore] @docs_group('Models') -class KeyValueStore(BaseModel): +class ListOfRequestQueues(PaginationResponse): + """A paginated list of request queues.""" + model_config = ConfigDict( extra='allow', populate_by_name=True, ) - id: Annotated[str, Field(examples=['WkzbQMuFYuamGv3YF'])] - name: Annotated[str | None, Field(examples=['d7b9MDYsbtX5L7XAj'])] = None - user_id: Annotated[str | None, Field(alias='userId', examples=['BPWDBd7Z9c746JAnF'])] = None - username: Annotated[str | None, Field(examples=['janedoe'])] = None - created_at: Annotated[AwareDatetime, Field(alias='createdAt', examples=['2019-12-12T07:34:14.202Z'])] - modified_at: Annotated[AwareDatetime, Field(alias='modifiedAt', examples=['2019-12-13T08:36:13.202Z'])] - accessed_at: Annotated[AwareDatetime, Field(alias='accessedAt', examples=['2019-12-14T08:36:13.202Z'])] - act_id: Annotated[str | None, Field(alias='actId', examples=[None])] = None - act_run_id: Annotated[str | None, Field(alias='actRunId', examples=[None])] = None - console_url: Annotated[ - AnyUrl | None, - Field(alias='consoleUrl', examples=['https://console.apify.com/storage/key-value-stores/27TmTznX9YPeAYhkC']), - ] = None - keys_public_url: Annotated[ - AnyUrl | None, - Field( - alias='keysPublicUrl', - examples=['https://api.apify.com/v2/key-value-stores/WkzbQMuFYuamGv3YF/keys?signature=abc123'], - ), - ] = None - """ - A public link to access keys of the key-value store directly. - """ - url_signing_secret_key: Annotated[str | None, Field(alias='urlSigningSecretKey')] = None + items: list[RequestQueueShort] """ - A secret key for generating signed public URLs. It is only provided to clients with WRITE permission for the key-value store. + The array of request queues. """ - general_access: Annotated[GeneralAccess | None, Field(alias='generalAccess')] = None - stats: KeyValueStoreStats | None = None @docs_group('Models') -class ListOfKeyValueStores(PaginationResponse): +class ListOfRuns(PaginationResponse): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - items: list[KeyValueStore] + items: list[RunShort] @docs_group('Models') -class ListOfKeyValueStoresResponse(BaseModel): +class ListOfSchedules(PaginationResponse): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - data: ListOfKeyValueStores + items: list[ScheduleShort] @docs_group('Models') -class KeyValueStoreResponse(BaseModel): - """Response containing key-value store data.""" +class ListOfStoreActors(PaginationResponse): + model_config = ConfigDict( + extra='allow', + populate_by_name=True, + ) + items: list[StoreListActor] + +@docs_group('Models') +class ListOfTasks(PaginationResponse): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - data: KeyValueStore + items: list[TaskShort] @docs_group('Models') -class UpdateStoreRequest(BaseModel): +class ListOfWebhookDispatches(PaginationResponse): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - name: str | None = None - general_access: Annotated[GeneralAccess | None, Field(alias='generalAccess')] = None + items: list[WebhookDispatch] @docs_group('Models') -class KeyValueStoreKey(BaseModel): +class ListOfWebhooks(PaginationResponse): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - key: Annotated[str, Field(examples=['second-key'])] - size: Annotated[int, Field(examples=[36])] - record_public_url: Annotated[ - AnyUrl, + items: list[WebhookShort] + + +@docs_group('Models') +class PayPerEventActorPricingInfo(CommonActorPricingInfo): + model_config = ConfigDict( + extra='allow', + populate_by_name=True, + ) + pricing_model: Annotated[Literal['PAY_PER_EVENT'], Field(alias='pricingModel')] + pricing_per_event: Annotated[PricingPerEvent, Field(alias='pricingPerEvent')] + minimal_max_total_charge_usd: Annotated[float | None, Field(alias='minimalMaxTotalChargeUsd')] = None + + +@docs_group('Models') +class Plan(BaseModel): + model_config = ConfigDict( + extra='allow', + populate_by_name=True, + ) + id: Annotated[str, Field(examples=['Personal'])] + description: Annotated[str, Field(examples=['Cost-effective plan for freelancers, developers and students.'])] + is_enabled: Annotated[bool, Field(alias='isEnabled', examples=[True])] + monthly_base_price_usd: Annotated[float, Field(alias='monthlyBasePriceUsd', examples=[49])] + monthly_usage_credits_usd: Annotated[float, Field(alias='monthlyUsageCreditsUsd', examples=[49])] + usage_discount_percent: Annotated[float | None, Field(alias='usageDiscountPercent', examples=[0])] = None + enabled_platform_features: Annotated[ + list[str], Field( - alias='recordPublicUrl', - examples=['https://api.apify.com/v2/key-value-stores/WkzbQMuFYuamGv3YF/records/some-key?signature=abc123'], + alias='enabledPlatformFeatures', examples=[['ACTORS', 'STORAGE', 'PROXY_SERPS', 'SCHEDULER', 'WEBHOOKS']] ), ] + max_monthly_usage_usd: Annotated[float, Field(alias='maxMonthlyUsageUsd', examples=[9999])] + max_actor_memory_gbytes: Annotated[float, Field(alias='maxActorMemoryGbytes', examples=[32])] + max_monthly_actor_compute_units: Annotated[float, Field(alias='maxMonthlyActorComputeUnits', examples=[1000])] + max_monthly_residential_proxy_gbytes: Annotated[ + float, Field(alias='maxMonthlyResidentialProxyGbytes', examples=[10]) + ] + max_monthly_proxy_serps: Annotated[int, Field(alias='maxMonthlyProxySerps', examples=[30000])] + max_monthly_external_data_transfer_gbytes: Annotated[ + float, Field(alias='maxMonthlyExternalDataTransferGbytes', examples=[1000]) + ] + max_actor_count: Annotated[int, Field(alias='maxActorCount', examples=[100])] + max_actor_task_count: Annotated[int, Field(alias='maxActorTaskCount', examples=[1000])] + data_retention_days: Annotated[int, Field(alias='dataRetentionDays', examples=[14])] + available_proxy_groups: Annotated[dict[str, int], Field(alias='availableProxyGroups')] """ - A public link to access this record directly. + The number of available proxies in this group. """ + team_account_seat_count: Annotated[int, Field(alias='teamAccountSeatCount', examples=[1])] + support_level: Annotated[str, Field(alias='supportLevel', examples=['COMMUNITY'])] + available_add_ons: Annotated[list[str], Field(alias='availableAddOns', examples=[[]])] @docs_group('Models') -class ListOfKeys(BaseModel): +class PricePerDatasetItemActorPricingInfo(CommonActorPricingInfo): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - items: list[KeyValueStoreKey] - count: Annotated[int, Field(examples=[2])] - limit: Annotated[int, Field(examples=[2])] - exclusive_start_key: Annotated[str | None, Field(alias='exclusiveStartKey', examples=['some-key'])] = None - is_truncated: Annotated[bool, Field(alias='isTruncated', examples=[True])] - next_exclusive_start_key: Annotated[str | None, Field(alias='nextExclusiveStartKey', examples=['third-key'])] = None + pricing_model: Annotated[Literal['PRICE_PER_DATASET_ITEM'], Field(alias='pricingModel')] + unit_name: Annotated[str, Field(alias='unitName')] + """ + Name of the unit that is being charged + """ + price_per_unit_usd: Annotated[float, Field(alias='pricePerUnitUsd')] @docs_group('Models') -class ListOfKeysResponse(BaseModel): +class PriceTiers(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - data: ListOfKeys + quantity_above: Annotated[float, Field(alias='quantityAbove', examples=[0])] + discount_percent: Annotated[float, Field(alias='discountPercent', examples=[100])] + tier_quantity: Annotated[float, Field(alias='tierQuantity', examples=[0.39])] + unit_price_usd: Annotated[float, Field(alias='unitPriceUsd', examples=[0])] + price_usd: Annotated[float, Field(alias='priceUsd', examples=[0])] @docs_group('Models') -class RecordResponse(BaseModel): - """The response body contains the value of the record. The content type of the response - is determined by the Content-Type header stored with the record. - - """ - +class PricingPerEvent(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) + actor_charge_events: Annotated[dict[str, ActorChargeEvent] | None, Field(alias='actorChargeEvents')] = None @docs_group('Models') -class PutRecordRequest(BaseModel): - """The request body contains the value to store in the record. The content type - should be specified in the Content-Type header. +class PrivateUserDataResponse(BaseModel): + model_config = ConfigDict( + extra='allow', + populate_by_name=True, + ) + data: UserPrivateInfo - """ +@docs_group('Models') +class Profile(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) + bio: Annotated[str | None, Field(examples=['I started web scraping in 1985 using Altair BASIC.'])] = None + name: Annotated[str | None, Field(examples=['Jane Doe'])] = None + picture_url: Annotated[ + AnyUrl | None, Field(alias='pictureUrl', examples=['https://apify.com/img/anonymous_user_picture.png']) + ] = None + github_username: Annotated[str | None, Field(alias='githubUsername', examples=['torvalds.'])] = None + website_url: Annotated[AnyUrl | None, Field(alias='websiteUrl', examples=['http://www.example.com'])] = None + twitter_username: Annotated[str | None, Field(alias='twitterUsername', examples=['@BillGates'])] = None @docs_group('Models') -class DatasetListItem(BaseModel): +class ProlongRequestLockResponse(BaseModel): + """Response containing updated lock information after prolonging a request lock.""" + model_config = ConfigDict( extra='allow', populate_by_name=True, ) - id: Annotated[str, Field(examples=['WkzbQMuFYuamGv3YF'])] - name: Annotated[str, Field(examples=['d7b9MDYsbtX5L7XAj'])] - user_id: Annotated[str, Field(alias='userId', examples=['tbXmWu7GCxnyYtSiL'])] - created_at: Annotated[AwareDatetime, Field(alias='createdAt', examples=['2019-12-12T07:34:14.202Z'])] - modified_at: Annotated[AwareDatetime, Field(alias='modifiedAt', examples=['2019-12-13T08:36:13.202Z'])] - accessed_at: Annotated[AwareDatetime, Field(alias='accessedAt', examples=['2019-12-14T08:36:13.202Z'])] - item_count: Annotated[int, Field(alias='itemCount', examples=[7])] - clean_item_count: Annotated[int, Field(alias='cleanItemCount', examples=[5])] - act_id: Annotated[str | None, Field(alias='actId', examples=['zdc3Pyhyz3m8vjDeM'])] = None - act_run_id: Annotated[str | None, Field(alias='actRunId', examples=['HG7ML7M8z78YcAPEB'])] = None + data: RequestLockInfo @docs_group('Models') -class ListOfDatasets(PaginationResponse): +class Proxy(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - items: list[DatasetListItem] + password: Annotated[str, Field(examples=['ad78knd9Jkjd86'])] + groups: list[ProxyGroup] @docs_group('Models') -class ListOfDatasetsResponse(BaseModel): +class ProxyGroup(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - data: ListOfDatasets + name: Annotated[str, Field(examples=['Group1'])] + description: Annotated[str, Field(examples=['Group1 description'])] + available_count: Annotated[int, Field(alias='availableCount', examples=[10])] @docs_group('Models') -class DatasetStats(BaseModel): +class PublicUserDataResponse(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - read_count: Annotated[int, Field(alias='readCount', examples=[22])] - write_count: Annotated[int, Field(alias='writeCount', examples=[3])] - storage_bytes: Annotated[int, Field(alias='storageBytes', examples=[783])] + data: UserPublicInfo @docs_group('Models') -class Dataset(BaseModel): +class PutItemResponseError(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - id: Annotated[str, Field(examples=['WkzbQMuFYuamGv3YF'])] - name: Annotated[str | None, Field(examples=['d7b9MDYsbtX5L7XAj'])] = None - user_id: Annotated[str, Field(alias='userId', examples=['wRsJZtadYvn4mBZmm'])] - created_at: Annotated[AwareDatetime, Field(alias='createdAt', examples=['2019-12-12T07:34:14.202Z'])] - modified_at: Annotated[AwareDatetime, Field(alias='modifiedAt', examples=['2019-12-13T08:36:13.202Z'])] - accessed_at: Annotated[AwareDatetime, Field(alias='accessedAt', examples=['2019-12-14T08:36:13.202Z'])] - item_count: Annotated[int, Field(alias='itemCount', examples=[7], ge=0)] - clean_item_count: Annotated[int, Field(alias='cleanItemCount', examples=[5], ge=0)] - act_id: Annotated[str | None, Field(alias='actId')] = None - act_run_id: Annotated[str | None, Field(alias='actRunId')] = None - fields: list[str] | None = None - schema_: Annotated[ - dict[str, Any] | None, - Field( - alias='schema', - examples=[ - { - 'actorSpecification': 1, - 'title': 'My dataset', - 'views': { - 'overview': { - 'title': 'Overview', - 'transformation': {'fields': ['linkUrl']}, - 'display': { - 'component': 'table', - 'properties': {'linkUrl': {'label': 'Link URL', 'format': 'link'}}, - }, - } - }, - } - ], - ), - ] = None - """ - Defines the schema of items in your dataset, the full specification can be found in [Apify docs](/platform/actors/development/actor-definition/dataset-schema) - """ - console_url: Annotated[ - AnyUrl, Field(alias='consoleUrl', examples=['https://console.apify.com/storage/datasets/27TmTznX9YPeAYhkC']) - ] - items_public_url: Annotated[ - AnyUrl | None, - Field( - alias='itemsPublicUrl', - examples=['https://api.apify.com/v2/datasets/WkzbQMuFYuamGv3YF/items?signature=abc123'], - ), - ] = None - """ - A public link to access the dataset items directly. - """ - url_signing_secret_key: Annotated[str | None, Field(alias='urlSigningSecretKey')] = None - """ - A secret key for generating signed public URLs. It is only provided to clients with WRITE permission for the dataset. - """ - general_access: Annotated[GeneralAccess | None, Field(alias='generalAccess')] = None - stats: DatasetStats | None = None + error: DatasetSchemaValidationError @docs_group('Models') -class DatasetResponse(BaseModel): - """Response containing dataset metadata.""" +class PutItemsRequest(BaseModel): + """The request body containing the item(s) to add to the dataset. Can be a single + object or an array of objects. Each object represents one dataset item. + + """ model_config = ConfigDict( extra='allow', populate_by_name=True, ) - data: Dataset @docs_group('Models') -class UpdateDatasetRequest(BaseModel): +class PutRecordRequest(BaseModel): + """The request body contains the value to store in the record. The content type + should be specified in the Content-Type header. + + """ + model_config = ConfigDict( extra='allow', populate_by_name=True, ) - name: str | None = None - general_access: Annotated[GeneralAccess | None, Field(alias='generalAccess')] = None @docs_group('Models') -class PutItemsRequest(BaseModel): - """The request body containing the item(s) to add to the dataset. Can be a single - object or an array of objects. Each object represents one dataset item. +class RecordResponse(BaseModel): + """The response body contains the value of the record. The content type of the response + is determined by the Content-Type header stored with the record. """ @@ -2322,135 +2356,153 @@ class PutItemsRequest(BaseModel): @docs_group('Models') -class ValidationError(BaseModel): +class RequestBase(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - instance_path: Annotated[str | None, Field(alias='instancePath')] = None + unique_key: Annotated[ + str | None, Field(alias='uniqueKey', examples=['GET|60d83e70|e3b0c442|https://apify.com']) + ] = None + """ + A unique key used for request de-duplication. Requests with the same unique key are considered identical. """ - The path to the instance being validated. + url: Annotated[str | None, Field(examples=['https://apify.com'])] = None """ - schema_path: Annotated[str | None, Field(alias='schemaPath')] = None + The URL of the request. """ - The path to the schema that failed the validation. + method: HttpMethod | None = None + retry_count: Annotated[int | None, Field(alias='retryCount', examples=[0])] = None """ - keyword: str | None = None + The number of times this request has been retried. """ - The validation keyword that caused the error. + loaded_url: Annotated[str | None, Field(alias='loadedUrl', examples=['https://apify.com/jobs'])] = None """ - message: str | None = None + The final URL that was loaded, after redirects (if any). """ - A message describing the validation error. + payload: Annotated[str | dict[str, Any] | None, Field(examples=[None])] = None """ - params: dict[str, Any] | None = None + The request payload, typically used with POST or PUT requests. """ - Additional parameters specific to the validation error. + headers: Annotated[dict[str, Any] | None, Field(examples=[None])] = None """ - - -@docs_group('Models') -class InvalidItem(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - item_position: Annotated[int | None, Field(alias='itemPosition', examples=[2])] = None + HTTP headers sent with the request. """ - The position of the invalid item in the array. + user_data: Annotated[RequestUserData | None, Field(alias='userData')] = None + no_retry: Annotated[bool | None, Field(alias='noRetry', examples=[False])] = None """ - validation_errors: Annotated[list[ValidationError] | None, Field(alias='validationErrors')] = None + Indicates whether the request should not be retried if processing fails. """ - A complete list of AJV validation error objects for the invalid item. + error_messages: Annotated[list[str] | None, Field(alias='errorMessages', examples=[None])] = None + """ + Error messages recorded from failed processing attempts. + """ + handled_at: Annotated[AwareDatetime | None, Field(alias='handledAt', examples=['2019-06-16T10:23:31.607Z'])] = None + """ + The timestamp when the request was marked as handled, if applicable. """ @docs_group('Models') -class SchemaValidationErrorData(BaseModel): +class Request(RequestBase): + """A request stored in the request queue, including its metadata and processing state.""" + model_config = ConfigDict( extra='allow', populate_by_name=True, ) - invalid_items: Annotated[list[InvalidItem], Field(alias='invalidItems')] + id: Annotated[str | None, Field(examples=['sbJ7klsdf7ujN9l'])] = None """ - A list of invalid items in the received array of items. + A unique identifier assigned to the request. """ @docs_group('Models') -class DatasetSchemaValidationError(BaseModel): +class RequestDraft(BaseModel): + """A request that failed to be processed during a request queue operation and can be retried.""" + model_config = ConfigDict( extra='allow', populate_by_name=True, ) - type: Annotated[str | None, Field(examples=['schema-validation-error'])] = None + id: Annotated[str | None, Field(examples=['sbJ7klsdf7ujN9l'])] = None """ - The type of the error. + A unique identifier assigned to the request. """ - message: Annotated[str | None, Field(examples=['Schema validation failed'])] = None + unique_key: Annotated[str, Field(alias='uniqueKey', examples=['GET|60d83e70|e3b0c442|https://apify.com'])] """ - A human-readable message describing the error. + A unique key used for request de-duplication. Requests with the same unique key are considered identical. """ - data: SchemaValidationErrorData | None = None + url: Annotated[str, Field(examples=['https://apify.com'])] + """ + The URL of the request. + """ + method: HttpMethod | None = None @docs_group('Models') -class PutItemResponseError(BaseModel): +class RequestDraftDeleteById(BaseModel): + """A request that should be deleted, identified by its ID.""" + model_config = ConfigDict( extra='allow', populate_by_name=True, ) - error: DatasetSchemaValidationError + id: Annotated[str, Field(examples=['sbJ7klsdf7ujN9l'])] + """ + A unique identifier assigned to the request. + """ + unique_key: Annotated[ + str | None, Field(alias='uniqueKey', examples=['GET|60d83e70|e3b0c442|https://apify.com']) + ] = None + """ + A unique key used for request de-duplication. Requests with the same unique key are considered identical. + """ @docs_group('Models') -class DatasetFieldStatistics(BaseModel): +class RequestDraftDeleteByUniqueKey(BaseModel): + """A request that should be deleted, identified by its unique key.""" + model_config = ConfigDict( extra='allow', populate_by_name=True, ) - min: float | None = None - """ - Minimum value of the field. For numbers, this is calculated directly. For strings, this is the length of the shortest string. For arrays, this is the length of the shortest array. For objects, this is the number of keys in the smallest object. - """ - max: float | None = None - """ - Maximum value of the field. For numbers, this is calculated directly. For strings, this is the length of the longest string. For arrays, this is the length of the longest array. For objects, this is the number of keys in the largest object. - """ - null_count: Annotated[int | None, Field(alias='nullCount')] = None + id: Annotated[str | None, Field(examples=['sbJ7klsdf7ujN9l'])] = None """ - How many items in the dataset have a null value for this field. + A unique identifier assigned to the request. """ - empty_count: Annotated[int | None, Field(alias='emptyCount')] = None + unique_key: Annotated[str, Field(alias='uniqueKey', examples=['GET|60d83e70|e3b0c442|https://apify.com'])] """ - How many items in the dataset are `undefined`, meaning that for example empty string is not considered empty. + A unique key used for request de-duplication. Requests with the same unique key are considered identical. """ @docs_group('Models') -class DatasetStatistics(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - field_statistics: Annotated[dict[str, Any] | None, Field(alias='fieldStatistics')] = None +class RequestDraftDelete(RootModel[RequestDraftDeleteById | RequestDraftDeleteByUniqueKey]): + root: Annotated[RequestDraftDeleteById | RequestDraftDeleteByUniqueKey, Field(title='RequestDraftDelete')] """ - When you configure the dataset [fields schema](https://docs.apify.com/platform/actors/development/actor-definition/dataset-schema/validation), we measure the statistics such as `min`, `max`, `nullCount` and `emptyCount` for each field. This property provides statistics for each field from dataset fields schema.

See dataset field statistics [documentation](https://docs.apify.com/platform/actors/development/actor-definition/dataset-schema/validation#dataset-field-statistics) for more information. + A request that should be deleted. """ @docs_group('Models') -class DatasetStatisticsResponse(BaseModel): +class RequestLockInfo(BaseModel): + """Information about a request lock.""" + model_config = ConfigDict( extra='allow', populate_by_name=True, ) - data: DatasetStatistics + lock_expires_at: Annotated[AwareDatetime, Field(alias='lockExpiresAt', examples=['2022-06-14T23:00:00.000Z'])] + """ + The timestamp when the lock on this request expires. + """ @docs_group('Models') -class RequestQueueShort(BaseModel): - """A shortened request queue object for list responses.""" +class RequestQueue(BaseModel): + """A request queue object containing metadata and statistics.""" model_config = ConfigDict( extra='allow', @@ -2460,7 +2512,7 @@ class RequestQueueShort(BaseModel): """ A unique identifier assigned to the request queue. """ - name: Annotated[str, Field(examples=['some-name'])] + name: Annotated[str | None, Field(examples=['some-name'])] = None """ The name of the request queue. """ @@ -2468,10 +2520,6 @@ class RequestQueueShort(BaseModel): """ The ID of the user who owns the request queue. """ - username: Annotated[str, Field(examples=['janedoe'])] - """ - The username of the user who owns the request queue. - """ created_at: Annotated[AwareDatetime, Field(alias='createdAt', examples=['2019-12-12T07:34:14.202Z'])] """ The timestamp when the request queue was created. @@ -2484,10 +2532,6 @@ class RequestQueueShort(BaseModel): """ The timestamp when the request queue was last accessed. """ - expire_at: Annotated[AwareDatetime | None, Field(alias='expireAt', examples=['2019-06-02T17:15:06.751Z'])] = None - """ - The timestamp when the request queue will expire and be deleted. - """ total_request_count: Annotated[int, Field(alias='totalRequestCount', examples=[870], ge=0)] """ The total number of requests in the request queue. @@ -2500,78 +2544,60 @@ class RequestQueueShort(BaseModel): """ The number of requests that are pending and have not been handled yet. """ - act_id: Annotated[str | None, Field(alias='actId')] = None - """ - The ID of the Actor that created this request queue. - """ - act_run_id: Annotated[str | None, Field(alias='actRunId')] = None - """ - The ID of the Actor run that created this request queue. - """ had_multiple_clients: Annotated[bool, Field(alias='hadMultipleClients', examples=[True])] """ Whether the request queue has been accessed by multiple different clients. """ - - -@docs_group('Models') -class ListOfRequestQueues(PaginationResponse): - """A paginated list of request queues.""" - - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - items: list[RequestQueueShort] + console_url: Annotated[ + AnyUrl, Field(alias='consoleUrl', examples=['https://api.apify.com/v2/request-queues/27TmTznX9YPeAYhkC']) + ] """ - The array of request queues. + The URL to view the request queue in the Apify console. """ + stats: RequestQueueStats | None = None + general_access: Annotated[GeneralAccess | None, Field(alias='generalAccess')] = None @docs_group('Models') -class ListOfRequestQueuesResponse(BaseModel): - """Response containing a list of request queues.""" - - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - data: ListOfRequestQueues - - -@docs_group('Models') -class RequestQueueStats(BaseModel): - """Statistics about request queue operations and storage.""" +class RequestQueueHead(BaseModel): + """A batch of requests from the request queue head without locking.""" model_config = ConfigDict( extra='allow', populate_by_name=True, ) - delete_count: Annotated[int | None, Field(alias='deleteCount', examples=[0])] = None - """ - The number of delete operations performed on the request queue. - """ - head_item_read_count: Annotated[int | None, Field(alias='headItemReadCount', examples=[5])] = None + limit: Annotated[int, Field(examples=[1000])] """ - The number of times requests from the head were read. + The maximum number of requests returned. """ - read_count: Annotated[int | None, Field(alias='readCount', examples=[100])] = None + queue_modified_at: Annotated[AwareDatetime, Field(alias='queueModifiedAt', examples=['2019-12-13T08:36:13.202Z'])] """ - The total number of read operations performed on the request queue. + The timestamp when the request queue was last modified. Modifications include adding, updating, or removing requests, as well as locking or unlocking requests in the request queue. """ - storage_bytes: Annotated[int | None, Field(alias='storageBytes', examples=[1024])] = None + had_multiple_clients: Annotated[bool, Field(alias='hadMultipleClients', examples=[True])] """ - The total storage size in bytes used by the request queue. + Whether the request queue has been accessed by multiple different clients. """ - write_count: Annotated[int | None, Field(alias='writeCount', examples=[10])] = None + items: list[HeadRequest] """ - The total number of write operations performed on the request queue. + The array of requests from the request queue head. """ @docs_group('Models') -class RequestQueue(BaseModel): - """A request queue object containing metadata and statistics.""" +class RequestQueueResponse(BaseModel): + """Response containing request queue data.""" + + model_config = ConfigDict( + extra='allow', + populate_by_name=True, + ) + data: RequestQueue + + +@docs_group('Models') +class RequestQueueShort(BaseModel): + """A shortened request queue object for list responses.""" model_config = ConfigDict( extra='allow', @@ -2581,7 +2607,7 @@ class RequestQueue(BaseModel): """ A unique identifier assigned to the request queue. """ - name: Annotated[str | None, Field(examples=['some-name'])] = None + name: Annotated[str, Field(examples=['some-name'])] """ The name of the request queue. """ @@ -2589,6 +2615,10 @@ class RequestQueue(BaseModel): """ The ID of the user who owns the request queue. """ + username: Annotated[str, Field(examples=['janedoe'])] + """ + The username of the user who owns the request queue. + """ created_at: Annotated[AwareDatetime, Field(alias='createdAt', examples=['2019-12-12T07:34:14.202Z'])] """ The timestamp when the request queue was created. @@ -2601,69 +2631,111 @@ class RequestQueue(BaseModel): """ The timestamp when the request queue was last accessed. """ + expire_at: Annotated[AwareDatetime | None, Field(alias='expireAt', examples=['2019-06-02T17:15:06.751Z'])] = None + """ + The timestamp when the request queue will expire and be deleted. + """ total_request_count: Annotated[int, Field(alias='totalRequestCount', examples=[870], ge=0)] """ The total number of requests in the request queue. """ handled_request_count: Annotated[int, Field(alias='handledRequestCount', examples=[100], ge=0)] """ - The number of requests that have been handled. + The number of requests that have been handled. + """ + pending_request_count: Annotated[int, Field(alias='pendingRequestCount', examples=[670], ge=0)] + """ + The number of requests that are pending and have not been handled yet. + """ + act_id: Annotated[str | None, Field(alias='actId')] = None + """ + The ID of the Actor that created this request queue. + """ + act_run_id: Annotated[str | None, Field(alias='actRunId')] = None + """ + The ID of the Actor run that created this request queue. + """ + had_multiple_clients: Annotated[bool, Field(alias='hadMultipleClients', examples=[True])] + """ + Whether the request queue has been accessed by multiple different clients. + """ + + +@docs_group('Models') +class RequestQueueStats(BaseModel): + """Statistics about request queue operations and storage.""" + + model_config = ConfigDict( + extra='allow', + populate_by_name=True, + ) + delete_count: Annotated[int | None, Field(alias='deleteCount', examples=[0])] = None + """ + The number of delete operations performed on the request queue. + """ + head_item_read_count: Annotated[int | None, Field(alias='headItemReadCount', examples=[5])] = None + """ + The number of times requests from the head were read. """ - pending_request_count: Annotated[int, Field(alias='pendingRequestCount', examples=[670], ge=0)] + read_count: Annotated[int | None, Field(alias='readCount', examples=[100])] = None """ - The number of requests that are pending and have not been handled yet. + The total number of read operations performed on the request queue. """ - had_multiple_clients: Annotated[bool, Field(alias='hadMultipleClients', examples=[True])] + storage_bytes: Annotated[int | None, Field(alias='storageBytes', examples=[1024])] = None """ - Whether the request queue has been accessed by multiple different clients. + The total storage size in bytes used by the request queue. """ - console_url: Annotated[ - AnyUrl, Field(alias='consoleUrl', examples=['https://api.apify.com/v2/request-queues/27TmTznX9YPeAYhkC']) - ] + write_count: Annotated[int | None, Field(alias='writeCount', examples=[10])] = None """ - The URL to view the request queue in the Apify console. + The total number of write operations performed on the request queue. """ - stats: RequestQueueStats | None = None - general_access: Annotated[GeneralAccess | None, Field(alias='generalAccess')] = None @docs_group('Models') -class RequestQueueResponse(BaseModel): - """Response containing request queue data.""" +class RequestQueues(BaseModel): + """Aliased request queue IDs for this run.""" model_config = ConfigDict( extra='allow', populate_by_name=True, ) - data: RequestQueue + default: Annotated[str | None, Field(examples=['FL35cSF7jrxr3BY39'])] = None + """ + ID of the default request queue for this run. + """ @docs_group('Models') -class UpdateRequestQueueRequest(BaseModel): - """Request object for updating a request queue.""" +class RequestRegistration(BaseModel): + """Result of registering a request in the request queue, either by adding a new request or updating an existing one.""" model_config = ConfigDict( extra='allow', populate_by_name=True, ) - name: str | None = None + request_id: Annotated[str, Field(alias='requestId', examples=['sbJ7klsdf7ujN9l'])] """ - The new name for the request queue. + A unique identifier assigned to the request. + """ + was_already_present: Annotated[bool, Field(alias='wasAlreadyPresent', examples=[False])] + """ + Indicates whether a request with the same unique key already existed in the request queue. If true, no new request was created. + """ + was_already_handled: Annotated[bool, Field(alias='wasAlreadyHandled', examples=[False])] + """ + Indicates whether a request with the same unique key has already been processed by the request queue. """ - general_access: Annotated[GeneralAccess | None, Field(alias='generalAccess')] = None @docs_group('Models') -class HttpMethod(StrEnum): - GET = 'GET' - HEAD = 'HEAD' - POST = 'POST' - PUT = 'PUT' - DELETE = 'DELETE' - CONNECT = 'CONNECT' - OPTIONS = 'OPTIONS' - TRACE = 'TRACE' - PATCH = 'PATCH' +class RequestResponse(BaseModel): + """Response containing a single request from the request queue.""" + + model_config = ConfigDict( + extra='allow', + populate_by_name=True, + ) + data: Request @docs_group('Models') @@ -2677,1069 +2749,976 @@ class RequestUserData(BaseModel): @docs_group('Models') -class RequestBase(BaseModel): +class Run(BaseModel): + """Represents an Actor run and its associated data.""" + model_config = ConfigDict( extra='allow', populate_by_name=True, ) - unique_key: Annotated[ - str | None, Field(alias='uniqueKey', examples=['GET|60d83e70|e3b0c442|https://apify.com']) - ] = None + id: Annotated[str, Field(examples=['HG7ML7M8z78YcAPEB'])] """ - A unique key used for request de-duplication. Requests with the same unique key are considered identical. + Unique identifier of the Actor run. """ - url: Annotated[str | None, Field(examples=['https://apify.com'])] = None + act_id: Annotated[str, Field(alias='actId', examples=['HDSasDasz78YcAPEB'])] """ - The URL of the request. + ID of the Actor that was run. """ - method: HttpMethod | None = None - retry_count: Annotated[int | None, Field(alias='retryCount', examples=[0])] = None + user_id: Annotated[str, Field(alias='userId', examples=['7sT5jcggjjA9fNcxF'])] """ - The number of times this request has been retried. + ID of the user who started the run. """ - loaded_url: Annotated[str | None, Field(alias='loadedUrl', examples=['https://apify.com/jobs'])] = None + actor_task_id: Annotated[str | None, Field(alias='actorTaskId', examples=['KJHSKHausidyaJKHs'])] = None """ - The final URL that was loaded, after redirects (if any). + ID of the Actor task, if the run was started from a task. """ - payload: Annotated[str | dict[str, Any] | None, Field(examples=[None])] = None + started_at: Annotated[AwareDatetime, Field(alias='startedAt', examples=['2019-11-30T07:34:24.202Z'])] """ - The request payload, typically used with POST or PUT requests. + Time when the Actor run started. """ - headers: Annotated[dict[str, Any] | None, Field(examples=[None])] = None + finished_at: Annotated[AwareDatetime | None, Field(alias='finishedAt', examples=['2019-12-12T09:30:12.202Z'])] = ( + None + ) """ - HTTP headers sent with the request. + Time when the Actor run finished. """ - user_data: Annotated[RequestUserData | None, Field(alias='userData')] = None - no_retry: Annotated[bool | None, Field(alias='noRetry', examples=[False])] = None + status: ActorJobStatus """ - Indicates whether the request should not be retried if processing fails. + Current status of the Actor run. """ - error_messages: Annotated[list[str] | None, Field(alias='errorMessages', examples=[None])] = None + status_message: Annotated[str | None, Field(alias='statusMessage', examples=['Actor is running'])] = None """ - Error messages recorded from failed processing attempts. + Detailed message about the run status. """ - handled_at: Annotated[AwareDatetime | None, Field(alias='handledAt', examples=['2019-06-16T10:23:31.607Z'])] = None + is_status_message_terminal: Annotated[bool | None, Field(alias='isStatusMessageTerminal', examples=[False])] = None """ - The timestamp when the request was marked as handled, if applicable. + Whether the status message is terminal (final). """ - - -@docs_group('Models') -class AddedRequest(BaseModel): - """Information about a request that was successfully added to a request queue.""" - - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - request_id: Annotated[str, Field(alias='requestId', examples=['sbJ7klsdf7ujN9l'])] + meta: RunMeta """ - A unique identifier assigned to the request. + Metadata about the Actor run. """ - unique_key: Annotated[str, Field(alias='uniqueKey', examples=['GET|60d83e70|e3b0c442|https://apify.com'])] + pricing_info: Annotated[ + PayPerEventActorPricingInfo + | PricePerDatasetItemActorPricingInfo + | FlatPricePerMonthActorPricingInfo + | FreeActorPricingInfo + | None, + Field(alias='pricingInfo', discriminator='pricing_model', title='ActorRunPricingInfo'), + ] = None """ - A unique key used for request de-duplication. Requests with the same unique key are considered identical. + Pricing information for the Actor. """ - was_already_present: Annotated[bool, Field(alias='wasAlreadyPresent', examples=[False])] + stats: RunStats """ - Indicates whether a request with the same unique key already existed in the request queue. If true, no new request was created. + Statistics of the Actor run. """ - was_already_handled: Annotated[bool, Field(alias='wasAlreadyHandled', examples=[False])] + charged_event_counts: Annotated[ + dict[str, int] | None, + Field(alias='chargedEventCounts', examples=[{'actor-start': 1, 'page-crawled': 150, 'data-extracted': 75}]), + ] = None """ - Indicates whether a request with the same unique key has already been processed by the request queue. + A map of charged event types to their counts. The keys are event type identifiers defined by the Actor's pricing model (pay-per-event), and the values are the number of times each event was charged during this run. """ - - -@docs_group('Models') -class RequestDraft(BaseModel): - """A request that failed to be processed during a request queue operation and can be retried.""" - - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - id: Annotated[str | None, Field(examples=['sbJ7klsdf7ujN9l'])] = None + options: RunOptions """ - A unique identifier assigned to the request. + Configuration options for the Actor run. """ - unique_key: Annotated[str, Field(alias='uniqueKey', examples=['GET|60d83e70|e3b0c442|https://apify.com'])] + build_id: Annotated[str, Field(alias='buildId', examples=['7sT5jcggjjA9fNcxF'])] """ - A unique key used for request de-duplication. Requests with the same unique key are considered identical. + ID of the Actor build used for this run. """ - url: Annotated[str, Field(examples=['https://apify.com'])] + exit_code: Annotated[int | None, Field(alias='exitCode', examples=[0])] = None """ - The URL of the request. + Exit code of the Actor run process. """ - method: HttpMethod | None = None - - -@docs_group('Models') -class BatchAddResult(BaseModel): - """Result of a batch add operation containing successfully processed and failed requests.""" - - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - processed_requests: Annotated[list[AddedRequest], Field(alias='processedRequests')] + general_access: Annotated[GeneralAccess, Field(alias='generalAccess')] """ - Requests that were successfully added to the request queue. + General access level for the Actor run. """ - unprocessed_requests: Annotated[list[RequestDraft], Field(alias='unprocessedRequests')] + default_key_value_store_id: Annotated[str, Field(alias='defaultKeyValueStoreId', examples=['eJNzqsbPiopwJcgGQ'])] """ - Requests that failed to be added and can be retried. + ID of the default key-value store for this run. """ - - -@docs_group('Models') -class BatchAddResponse(BaseModel): - """Response containing the result of a batch add operation.""" - - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - data: BatchAddResult - - -@docs_group('Models') -class RequestDraftDeleteById(BaseModel): - """A request that should be deleted, identified by its ID.""" - - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - id: Annotated[str, Field(examples=['sbJ7klsdf7ujN9l'])] + default_dataset_id: Annotated[str, Field(alias='defaultDatasetId', examples=['wmKPijuyDnPZAPRMk'])] """ - A unique identifier assigned to the request. + ID of the default dataset for this run. """ - unique_key: Annotated[ - str | None, Field(alias='uniqueKey', examples=['GET|60d83e70|e3b0c442|https://apify.com']) + default_request_queue_id: Annotated[str, Field(alias='defaultRequestQueueId', examples=['FL35cSF7jrxr3BY39'])] + """ + ID of the default request queue for this run. + """ + storage_ids: Annotated[StorageIds | None, Field(alias='storageIds')] = None + """ + A map of aliased storage IDs associated with this run, grouped by storage type. + """ + build_number: Annotated[str | None, Field(alias='buildNumber', examples=['0.0.36'])] = None + """ + Build number of the Actor build used for this run. + """ + container_url: Annotated[ + AnyUrl | None, Field(alias='containerUrl', examples=['https://g8kd8kbc5ge8.runs.apify.net']) ] = None """ - A unique key used for request de-duplication. Requests with the same unique key are considered identical. + URL of the container running the Actor. """ - - -@docs_group('Models') -class RequestDraftDeleteByUniqueKey(BaseModel): - """A request that should be deleted, identified by its unique key.""" - - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - id: Annotated[str | None, Field(examples=['sbJ7klsdf7ujN9l'])] = None + is_container_server_ready: Annotated[bool | None, Field(alias='isContainerServerReady', examples=[True])] = None """ - A unique identifier assigned to the request. + Whether the container's HTTP server is ready to accept requests. """ - unique_key: Annotated[str, Field(alias='uniqueKey', examples=['GET|60d83e70|e3b0c442|https://apify.com'])] + git_branch_name: Annotated[str | None, Field(alias='gitBranchName', examples=['master'])] = None + """ + Name of the git branch used for the Actor build. + """ + usage: RunUsage | None = None + """ + Resource usage statistics for the run. + """ + usage_total_usd: Annotated[float | None, Field(alias='usageTotalUsd', examples=[0.2654])] = None + """ + Total cost in USD for this run. Represents what you actually pay. For run owners: includes platform usage (compute units) and/or event costs depending on the Actor's pricing model. For run non-owners: only available for Pay-Per-Event Actors (event costs only). Not available for Pay-Per-Result Actors when you're not the Actor owner. + """ + usage_usd: Annotated[RunUsageUsd | None, Field(alias='usageUsd')] = None """ - A unique key used for request de-duplication. Requests with the same unique key are considered identical. + Platform usage costs breakdown in USD. Only present if you own the run AND are paying for platform usage (Pay-Per-Usage, Rental, or Pay-Per-Event with usage costs like standby Actors). Not available for standard Pay-Per-Event Actors or Pay-Per-Result Actors owned by others. """ - - -@docs_group('Models') -class RequestDraftDelete(RootModel[RequestDraftDeleteById | RequestDraftDeleteByUniqueKey]): - root: Annotated[RequestDraftDeleteById | RequestDraftDeleteByUniqueKey, Field(title='RequestDraftDelete')] + metamorphs: list[Metamorph] | None = None """ - A request that should be deleted. + List of metamorph events that occurred during the run. """ @docs_group('Models') -class DeletedRequestById(BaseModel): - """Confirmation of a request that was successfully deleted, identified by its ID.""" - +class RunFailedErrorDetail(ErrorDetail): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - unique_key: Annotated[ - str | None, Field(alias='uniqueKey', examples=['GET|60d83e70|e3b0c442|https://apify.com']) - ] = None - """ - A unique key used for request de-duplication. Requests with the same unique key are considered identical. - """ - id: Annotated[str, Field(examples=['sbJ7klsdf7ujN9l'])] + type: Annotated[Literal['run-failed'], Field(title='ErrorType')] = 'run-failed' """ - A unique identifier assigned to the request. + Machine-processable error type identifier. """ @docs_group('Models') -class DeletedRequestByUniqueKey(BaseModel): - """Confirmation of a request that was successfully deleted, identified by its unique key.""" - +class RunMeta(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - unique_key: Annotated[str, Field(alias='uniqueKey', examples=['GET|60d83e70|e3b0c442|https://apify.com'])] + origin: RunOrigin + client_ip: Annotated[str | None, Field(alias='clientIp')] = None """ - A unique key used for request de-duplication. Requests with the same unique key are considered identical. + IP address of the client that started the run. """ - id: Annotated[str | None, Field(examples=['sbJ7klsdf7ujN9l'])] = None + user_agent: Annotated[str | None, Field(alias='userAgent')] = None """ - A unique identifier assigned to the request. + User agent of the client that started the run. """ - - -@docs_group('Models') -class BatchDeleteResult(BaseModel): - """Result of a batch delete operation containing successfully deleted and failed requests.""" - - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - processed_requests: Annotated[ - list[DeletedRequestById | DeletedRequestByUniqueKey], Field(alias='processedRequests') - ] + schedule_id: Annotated[str | None, Field(alias='scheduleId')] = None """ - Requests that were successfully deleted from the request queue. + ID of the schedule that triggered the run. """ - unprocessed_requests: Annotated[list[RequestDraft], Field(alias='unprocessedRequests')] + scheduled_at: Annotated[AwareDatetime | None, Field(alias='scheduledAt')] = None """ - Requests that failed to be deleted and can be retried. + Time when the run was scheduled. """ @docs_group('Models') -class BatchDeleteResponse(BaseModel): - """Response containing the result of a batch delete operation.""" - +class RunOptions(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - data: BatchDeleteResult + build: Annotated[str, Field(examples=['latest'])] + timeout_secs: Annotated[int, Field(alias='timeoutSecs', examples=[300], ge=0)] + memory_mbytes: Annotated[int, Field(alias='memoryMbytes', examples=[1024], ge=128, le=32768)] + disk_mbytes: Annotated[int, Field(alias='diskMbytes', examples=[2048], ge=0)] + max_items: Annotated[int | None, Field(alias='maxItems', examples=[1000], ge=1)] = None + max_total_charge_usd: Annotated[float | None, Field(alias='maxTotalChargeUsd', examples=[5], ge=0.0)] = None @docs_group('Models') -class UnlockRequestsResult(BaseModel): - """Result of unlocking requests in the request queue.""" - - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - unlocked_count: Annotated[int, Field(alias='unlockedCount', examples=[10])] - """ - Number of requests that were successfully unlocked. - """ +class RunOrigin(StrEnum): + DEVELOPMENT = 'DEVELOPMENT' + WEB = 'WEB' + API = 'API' + SCHEDULER = 'SCHEDULER' + TEST = 'TEST' + WEBHOOK = 'WEBHOOK' + ACTOR = 'ACTOR' + CLI = 'CLI' + STANDBY = 'STANDBY' @docs_group('Models') -class UnlockRequestsResponse(BaseModel): - """Response containing the result of unlocking requests.""" - +class RunResponse(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - data: UnlockRequestsResult + data: Run @docs_group('Models') -class Request(RequestBase): - """A request stored in the request queue, including its metadata and processing state.""" - +class RunShort(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - id: Annotated[str | None, Field(examples=['sbJ7klsdf7ujN9l'])] = None - """ - A unique identifier assigned to the request. - """ + id: Annotated[str, Field(examples=['HG7ML7M8z78YcAPEB'])] + act_id: Annotated[str, Field(alias='actId', examples=['HDSasDasz78YcAPEB'])] + actor_task_id: Annotated[str | None, Field(alias='actorTaskId', examples=['KJHSKHausidyaJKHs'])] = None + status: ActorJobStatus + started_at: Annotated[AwareDatetime, Field(alias='startedAt', examples=['2019-11-30T07:34:24.202Z'])] + finished_at: Annotated[AwareDatetime | None, Field(alias='finishedAt', examples=['2019-12-12T09:30:12.202Z'])] = ( + None + ) + build_id: Annotated[str, Field(alias='buildId', examples=['HG7ML7M8z78YcAPEB'])] + build_number: Annotated[str | None, Field(alias='buildNumber', examples=['0.0.2'])] = None + meta: RunMeta + usage_total_usd: Annotated[float, Field(alias='usageTotalUsd', examples=[0.2])] + default_key_value_store_id: Annotated[str, Field(alias='defaultKeyValueStoreId', examples=['sfAjeR4QmeJCQzTfe'])] + default_dataset_id: Annotated[str, Field(alias='defaultDatasetId', examples=['3ZojQDdFTsyE7Moy4'])] + default_request_queue_id: Annotated[str, Field(alias='defaultRequestQueueId', examples=['so93g2shcDzK3pA85'])] @docs_group('Models') -class ListOfRequests(BaseModel): - """A paginated list of requests from the request queue.""" - +class RunStats(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - items: list[Request] - """ - The array of requests. - """ - count: Annotated[int | None, Field(examples=[2])] = None - """ - The total number of requests matching the query. - """ - limit: Annotated[int, Field(examples=[2])] - """ - The maximum number of requests returned in this response. - """ - exclusive_start_id: Annotated[ - str | None, Field(alias='exclusiveStartId', deprecated=True, examples=['Ihnsp8YrvJ8102Kj']) - ] = None - """ - The ID of the last request from the previous page, used for pagination. - """ - cursor: Annotated[str | None, Field(examples=['eyJyZXF1ZXN0SWQiOiI0SVlLUWFXZ2FKUUlWNlMifQ'])] = None - """ - A cursor string used for current page of results. - """ - next_cursor: Annotated[ - str | None, Field(alias='nextCursor', examples=['eyJyZXF1ZXN0SWQiOiI5eFNNc1BrN1J6VUxTNXoifQ']) - ] = None - """ - A cursor string to be used to continue pagination. - """ + input_body_len: Annotated[int | None, Field(alias='inputBodyLen', examples=[240], ge=0)] = None + migration_count: Annotated[int | None, Field(alias='migrationCount', examples=[0], ge=0)] = None + reboot_count: Annotated[int | None, Field(alias='rebootCount', examples=[0], ge=0)] = None + restart_count: Annotated[int, Field(alias='restartCount', examples=[0], ge=0)] + resurrect_count: Annotated[int, Field(alias='resurrectCount', examples=[2], ge=0)] + mem_avg_bytes: Annotated[float | None, Field(alias='memAvgBytes', examples=[267874071.9])] = None + mem_max_bytes: Annotated[int | None, Field(alias='memMaxBytes', examples=[404713472], ge=0)] = None + mem_current_bytes: Annotated[int | None, Field(alias='memCurrentBytes', examples=[0], ge=0)] = None + cpu_avg_usage: Annotated[float | None, Field(alias='cpuAvgUsage', examples=[33.7532101107538])] = None + cpu_max_usage: Annotated[float | None, Field(alias='cpuMaxUsage', examples=[169.650735534941])] = None + cpu_current_usage: Annotated[float | None, Field(alias='cpuCurrentUsage', examples=[0])] = None + net_rx_bytes: Annotated[int | None, Field(alias='netRxBytes', examples=[103508042], ge=0)] = None + net_tx_bytes: Annotated[int | None, Field(alias='netTxBytes', examples=[4854600], ge=0)] = None + duration_millis: Annotated[int | None, Field(alias='durationMillis', examples=[248472], ge=0)] = None + run_time_secs: Annotated[float | None, Field(alias='runTimeSecs', examples=[248.472], ge=0.0)] = None + metamorph: Annotated[int | None, Field(examples=[0], ge=0)] = None + compute_units: Annotated[float, Field(alias='computeUnits', examples=[0.13804], ge=0.0)] @docs_group('Models') -class ListOfRequestsResponse(BaseModel): - """Response containing a list of requests from the request queue.""" - +class RunTimeoutExceededErrorDetail(ErrorDetail): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - data: ListOfRequests + type: Annotated[Literal['run-timeout-exceeded'], Field(title='ErrorType')] = 'run-timeout-exceeded' + """ + Machine-processable error type identifier. + """ @docs_group('Models') -class RequestRegistration(BaseModel): - """Result of registering a request in the request queue, either by adding a new request or updating an existing one.""" - +class RunUsage(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - request_id: Annotated[str, Field(alias='requestId', examples=['sbJ7klsdf7ujN9l'])] - """ - A unique identifier assigned to the request. - """ - was_already_present: Annotated[bool, Field(alias='wasAlreadyPresent', examples=[False])] - """ - Indicates whether a request with the same unique key already existed in the request queue. If true, no new request was created. - """ - was_already_handled: Annotated[bool, Field(alias='wasAlreadyHandled', examples=[False])] - """ - Indicates whether a request with the same unique key has already been processed by the request queue. - """ + actor_compute_units: Annotated[float | None, Field(alias='ACTOR_COMPUTE_UNITS', examples=[3])] = None + dataset_reads: Annotated[int | None, Field(alias='DATASET_READS', examples=[4])] = None + dataset_writes: Annotated[int | None, Field(alias='DATASET_WRITES', examples=[4])] = None + key_value_store_reads: Annotated[int | None, Field(alias='KEY_VALUE_STORE_READS', examples=[5])] = None + key_value_store_writes: Annotated[int | None, Field(alias='KEY_VALUE_STORE_WRITES', examples=[3])] = None + key_value_store_lists: Annotated[int | None, Field(alias='KEY_VALUE_STORE_LISTS', examples=[5])] = None + request_queue_reads: Annotated[int | None, Field(alias='REQUEST_QUEUE_READS', examples=[2])] = None + request_queue_writes: Annotated[int | None, Field(alias='REQUEST_QUEUE_WRITES', examples=[1])] = None + data_transfer_internal_gbytes: Annotated[ + float | None, Field(alias='DATA_TRANSFER_INTERNAL_GBYTES', examples=[1]) + ] = None + data_transfer_external_gbytes: Annotated[ + float | None, Field(alias='DATA_TRANSFER_EXTERNAL_GBYTES', examples=[3]) + ] = None + proxy_residential_transfer_gbytes: Annotated[ + float | None, Field(alias='PROXY_RESIDENTIAL_TRANSFER_GBYTES', examples=[34]) + ] = None + proxy_serps: Annotated[int | None, Field(alias='PROXY_SERPS', examples=[3])] = None @docs_group('Models') -class AddRequestResponse(BaseModel): - """Response containing the result of adding a request to the request queue.""" +class RunUsageUsd(BaseModel): + """Resource usage costs in USD. All values are monetary amounts in US dollars.""" model_config = ConfigDict( extra='allow', populate_by_name=True, ) - data: RequestRegistration + actor_compute_units: Annotated[float | None, Field(alias='ACTOR_COMPUTE_UNITS', examples=[0.0003])] = None + dataset_reads: Annotated[float | None, Field(alias='DATASET_READS', examples=[0.0001])] = None + dataset_writes: Annotated[float | None, Field(alias='DATASET_WRITES', examples=[0.0001])] = None + key_value_store_reads: Annotated[float | None, Field(alias='KEY_VALUE_STORE_READS', examples=[0.0001])] = None + key_value_store_writes: Annotated[float | None, Field(alias='KEY_VALUE_STORE_WRITES', examples=[5e-05])] = None + key_value_store_lists: Annotated[float | None, Field(alias='KEY_VALUE_STORE_LISTS', examples=[0.0001])] = None + request_queue_reads: Annotated[float | None, Field(alias='REQUEST_QUEUE_READS', examples=[0.0001])] = None + request_queue_writes: Annotated[float | None, Field(alias='REQUEST_QUEUE_WRITES', examples=[0.0001])] = None + data_transfer_internal_gbytes: Annotated[ + float | None, Field(alias='DATA_TRANSFER_INTERNAL_GBYTES', examples=[0.001]) + ] = None + data_transfer_external_gbytes: Annotated[ + float | None, Field(alias='DATA_TRANSFER_EXTERNAL_GBYTES', examples=[0.003]) + ] = None + proxy_residential_transfer_gbytes: Annotated[ + float | None, Field(alias='PROXY_RESIDENTIAL_TRANSFER_GBYTES', examples=[0.034]) + ] = None + proxy_serps: Annotated[float | None, Field(alias='PROXY_SERPS', examples=[0.003])] = None @docs_group('Models') -class RequestResponse(BaseModel): - """Response containing a single request from the request queue.""" - +class ScheduleActionRunActor(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - data: Request + id: Annotated[str, Field(examples=['c6KfSgoQzFhMk3etc'])] + type: Literal['RUN_ACTOR'] + actor_id: Annotated[str, Field(alias='actorId', examples=['jF8GGEvbEg4Au3NLA'])] + run_input: Annotated[ScheduleActionRunInput | None, Field(alias='runInput')] = None + run_options: Annotated[TaskOptions | None, Field(alias='runOptions')] = None @docs_group('Models') -class UpdateRequestResponse(BaseModel): - """Response containing the result of updating a request in the request queue.""" - +class ScheduleActionRunActorTask(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - data: RequestRegistration - + id: Annotated[str, Field(examples=['c6KfSgoQzFhMk3etc'])] + type: Literal['RUN_ACTOR_TASK'] + actor_task_id: Annotated[str, Field(alias='actorTaskId', examples=['jF8GGEvbEg4Au3NLA'])] + input: dict[str, Any] | None = None -@docs_group('Models') -class HeadRequest(BaseModel): - """A request from the request queue head without lock information.""" +@docs_group('Models') +class ScheduleActionRunInput(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - id: Annotated[str, Field(examples=['sbJ7klsdf7ujN9l'])] - """ - A unique identifier assigned to the request. - """ - unique_key: Annotated[str, Field(alias='uniqueKey', examples=['GET|60d83e70|e3b0c442|https://apify.com'])] - """ - A unique key used for request de-duplication. Requests with the same unique key are considered identical. - """ - url: Annotated[str, Field(examples=['https://apify.com'])] - """ - The URL of the request. - """ - method: HttpMethod | None = None - retry_count: Annotated[int | None, Field(alias='retryCount', examples=[0])] = None - """ - The number of times this request has been retried. - """ + body: Annotated[str | None, Field(examples=['{\\n "foo": "actor"\\n}'])] = None + content_type: Annotated[str | None, Field(alias='contentType', examples=['application/json; charset=utf-8'])] = None @docs_group('Models') -class RequestQueueHead(BaseModel): - """A batch of requests from the request queue head without locking.""" - +class ScheduleActionShortRunActor(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - limit: Annotated[int, Field(examples=[1000])] - """ - The maximum number of requests returned. - """ - queue_modified_at: Annotated[AwareDatetime, Field(alias='queueModifiedAt', examples=['2019-12-13T08:36:13.202Z'])] - """ - The timestamp when the request queue was last modified. Modifications include adding, updating, or removing requests, as well as locking or unlocking requests in the request queue. - """ - had_multiple_clients: Annotated[bool, Field(alias='hadMultipleClients', examples=[True])] - """ - Whether the request queue has been accessed by multiple different clients. - """ - items: list[HeadRequest] - """ - The array of requests from the request queue head. - """ + id: Annotated[str, Field(examples=['ZReCs7hkdieq8ZUki'])] + type: Literal['RUN_ACTOR'] + actor_id: Annotated[str, Field(alias='actorId', examples=['HKhKmiCMrDgu9eXeE'])] @docs_group('Models') -class HeadResponse(BaseModel): - """Response containing requests from the request queue head without locking.""" - +class ScheduleActionShortRunActorTask(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - data: RequestQueueHead + id: Annotated[str, Field(examples=['ZReCs7hkdieq8ZUki'])] + type: Literal['RUN_ACTOR_TASK'] + actor_task_id: Annotated[str, Field(alias='actorTaskId', examples=['HKhKmiCMrDgu9eXeE'])] @docs_group('Models') -class LockedHeadRequest(BaseModel): - """A request from the request queue head that has been locked for processing.""" - +class ScheduleBase(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - id: Annotated[str, Field(examples=['sbJ7klsdf7ujN9l'])] - """ - A unique identifier assigned to the request. - """ - unique_key: Annotated[str, Field(alias='uniqueKey', examples=['GET|60d83e70|e3b0c442|https://apify.com'])] - """ - A unique key used for request de-duplication. Requests with the same unique key are considered identical. - """ - url: Annotated[str, Field(examples=['https://apify.com'])] - """ - The URL of the request. - """ - method: HttpMethod | None = None - retry_count: Annotated[int | None, Field(alias='retryCount', examples=[0])] = None - """ - The number of times this request has been retried. - """ - lock_expires_at: Annotated[AwareDatetime, Field(alias='lockExpiresAt', examples=['2022-06-14T23:00:00.000Z'])] - """ - The timestamp when the lock on this request expires. - """ + id: Annotated[str, Field(examples=['asdLZtadYvn4mBZmm'])] + user_id: Annotated[str, Field(alias='userId', examples=['wRsJZtadYvn4mBZmm'])] + name: Annotated[str, Field(examples=['my-schedule'])] + cron_expression: Annotated[str, Field(alias='cronExpression', examples=['* * * * *'])] + timezone: Annotated[str, Field(examples=['UTC'])] + is_enabled: Annotated[bool, Field(alias='isEnabled', examples=[True])] + is_exclusive: Annotated[bool, Field(alias='isExclusive', examples=[True])] + created_at: Annotated[AwareDatetime, Field(alias='createdAt', examples=['2019-12-12T07:34:14.202Z'])] + modified_at: Annotated[AwareDatetime, Field(alias='modifiedAt', examples=['2019-12-20T06:33:11.202Z'])] + next_run_at: Annotated[AwareDatetime | None, Field(alias='nextRunAt', examples=['2019-04-12T07:34:10.202Z'])] = None + last_run_at: Annotated[AwareDatetime | None, Field(alias='lastRunAt', examples=['2019-04-12T07:33:10.202Z'])] = None @docs_group('Models') -class LockedRequestQueueHead(BaseModel): - """A batch of locked requests from the request queue head.""" - +class Schedule(ScheduleBase): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - limit: Annotated[int, Field(examples=[1000])] - """ - The maximum number of requests returned. - """ - queue_modified_at: Annotated[AwareDatetime, Field(alias='queueModifiedAt', examples=['2019-12-13T08:36:13.202Z'])] - """ - The timestamp when the request queue was last modified. Modifications include adding, updating, or removing requests, as well as locking or unlocking requests in the request queue. - """ - queue_has_locked_requests: Annotated[bool | None, Field(alias='queueHasLockedRequests', examples=[True])] = None - """ - Whether the request queue contains requests locked by any client (either the one calling the endpoint or a different one). - """ - client_key: Annotated[str | None, Field(alias='clientKey', examples=['client-one'])] = None - """ - The client key used for locking the requests. - """ - had_multiple_clients: Annotated[bool, Field(alias='hadMultipleClients', examples=[True])] - """ - Whether the request queue has been accessed by multiple different clients. - """ - lock_secs: Annotated[int, Field(alias='lockSecs', examples=[60])] - """ - The number of seconds the locks will be held. - """ - items: list[LockedHeadRequest] - """ - The array of locked requests from the request queue head. - """ + description: Annotated[str | None, Field(examples=['Schedule of actor ...'])] = None + title: str | None = None + actions: list[Annotated[ScheduleActionRunActor | ScheduleActionRunActorTask, Field(discriminator='type')]] @docs_group('Models') -class HeadAndLockResponse(BaseModel): - """Response containing locked requests from the request queue head.""" - +class ScheduleCreate(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - data: LockedRequestQueueHead + name: Annotated[str | None, Field(examples=['my-schedule'])] = None + is_enabled: Annotated[bool | None, Field(alias='isEnabled', examples=[True])] = None + is_exclusive: Annotated[bool | None, Field(alias='isExclusive', examples=[True])] = None + cron_expression: Annotated[str | None, Field(alias='cronExpression', examples=['* * * * *'])] = None + timezone: Annotated[str | None, Field(examples=['UTC'])] = None + description: Annotated[str | None, Field(examples=['Schedule of actor ...'])] = None + title: str | None = None + actions: ( + list[Annotated[ScheduleCreateActionRunActor | ScheduleCreateActionRunActorTask, Field(discriminator='type')]] + | None + ) = None @docs_group('Models') -class RequestLockInfo(BaseModel): - """Information about a request lock.""" - +class ScheduleCreateActionRunActor(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - lock_expires_at: Annotated[AwareDatetime, Field(alias='lockExpiresAt', examples=['2022-06-14T23:00:00.000Z'])] - """ - The timestamp when the lock on this request expires. - """ + type: Literal['RUN_ACTOR'] + actor_id: Annotated[str, Field(alias='actorId', examples=['jF8GGEvbEg4Au3NLA'])] + run_input: Annotated[ScheduleActionRunInput | None, Field(alias='runInput')] = None + run_options: Annotated[TaskOptions | None, Field(alias='runOptions')] = None @docs_group('Models') -class ProlongRequestLockResponse(BaseModel): - """Response containing updated lock information after prolonging a request lock.""" - +class ScheduleCreateActionRunActorTask(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - data: RequestLockInfo + type: Literal['RUN_ACTOR_TASK'] + actor_task_id: Annotated[str, Field(alias='actorTaskId', examples=['jF8GGEvbEg4Au3NLA'])] + input: dict[str, Any] | None = None @docs_group('Models') -class WebhookCreate(BaseModel): +class ScheduleInvoked(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - is_ad_hoc: Annotated[bool | None, Field(alias='isAdHoc', examples=[False])] = None - event_types: Annotated[list[WebhookEventType], Field(alias='eventTypes', examples=[['ACTOR.RUN.SUCCEEDED']])] - condition: WebhookCondition - idempotency_key: Annotated[str | None, Field(alias='idempotencyKey', examples=['fdSJmdP3nfs7sfk3y'])] = None - ignore_ssl_errors: Annotated[bool | None, Field(alias='ignoreSslErrors', examples=[False])] = None - do_not_retry: Annotated[bool | None, Field(alias='doNotRetry', examples=[False])] = None - request_url: Annotated[str, Field(alias='requestUrl', examples=['http://example.com/'])] - payload_template: Annotated[ - str | None, Field(alias='payloadTemplate', examples=['{\\n "userId": {{userId}}...']) - ] = None - headers_template: Annotated[ - str | None, Field(alias='headersTemplate', examples=['{\\n "Authorization": "Bearer ..."}']) - ] = None - description: Annotated[str | None, Field(examples=['this is webhook description'])] = None - should_interpolate_strings: Annotated[bool | None, Field(alias='shouldInterpolateStrings', examples=[False])] = None + message: Annotated[str, Field(examples=['Schedule invoked'])] + level: Annotated[str, Field(examples=['INFO'])] + created_at: Annotated[AwareDatetime, Field(alias='createdAt', examples=['2019-03-26T12:28:00.370Z'])] @docs_group('Models') -class WebhookResponse(BaseModel): - """Response containing webhook data.""" - +class ScheduleLogResponse(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - data: Webhook + data: list[ScheduleInvoked] @docs_group('Models') -class WebhookUpdate(BaseModel): +class ScheduleResponse(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - is_ad_hoc: Annotated[bool | None, Field(alias='isAdHoc', examples=[False])] = None - event_types: Annotated[ - list[WebhookEventType] | None, Field(alias='eventTypes', examples=[['ACTOR.RUN.SUCCEEDED']]) - ] = None - condition: WebhookCondition | None = None - ignore_ssl_errors: Annotated[bool | None, Field(alias='ignoreSslErrors', examples=[False])] = None - do_not_retry: Annotated[bool | None, Field(alias='doNotRetry', examples=[False])] = None - request_url: Annotated[AnyUrl | None, Field(alias='requestUrl', examples=['http://example.com/'])] = None - payload_template: Annotated[ - str | None, Field(alias='payloadTemplate', examples=['{\\n "userId": {{userId}}...']) - ] = None - headers_template: Annotated[ - str | None, Field(alias='headersTemplate', examples=['{\\n "Authorization": "Bearer ..."}']) - ] = None - description: Annotated[str | None, Field(examples=['this is webhook description'])] = None - should_interpolate_strings: Annotated[bool | None, Field(alias='shouldInterpolateStrings', examples=[False])] = None + data: Schedule @docs_group('Models') -class EventData(BaseModel): +class ScheduleShort(ScheduleBase): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - actor_id: Annotated[str, Field(alias='actorId', examples=['vvE7iMKuMc5qTHHsR'])] - actor_run_id: Annotated[str, Field(alias='actorRunId', examples=['JgwXN9BdwxGcu9MMF'])] + actions: list[Annotated[ScheduleActionShortRunActor | ScheduleActionShortRunActorTask, Field(discriminator='type')]] @docs_group('Models') -class Call(BaseModel): +class SchemaValidationErrorData(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - started_at: Annotated[AwareDatetime | None, Field(alias='startedAt', examples=['2019-12-12T07:34:14.202Z'])] = None - finished_at: Annotated[AwareDatetime | None, Field(alias='finishedAt', examples=['2019-12-12T07:34:14.202Z'])] = ( - None - ) - error_message: Annotated[str | None, Field(alias='errorMessage', examples=['Cannot send request'])] = None - response_status: Annotated[int | None, Field(alias='responseStatus', examples=[200])] = None - response_body: Annotated[str | None, Field(alias='responseBody', examples=['{"foo": "bar"}'])] = None + invalid_items: Annotated[list[InvalidItem], Field(alias='invalidItems')] + """ + A list of invalid items in the received array of items. + """ @docs_group('Models') -class WebhookDispatch(BaseModel): +class SourceCodeFile(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - id: Annotated[str, Field(examples=['asdLZtadYvn4mBZmm'])] - user_id: Annotated[str, Field(alias='userId', examples=['wRsJZtadYvn4mBZmm'])] - webhook_id: Annotated[str, Field(alias='webhookId', examples=['asdLZtadYvn4mBZmm'])] - created_at: Annotated[AwareDatetime, Field(alias='createdAt', examples=['2019-12-12T07:34:14.202Z'])] - status: WebhookDispatchStatus - event_type: Annotated[WebhookEventType, Field(alias='eventType')] - event_data: Annotated[EventData | None, Field(alias='eventData', title='eventData')] = None - calls: Annotated[list[Call] | None, Field(title='calls')] = None + format: SourceCodeFileFormat | None = None + content: Annotated[str | None, Field(examples=["console.log('This is the main.js file');"])] = None + name: Annotated[str, Field(examples=['src/main.js'])] @docs_group('Models') -class TestWebhookResponse(BaseModel): +class SourceCodeFileFormat(StrEnum): + BASE64 = 'BASE64' + TEXT = 'TEXT' + + +@docs_group('Models') +class SourceCodeFolder(BaseModel): + """Represents a folder in the Actor's source code structure. Distinguished from + SourceCodeFile by the presence of the `folder` property set to `true`. + + """ + model_config = ConfigDict( extra='allow', populate_by_name=True, ) - data: WebhookDispatch + name: Annotated[str, Field(examples=['src/utils'])] + """ + The folder path relative to the Actor's root directory. + """ + folder: Annotated[bool, Field(examples=[True])] + """ + Always `true` for folders. Used to distinguish folders from files. + """ @docs_group('Models') -class ListOfWebhookDispatches(PaginationResponse): +class StorageIds(BaseModel): + """A map of aliased storage IDs associated with this run, grouped by storage type.""" + model_config = ConfigDict( extra='allow', populate_by_name=True, ) - items: list[WebhookDispatch] + datasets: Datasets | None = None + """ + Aliased dataset IDs for this run. + """ + key_value_stores: Annotated[KeyValueStores | None, Field(alias='keyValueStores')] = None + """ + Aliased key-value store IDs for this run. + """ + request_queues: Annotated[RequestQueues | None, Field(alias='requestQueues')] = None + """ + Aliased request queue IDs for this run. + """ @docs_group('Models') -class WebhookDispatchList(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - data: ListOfWebhookDispatches | None = None +class StorageOwnership(StrEnum): + OWNED_BY_ME = 'ownedByMe' + SHARED_WITH_ME = 'sharedWithMe' @docs_group('Models') -class WebhookDispatchResponse(BaseModel): +class Storages(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - data: WebhookDispatch + dataset: dict[str, Any] | None = None + """ + Defines the schema of items in your dataset, the full specification can be found in [Apify docs](https://docs.apify.com/platform/actors/development/actor-definition/dataset-schema) + """ @docs_group('Models') -class ScheduleBase(BaseModel): +class StoreListActor(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - id: Annotated[str, Field(examples=['asdLZtadYvn4mBZmm'])] - user_id: Annotated[str, Field(alias='userId', examples=['wRsJZtadYvn4mBZmm'])] - name: Annotated[str, Field(examples=['my-schedule'])] - cron_expression: Annotated[str, Field(alias='cronExpression', examples=['* * * * *'])] - timezone: Annotated[str, Field(examples=['UTC'])] - is_enabled: Annotated[bool, Field(alias='isEnabled', examples=[True])] - is_exclusive: Annotated[bool, Field(alias='isExclusive', examples=[True])] - created_at: Annotated[AwareDatetime, Field(alias='createdAt', examples=['2019-12-12T07:34:14.202Z'])] - modified_at: Annotated[AwareDatetime, Field(alias='modifiedAt', examples=['2019-12-20T06:33:11.202Z'])] - next_run_at: Annotated[AwareDatetime | None, Field(alias='nextRunAt', examples=['2019-04-12T07:34:10.202Z'])] = None - last_run_at: Annotated[AwareDatetime | None, Field(alias='lastRunAt', examples=['2019-04-12T07:33:10.202Z'])] = None + id: Annotated[str, Field(examples=['zdc3Pyhyz3m8vjDeM'])] + title: Annotated[str, Field(examples=['My Public Actor'])] + name: Annotated[str, Field(examples=['my-public-actor'])] + username: Annotated[str, Field(examples=['jane35'])] + user_full_name: Annotated[str, Field(alias='userFullName', examples=['Jane H. Doe'])] + description: Annotated[str, Field(examples=['My public actor!'])] + categories: Annotated[list[str] | None, Field(examples=[['MARKETING', 'LEAD_GENERATION']])] = None + notice: str | None = None + picture_url: Annotated[AnyUrl | None, Field(alias='pictureUrl', examples=['https://...'])] = None + user_picture_url: Annotated[AnyUrl | None, Field(alias='userPictureUrl', examples=['https://...'])] = None + url: Annotated[AnyUrl | None, Field(examples=['https://...'])] = None + stats: ActorStats + current_pricing_info: Annotated[CurrentPricingInfo, Field(alias='currentPricingInfo')] + is_white_listed_for_agentic_payment: Annotated[bool | None, Field(alias='isWhiteListedForAgenticPayment')] = None + """ + Whether the Actor is whitelisted for agentic payment processing. + """ + readme_summary: Annotated[str | None, Field(alias='readmeSummary')] = None + """ + A brief, LLM-generated readme summary + """ @docs_group('Models') -class ScheduleActionShortRunActor(BaseModel): +class TaggedBuildInfo(BaseModel): + """Information about a tagged build.""" + model_config = ConfigDict( extra='allow', populate_by_name=True, ) - id: Annotated[str, Field(examples=['ZReCs7hkdieq8ZUki'])] - type: Literal['RUN_ACTOR'] - actor_id: Annotated[str, Field(alias='actorId', examples=['HKhKmiCMrDgu9eXeE'])] + build_id: Annotated[str | None, Field(alias='buildId', examples=['z2EryhbfhgSyqj6Hn'])] = None + """ + The ID of the build associated with this tag. + """ + build_number: Annotated[str | None, Field(alias='buildNumber', examples=['0.0.2'])] = None + """ + The build number/version string. + """ + finished_at: Annotated[AwareDatetime | None, Field(alias='finishedAt', examples=['2019-06-10T11:15:49.286Z'])] = ( + None + ) + """ + The timestamp when the build finished. + """ @docs_group('Models') -class ScheduleActionShortRunActorTask(BaseModel): +class Task(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - id: Annotated[str, Field(examples=['ZReCs7hkdieq8ZUki'])] - type: Literal['RUN_ACTOR_TASK'] - actor_task_id: Annotated[str, Field(alias='actorTaskId', examples=['HKhKmiCMrDgu9eXeE'])] + id: Annotated[str, Field(examples=['zdc3Pyhyz3m8vjDeM'])] + user_id: Annotated[str, Field(alias='userId', examples=['wRsJZtadYvn4mBZmm'])] + act_id: Annotated[str, Field(alias='actId', examples=['asADASadYvn4mBZmm'])] + name: Annotated[str, Field(examples=['my-task'])] + username: Annotated[str | None, Field(examples=['janedoe'])] = None + created_at: Annotated[AwareDatetime, Field(alias='createdAt', examples=['2018-10-26T07:23:14.855Z'])] + modified_at: Annotated[AwareDatetime, Field(alias='modifiedAt', examples=['2018-10-26T13:30:49.578Z'])] + removed_at: Annotated[AwareDatetime | None, Field(alias='removedAt')] = None + stats: TaskStats | None = None + options: TaskOptions | None = None + input: TaskInput | None = None + title: str | None = None + actor_standby: Annotated[ActorStandby | None, Field(alias='actorStandby')] = None + standby_url: Annotated[AnyUrl | None, Field(alias='standbyUrl')] = None @docs_group('Models') -class ScheduleShort(ScheduleBase): +class TaskInput(BaseModel): + """The input configuration for the Actor task. This is a user-defined JSON object + that will be passed to the Actor when the task is run. + + """ + model_config = ConfigDict( extra='allow', populate_by_name=True, ) - actions: list[Annotated[ScheduleActionShortRunActor | ScheduleActionShortRunActorTask, Field(discriminator='type')]] @docs_group('Models') -class ListOfSchedules(PaginationResponse): +class TaskOptions(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - items: list[ScheduleShort] + build: Annotated[str | None, Field(examples=['latest'])] = None + timeout_secs: Annotated[int | None, Field(alias='timeoutSecs', examples=[300])] = None + memory_mbytes: Annotated[int | None, Field(alias='memoryMbytes', examples=[1024])] = None + max_items: Annotated[int | None, Field(alias='maxItems', examples=[1000])] = None + max_total_charge_usd: Annotated[float | None, Field(alias='maxTotalChargeUsd', examples=[5])] = None + restart_on_error: Annotated[bool | None, Field(alias='restartOnError', examples=[False])] = None @docs_group('Models') -class ListOfSchedulesResponse(BaseModel): +class TaskResponse(BaseModel): + """Response containing Actor task data.""" + model_config = ConfigDict( extra='allow', populate_by_name=True, ) - data: ListOfSchedules + data: Task @docs_group('Models') -class ScheduleActionRunInput(BaseModel): +class TaskShort(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - body: Annotated[str | None, Field(examples=['{\\n "foo": "actor"\\n}'])] = None - content_type: Annotated[str | None, Field(alias='contentType', examples=['application/json; charset=utf-8'])] = None + id: Annotated[str, Field(examples=['zdc3Pyhyz3m8vjDeM'])] + user_id: Annotated[str, Field(alias='userId', examples=['wRsJZtadYvn4mBZmm'])] + act_id: Annotated[str, Field(alias='actId', examples=['asADASadYvn4mBZmm'])] + act_name: Annotated[str | None, Field(alias='actName', examples=['my-actor'])] = None + name: Annotated[str, Field(examples=['my-task'])] + username: Annotated[str | None, Field(examples=['janedoe'])] = None + act_username: Annotated[str | None, Field(alias='actUsername', examples=['janedoe'])] = None + created_at: Annotated[AwareDatetime, Field(alias='createdAt', examples=['2018-10-26T07:23:14.855Z'])] + modified_at: Annotated[AwareDatetime, Field(alias='modifiedAt', examples=['2018-10-26T13:30:49.578Z'])] + stats: TaskStats | None = None @docs_group('Models') -class ScheduleCreateActionRunActor(BaseModel): +class TaskStats(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - type: Literal['RUN_ACTOR'] - actor_id: Annotated[str, Field(alias='actorId', examples=['jF8GGEvbEg4Au3NLA'])] - run_input: Annotated[ScheduleActionRunInput | None, Field(alias='runInput')] = None - run_options: Annotated[TaskOptions | None, Field(alias='runOptions')] = None + total_runs: Annotated[int | None, Field(alias='totalRuns', examples=[15])] = None @docs_group('Models') -class ScheduleCreateActionRunActorTask(BaseModel): +class TestWebhookResponse(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - type: Literal['RUN_ACTOR_TASK'] - actor_task_id: Annotated[str, Field(alias='actorTaskId', examples=['jF8GGEvbEg4Au3NLA'])] - input: dict[str, Any] | None = None + data: WebhookDispatch @docs_group('Models') -class ScheduleCreate(BaseModel): +class UnknownBuildTagError(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - name: Annotated[str | None, Field(examples=['my-schedule'])] = None - is_enabled: Annotated[bool | None, Field(alias='isEnabled', examples=[True])] = None - is_exclusive: Annotated[bool | None, Field(alias='isExclusive', examples=[True])] = None - cron_expression: Annotated[str | None, Field(alias='cronExpression', examples=['* * * * *'])] = None - timezone: Annotated[str | None, Field(examples=['UTC'])] = None - description: Annotated[str | None, Field(examples=['Schedule of actor ...'])] = None - title: str | None = None - actions: ( - list[Annotated[ScheduleCreateActionRunActor | ScheduleCreateActionRunActorTask, Field(discriminator='type')]] - | None - ) = None + error: UnknownBuildTagErrorDetail | None = None @docs_group('Models') -class ScheduleActionRunActor(BaseModel): +class UnknownBuildTagErrorDetail(ErrorDetail): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - id: Annotated[str, Field(examples=['c6KfSgoQzFhMk3etc'])] - type: Literal['RUN_ACTOR'] - actor_id: Annotated[str, Field(alias='actorId', examples=['jF8GGEvbEg4Au3NLA'])] - run_input: Annotated[ScheduleActionRunInput | None, Field(alias='runInput')] = None - run_options: Annotated[TaskOptions | None, Field(alias='runOptions')] = None + type: Annotated[Literal['unknown-build-tag'], Field(title='ErrorType')] = 'unknown-build-tag' + """ + Machine-processable error type identifier. + """ @docs_group('Models') -class ScheduleActionRunActorTask(BaseModel): +class UnlockRequestsResponse(BaseModel): + """Response containing the result of unlocking requests.""" + model_config = ConfigDict( extra='allow', populate_by_name=True, ) - id: Annotated[str, Field(examples=['c6KfSgoQzFhMk3etc'])] - type: Literal['RUN_ACTOR_TASK'] - actor_task_id: Annotated[str, Field(alias='actorTaskId', examples=['jF8GGEvbEg4Au3NLA'])] - input: dict[str, Any] | None = None + data: UnlockRequestsResult @docs_group('Models') -class Schedule(ScheduleBase): +class UnlockRequestsResult(BaseModel): + """Result of unlocking requests in the request queue.""" + model_config = ConfigDict( extra='allow', populate_by_name=True, ) - description: Annotated[str | None, Field(examples=['Schedule of actor ...'])] = None - title: str | None = None - actions: list[Annotated[ScheduleActionRunActor | ScheduleActionRunActorTask, Field(discriminator='type')]] + unlocked_count: Annotated[int, Field(alias='unlockedCount', examples=[10])] + """ + Number of requests that were successfully unlocked. + """ @docs_group('Models') -class ScheduleResponse(BaseModel): +class UpdateActorRequest(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - data: Schedule + name: Annotated[str | None, Field(examples=['MyActor'])] = None + description: Annotated[str | None, Field(examples=['My favourite actor!'])] = None + is_public: Annotated[bool | None, Field(alias='isPublic', examples=[False])] = None + actor_permission_level: Annotated[ActorPermissionLevel | None, Field(alias='actorPermissionLevel')] = None + seo_title: Annotated[str | None, Field(alias='seoTitle', examples=['My actor'])] = None + seo_description: Annotated[str | None, Field(alias='seoDescription', examples=['My actor is the best'])] = None + title: Annotated[str | None, Field(examples=['My Actor'])] = None + restart_on_error: Annotated[bool | None, Field(alias='restartOnError', deprecated=True, examples=[False])] = None + versions: list[CreateOrUpdateVersionRequest] | None = None + pricing_infos: Annotated[ + list[ + Annotated[ + PayPerEventActorPricingInfo + | PricePerDatasetItemActorPricingInfo + | FlatPricePerMonthActorPricingInfo + | FreeActorPricingInfo, + Field(discriminator='pricing_model'), + ] + ] + | None, + Field(alias='pricingInfos'), + ] = None + categories: list[str] | None = None + default_run_options: Annotated[DefaultRunOptions | None, Field(alias='defaultRunOptions')] = None + tagged_builds: Annotated[ + dict[str, Any] | None, + Field(alias='taggedBuilds', examples=[{'latest': {'buildId': 'z2EryhbfhgSyqj6Hn'}, 'beta': None}]), + ] = None + """ + An object to modify tags on the Actor's builds. The key is the tag name (e.g., _latest_), and the value is either an object with a `buildId` or `null`. + + This operation is a patch; any existing tags that you omit from this object will be preserved. + + - **To create or reassign a tag**, provide the tag name with a `buildId`. e.g., to assign the _latest_ tag: + +   + + ```json + { + "latest": { + "buildId": "z2EryhbfhgSyqj6Hn" + } + } + ``` + + - **To remove a tag**, provide the tag name with a `null` value. e.g., to remove the _beta_ tag: + +   + + ```json + { + "beta": null + } + ``` + - **To perform multiple operations**, combine them. The following reassigns _latest_ and removes _beta_, while preserving any other existing tags. -@docs_group('Models') -class ScheduleInvoked(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - message: Annotated[str, Field(examples=['Schedule invoked'])] - level: Annotated[str, Field(examples=['INFO'])] - created_at: Annotated[AwareDatetime, Field(alias='createdAt', examples=['2019-03-26T12:28:00.370Z'])] +   + ```json + { + "latest": { + "buildId": "z2EryhbfhgSyqj6Hn" + }, + "beta": null + } + ``` -@docs_group('Models') -class ScheduleLogResponse(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - data: list[ScheduleInvoked] + """ + actor_standby: Annotated[ActorStandby | None, Field(alias='actorStandby')] = None + example_run_input: Annotated[ExampleRunInput | None, Field(alias='exampleRunInput')] = None + is_deprecated: Annotated[bool | None, Field(alias='isDeprecated')] = None @docs_group('Models') -class CurrentPricingInfo(BaseModel): +class UpdateDatasetRequest(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - pricing_model: Annotated[str, Field(alias='pricingModel', examples=['FREE'])] + name: str | None = None + general_access: Annotated[GeneralAccess | None, Field(alias='generalAccess')] = None @docs_group('Models') -class StoreListActor(BaseModel): +class UpdateLimitsRequest(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - id: Annotated[str, Field(examples=['zdc3Pyhyz3m8vjDeM'])] - title: Annotated[str, Field(examples=['My Public Actor'])] - name: Annotated[str, Field(examples=['my-public-actor'])] - username: Annotated[str, Field(examples=['jane35'])] - user_full_name: Annotated[str, Field(alias='userFullName', examples=['Jane H. Doe'])] - description: Annotated[str, Field(examples=['My public actor!'])] - categories: Annotated[list[str] | None, Field(examples=[['MARKETING', 'LEAD_GENERATION']])] = None - notice: str | None = None - picture_url: Annotated[AnyUrl | None, Field(alias='pictureUrl', examples=['https://...'])] = None - user_picture_url: Annotated[AnyUrl | None, Field(alias='userPictureUrl', examples=['https://...'])] = None - url: Annotated[AnyUrl | None, Field(examples=['https://...'])] = None - stats: ActorStats - current_pricing_info: Annotated[CurrentPricingInfo, Field(alias='currentPricingInfo')] - is_white_listed_for_agentic_payment: Annotated[bool | None, Field(alias='isWhiteListedForAgenticPayment')] = None - """ - Whether the Actor is whitelisted for agentic payment processing. + max_monthly_usage_usd: Annotated[float | None, Field(alias='maxMonthlyUsageUsd', examples=[300])] = None """ - readme_summary: Annotated[str | None, Field(alias='readmeSummary')] = None + If your platform usage in the billing period exceeds the prepaid usage, you will be charged extra. Setting this property you can update your hard limit on monthly platform usage to prevent accidental overage or to limit the extra charges. + """ - A brief, LLM-generated readme summary + data_retention_days: Annotated[int | None, Field(alias='dataRetentionDays', examples=[90])] = None """ + Apify securely stores your ten most recent Actor runs indefinitely, ensuring they are always accessible. Unnamed storages and other Actor runs are automatically deleted after the retention period. If you're subscribed, you can change it to keep data for longer or to limit your usage. [Lear more](https://docs.apify.com/platform/storage/usage#data-retention). - -@docs_group('Models') -class ListOfStoreActors(PaginationResponse): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - items: list[StoreListActor] + """ @docs_group('Models') -class ListOfActorsInStoreResponse(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - data: ListOfStoreActors - +class UpdateRequestQueueRequest(BaseModel): + """Request object for updating a request queue.""" -@docs_group('Models') -class Profile(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - bio: Annotated[str | None, Field(examples=['I started web scraping in 1985 using Altair BASIC.'])] = None - name: Annotated[str | None, Field(examples=['Jane Doe'])] = None - picture_url: Annotated[ - AnyUrl | None, Field(alias='pictureUrl', examples=['https://apify.com/img/anonymous_user_picture.png']) - ] = None - github_username: Annotated[str | None, Field(alias='githubUsername', examples=['torvalds.'])] = None - website_url: Annotated[AnyUrl | None, Field(alias='websiteUrl', examples=['http://www.example.com'])] = None - twitter_username: Annotated[str | None, Field(alias='twitterUsername', examples=['@BillGates'])] = None + name: str | None = None + """ + The new name for the request queue. + """ + general_access: Annotated[GeneralAccess | None, Field(alias='generalAccess')] = None @docs_group('Models') -class UserPublicInfo(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - username: Annotated[str, Field(examples=['d7b9MDYsbtX5L7XAj'])] - profile: Profile | None = None - +class UpdateRequestResponse(BaseModel): + """Response containing the result of updating a request in the request queue.""" -@docs_group('Models') -class PublicUserDataResponse(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - data: UserPublicInfo + data: RequestRegistration @docs_group('Models') -class ProxyGroup(BaseModel): +class UpdateRunRequest(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - name: Annotated[str, Field(examples=['Group1'])] - description: Annotated[str, Field(examples=['Group1 description'])] - available_count: Annotated[int, Field(alias='availableCount', examples=[10])] + run_id: Annotated[str | None, Field(alias='runId', examples=['3KH8gEpp4d8uQSe8T'])] = None + status_message: Annotated[str | None, Field(alias='statusMessage', examples=['Actor has finished'])] = None + is_status_message_terminal: Annotated[bool | None, Field(alias='isStatusMessageTerminal', examples=[True])] = None + general_access: Annotated[GeneralAccess | None, Field(alias='generalAccess')] = None @docs_group('Models') -class Proxy(BaseModel): +class UpdateStoreRequest(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - password: Annotated[str, Field(examples=['ad78knd9Jkjd86'])] - groups: list[ProxyGroup] + name: str | None = None + general_access: Annotated[GeneralAccess | None, Field(alias='generalAccess')] = None @docs_group('Models') -class Plan(BaseModel): +class UpdateTaskRequest(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - id: Annotated[str, Field(examples=['Personal'])] - description: Annotated[str, Field(examples=['Cost-effective plan for freelancers, developers and students.'])] - is_enabled: Annotated[bool, Field(alias='isEnabled', examples=[True])] - monthly_base_price_usd: Annotated[float, Field(alias='monthlyBasePriceUsd', examples=[49])] - monthly_usage_credits_usd: Annotated[float, Field(alias='monthlyUsageCreditsUsd', examples=[49])] - usage_discount_percent: Annotated[float | None, Field(alias='usageDiscountPercent', examples=[0])] = None - enabled_platform_features: Annotated[ - list[str], - Field( - alias='enabledPlatformFeatures', examples=[['ACTORS', 'STORAGE', 'PROXY_SERPS', 'SCHEDULER', 'WEBHOOKS']] - ), - ] - max_monthly_usage_usd: Annotated[float, Field(alias='maxMonthlyUsageUsd', examples=[9999])] - max_actor_memory_gbytes: Annotated[float, Field(alias='maxActorMemoryGbytes', examples=[32])] - max_monthly_actor_compute_units: Annotated[float, Field(alias='maxMonthlyActorComputeUnits', examples=[1000])] - max_monthly_residential_proxy_gbytes: Annotated[ - float, Field(alias='maxMonthlyResidentialProxyGbytes', examples=[10]) - ] - max_monthly_proxy_serps: Annotated[int, Field(alias='maxMonthlyProxySerps', examples=[30000])] - max_monthly_external_data_transfer_gbytes: Annotated[ - float, Field(alias='maxMonthlyExternalDataTransferGbytes', examples=[1000]) - ] - max_actor_count: Annotated[int, Field(alias='maxActorCount', examples=[100])] - max_actor_task_count: Annotated[int, Field(alias='maxActorTaskCount', examples=[1000])] - data_retention_days: Annotated[int, Field(alias='dataRetentionDays', examples=[14])] - available_proxy_groups: Annotated[dict[str, int], Field(alias='availableProxyGroups')] - """ - The number of available proxies in this group. - """ - team_account_seat_count: Annotated[int, Field(alias='teamAccountSeatCount', examples=[1])] - support_level: Annotated[str, Field(alias='supportLevel', examples=['COMMUNITY'])] - available_add_ons: Annotated[list[str], Field(alias='availableAddOns', examples=[[]])] + name: Annotated[str | None, Field(examples=['my-task'])] = None + options: TaskOptions | None = None + input: TaskInput | None = None + title: str | None = None + actor_standby: Annotated[ActorStandby | None, Field(alias='actorStandby')] = None @docs_group('Models') -class EffectivePlatformFeature(BaseModel): +class UsageCycle(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - is_enabled: Annotated[bool, Field(alias='isEnabled', examples=[True])] - disabled_reason: Annotated[ - str | None, - Field( - alias='disabledReason', - examples=[ - 'The "Selected public Actors for developers" feature is not enabled for your account. Please upgrade your plan or contact support@apify.com' - ], - ), - ] - disabled_reason_type: Annotated[str | None, Field(alias='disabledReasonType', examples=['DISABLED'])] - is_trial: Annotated[bool, Field(alias='isTrial', examples=[False])] - trial_expiration_at: Annotated[ - AwareDatetime | None, Field(alias='trialExpirationAt', examples=['2025-01-01T14:00:00.000Z']) - ] + start_at: Annotated[AwareDatetime, Field(alias='startAt', examples=['2022-10-02T00:00:00.000Z'])] + end_at: Annotated[AwareDatetime, Field(alias='endAt', examples=['2022-11-01T23:59:59.999Z'])] @docs_group('Models') -class EffectivePlatformFeatures(BaseModel): +class UsageItem(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - actors: Annotated[EffectivePlatformFeature, Field(alias='ACTORS')] - storage: Annotated[EffectivePlatformFeature, Field(alias='STORAGE')] - scheduler: Annotated[EffectivePlatformFeature, Field(alias='SCHEDULER')] - proxy: Annotated[EffectivePlatformFeature, Field(alias='PROXY')] - proxy_external_access: Annotated[EffectivePlatformFeature, Field(alias='PROXY_EXTERNAL_ACCESS')] - proxy_residential: Annotated[EffectivePlatformFeature, Field(alias='PROXY_RESIDENTIAL')] - proxy_serps: Annotated[EffectivePlatformFeature, Field(alias='PROXY_SERPS')] - webhooks: Annotated[EffectivePlatformFeature, Field(alias='WEBHOOKS')] - actors_public_all: Annotated[EffectivePlatformFeature, Field(alias='ACTORS_PUBLIC_ALL')] - actors_public_developer: Annotated[EffectivePlatformFeature, Field(alias='ACTORS_PUBLIC_DEVELOPER')] + quantity: Annotated[float, Field(examples=[2.784475])] + base_amount_usd: Annotated[float, Field(alias='baseAmountUsd', examples=[0.69611875])] + base_unit_price_usd: Annotated[float | None, Field(alias='baseUnitPriceUsd', examples=[0.25])] = None + amount_after_volume_discount_usd: Annotated[ + float | None, Field(alias='amountAfterVolumeDiscountUsd', examples=[0.69611875]) + ] = None + price_tiers: Annotated[list[PriceTiers] | None, Field(alias='priceTiers')] = None @docs_group('Models') @@ -3760,250 +3739,271 @@ class UserPrivateInfo(BaseModel): @docs_group('Models') -class PrivateUserDataResponse(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - data: UserPrivateInfo - - -@docs_group('Models') -class UsageCycle(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - start_at: Annotated[AwareDatetime, Field(alias='startAt', examples=['2022-10-02T00:00:00.000Z'])] - end_at: Annotated[AwareDatetime, Field(alias='endAt', examples=['2022-11-01T23:59:59.999Z'])] - - -@docs_group('Models') -class PriceTiers(BaseModel): +class UserPublicInfo(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - quantity_above: Annotated[float, Field(alias='quantityAbove', examples=[0])] - discount_percent: Annotated[float, Field(alias='discountPercent', examples=[100])] - tier_quantity: Annotated[float, Field(alias='tierQuantity', examples=[0.39])] - unit_price_usd: Annotated[float, Field(alias='unitPriceUsd', examples=[0])] - price_usd: Annotated[float, Field(alias='priceUsd', examples=[0])] + username: Annotated[str, Field(examples=['d7b9MDYsbtX5L7XAj'])] + profile: Profile | None = None @docs_group('Models') -class UsageItem(BaseModel): +class ValidationError(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - quantity: Annotated[float, Field(examples=[2.784475])] - base_amount_usd: Annotated[float, Field(alias='baseAmountUsd', examples=[0.69611875])] - base_unit_price_usd: Annotated[float | None, Field(alias='baseUnitPriceUsd', examples=[0.25])] = None - amount_after_volume_discount_usd: Annotated[ - float | None, Field(alias='amountAfterVolumeDiscountUsd', examples=[0.69611875]) - ] = None - price_tiers: Annotated[list[PriceTiers] | None, Field(alias='priceTiers')] = None + instance_path: Annotated[str | None, Field(alias='instancePath')] = None + """ + The path to the instance being validated. + """ + schema_path: Annotated[str | None, Field(alias='schemaPath')] = None + """ + The path to the schema that failed the validation. + """ + keyword: str | None = None + """ + The validation keyword that caused the error. + """ + message: str | None = None + """ + A message describing the validation error. + """ + params: dict[str, Any] | None = None + """ + Additional parameters specific to the validation error. + """ @docs_group('Models') -class DailyServiceUsages(BaseModel): +class Version(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - date: Annotated[str, Field(examples=['2022-10-02T00:00:00.000Z'])] - service_usage: Annotated[dict[str, UsageItem], Field(alias='serviceUsage')] - total_usage_credits_usd: Annotated[float, Field(alias='totalUsageCreditsUsd', examples=[0.0474385791970591])] + version_number: Annotated[str, Field(alias='versionNumber', examples=['0.0'])] + source_type: Annotated[VersionSourceType | None, Field(alias='sourceType')] + env_vars: Annotated[list[EnvVar] | None, Field(alias='envVars')] = None + apply_env_vars_to_build: Annotated[bool | None, Field(alias='applyEnvVarsToBuild', examples=[False])] = None + build_tag: Annotated[str | None, Field(alias='buildTag', examples=['latest'])] = None + source_files: Annotated[ + list[SourceCodeFile | SourceCodeFolder] | None, Field(alias='sourceFiles', title='VersionSourceFiles') + ] = None + git_repo_url: Annotated[str | None, Field(alias='gitRepoUrl')] = None + """ + URL of the Git repository when sourceType is GIT_REPO. + """ + tarball_url: Annotated[str | None, Field(alias='tarballUrl')] = None + """ + URL of the tarball when sourceType is TARBALL. + """ + github_gist_url: Annotated[str | None, Field(alias='gitHubGistUrl')] = None + """ + URL of the GitHub Gist when sourceType is GITHUB_GIST. + """ @docs_group('Models') -class MonthlyUsage(BaseModel): +class VersionResponse(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - usage_cycle: Annotated[UsageCycle, Field(alias='usageCycle')] - monthly_service_usage: Annotated[dict[str, UsageItem], Field(alias='monthlyServiceUsage')] - daily_service_usages: Annotated[list[DailyServiceUsages], Field(alias='dailyServiceUsages')] - total_usage_credits_usd_before_volume_discount: Annotated[ - float, Field(alias='totalUsageCreditsUsdBeforeVolumeDiscount', examples=[0.786143673840067]) - ] - total_usage_credits_usd_after_volume_discount: Annotated[ - float, Field(alias='totalUsageCreditsUsdAfterVolumeDiscount', examples=[0.786143673840067]) - ] + data: Version @docs_group('Models') -class MonthlyUsageResponse(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - data: MonthlyUsage +class VersionSourceType(StrEnum): + SOURCE_FILES = 'SOURCE_FILES' + GIT_REPO = 'GIT_REPO' + TARBALL = 'TARBALL' + GITHUB_GIST = 'GITHUB_GIST' @docs_group('Models') -class Limits(BaseModel): +class Webhook(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - max_monthly_usage_usd: Annotated[float, Field(alias='maxMonthlyUsageUsd', examples=[300])] - max_monthly_actor_compute_units: Annotated[float, Field(alias='maxMonthlyActorComputeUnits', examples=[1000])] - max_monthly_external_data_transfer_gbytes: Annotated[ - float, Field(alias='maxMonthlyExternalDataTransferGbytes', examples=[7]) - ] - max_monthly_proxy_serps: Annotated[int, Field(alias='maxMonthlyProxySerps', examples=[50])] - max_monthly_residential_proxy_gbytes: Annotated[ - float, Field(alias='maxMonthlyResidentialProxyGbytes', examples=[0.5]) - ] - max_actor_memory_gbytes: Annotated[float, Field(alias='maxActorMemoryGbytes', examples=[16])] - max_actor_count: Annotated[int, Field(alias='maxActorCount', examples=[100])] - max_actor_task_count: Annotated[int, Field(alias='maxActorTaskCount', examples=[1000])] - max_concurrent_actor_jobs: Annotated[int, Field(alias='maxConcurrentActorJobs', examples=[256])] - max_team_account_seat_count: Annotated[int, Field(alias='maxTeamAccountSeatCount', examples=[9])] - data_retention_days: Annotated[int, Field(alias='dataRetentionDays', examples=[90])] + id: Annotated[str, Field(examples=['YiKoxjkaS9gjGTqhF'])] + created_at: Annotated[AwareDatetime, Field(alias='createdAt', examples=['2019-12-12T07:34:14.202Z'])] + modified_at: Annotated[AwareDatetime, Field(alias='modifiedAt', examples=['2019-12-13T08:36:13.202Z'])] + user_id: Annotated[str, Field(alias='userId', examples=['wRsJZtadYvn4mBZmm'])] + is_ad_hoc: Annotated[bool | None, Field(alias='isAdHoc', examples=[False])] = None + should_interpolate_strings: Annotated[bool | None, Field(alias='shouldInterpolateStrings', examples=[False])] = None + event_types: Annotated[list[WebhookEventType], Field(alias='eventTypes', examples=[['ACTOR.RUN.SUCCEEDED']])] + condition: WebhookCondition + ignore_ssl_errors: Annotated[bool, Field(alias='ignoreSslErrors', examples=[False])] + do_not_retry: Annotated[bool | None, Field(alias='doNotRetry', examples=[False])] = None + request_url: Annotated[AnyUrl, Field(alias='requestUrl', examples=['http://example.com/'])] + payload_template: Annotated[ + str | None, Field(alias='payloadTemplate', examples=['{\\n "userId": {{userId}}...']) + ] = None + headers_template: Annotated[ + str | None, Field(alias='headersTemplate', examples=['{\\n "Authorization": "Bearer ..."}']) + ] = None + description: Annotated[str | None, Field(examples=['this is webhook description'])] = None + last_dispatch: Annotated[ExampleWebhookDispatch | None, Field(alias='lastDispatch')] = None + stats: WebhookStats | None = None @docs_group('Models') -class Current(BaseModel): +class WebhookCondition(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - monthly_usage_usd: Annotated[float, Field(alias='monthlyUsageUsd', examples=[43])] - monthly_actor_compute_units: Annotated[float, Field(alias='monthlyActorComputeUnits', examples=[500.784475])] - monthly_external_data_transfer_gbytes: Annotated[ - float, Field(alias='monthlyExternalDataTransferGbytes', examples=[3.00861903931946]) - ] - monthly_proxy_serps: Annotated[int, Field(alias='monthlyProxySerps', examples=[34])] - monthly_residential_proxy_gbytes: Annotated[float, Field(alias='monthlyResidentialProxyGbytes', examples=[0.4])] - actor_memory_gbytes: Annotated[float, Field(alias='actorMemoryGbytes', examples=[8])] - actor_count: Annotated[int, Field(alias='actorCount', examples=[31])] - actor_task_count: Annotated[int, Field(alias='actorTaskCount', examples=[130])] - active_actor_job_count: Annotated[int, Field(alias='activeActorJobCount', examples=[0])] - team_account_seat_count: Annotated[int, Field(alias='teamAccountSeatCount', examples=[5])] + actor_id: Annotated[str | None, Field(alias='actorId', examples=['hksJZtadYvn4mBuin'])] = None + actor_task_id: Annotated[str | None, Field(alias='actorTaskId', examples=['asdLZtadYvn4mBZmm'])] = None + actor_run_id: Annotated[str | None, Field(alias='actorRunId', examples=['hgdKZtadYvn4mBpoi'])] = None @docs_group('Models') -class AccountLimits(BaseModel): +class WebhookCreate(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - monthly_usage_cycle: Annotated[UsageCycle, Field(alias='monthlyUsageCycle')] - limits: Limits - current: Current + is_ad_hoc: Annotated[bool | None, Field(alias='isAdHoc', examples=[False])] = None + event_types: Annotated[list[WebhookEventType], Field(alias='eventTypes', examples=[['ACTOR.RUN.SUCCEEDED']])] + condition: WebhookCondition + idempotency_key: Annotated[str | None, Field(alias='idempotencyKey', examples=['fdSJmdP3nfs7sfk3y'])] = None + ignore_ssl_errors: Annotated[bool | None, Field(alias='ignoreSslErrors', examples=[False])] = None + do_not_retry: Annotated[bool | None, Field(alias='doNotRetry', examples=[False])] = None + request_url: Annotated[str, Field(alias='requestUrl', examples=['http://example.com/'])] + payload_template: Annotated[ + str | None, Field(alias='payloadTemplate', examples=['{\\n "userId": {{userId}}...']) + ] = None + headers_template: Annotated[ + str | None, Field(alias='headersTemplate', examples=['{\\n "Authorization": "Bearer ..."}']) + ] = None + description: Annotated[str | None, Field(examples=['this is webhook description'])] = None + should_interpolate_strings: Annotated[bool | None, Field(alias='shouldInterpolateStrings', examples=[False])] = None @docs_group('Models') -class LimitsResponse(BaseModel): +class WebhookDispatch(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - data: AccountLimits + id: Annotated[str, Field(examples=['asdLZtadYvn4mBZmm'])] + user_id: Annotated[str, Field(alias='userId', examples=['wRsJZtadYvn4mBZmm'])] + webhook_id: Annotated[str, Field(alias='webhookId', examples=['asdLZtadYvn4mBZmm'])] + created_at: Annotated[AwareDatetime, Field(alias='createdAt', examples=['2019-12-12T07:34:14.202Z'])] + status: WebhookDispatchStatus + event_type: Annotated[WebhookEventType, Field(alias='eventType')] + event_data: Annotated[EventData | None, Field(alias='eventData', title='eventData')] = None + calls: Annotated[list[Call] | None, Field(title='calls')] = None @docs_group('Models') -class UpdateLimitsRequest(BaseModel): +class WebhookDispatchList(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - max_monthly_usage_usd: Annotated[float | None, Field(alias='maxMonthlyUsageUsd', examples=[300])] = None - """ - If your platform usage in the billing period exceeds the prepaid usage, you will be charged extra. Setting this property you can update your hard limit on monthly platform usage to prevent accidental overage or to limit the extra charges. - - """ - data_retention_days: Annotated[int | None, Field(alias='dataRetentionDays', examples=[90])] = None - """ - Apify securely stores your ten most recent Actor runs indefinitely, ensuring they are always accessible. Unnamed storages and other Actor runs are automatically deleted after the retention period. If you're subscribed, you can change it to keep data for longer or to limit your usage. [Lear more](https://docs.apify.com/platform/storage/usage#data-retention). - - """ + data: ListOfWebhookDispatches | None = None @docs_group('Models') -class BrowserInfoResponse(BaseModel): +class WebhookDispatchResponse(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - method: Annotated[str, Field(examples=['GET'])] - """ - HTTP method of the request. - """ - client_ip: Annotated[str | None, Field(alias='clientIp', examples=['1.2.3.4'])] - """ - IP address of the client. - """ - country_code: Annotated[str | None, Field(alias='countryCode', examples=['US'])] - """ - Two-letter country code resolved from the client IP address. - """ - body_length: Annotated[int, Field(alias='bodyLength', examples=[0])] - """ - Length of the request body in bytes. - """ - headers: dict[str, str | list[str]] | None = None - """ - Request headers. Omitted when `skipHeaders=true`. + data: WebhookDispatch - """ - raw_headers: Annotated[list[str] | None, Field(alias='rawHeaders')] = None - """ - Raw request headers as a flat list of alternating name/value strings. - Included only when `rawHeaders=true`. - """ +@docs_group('Models') +class WebhookDispatchStatus(StrEnum): + """Status of the webhook dispatch indicating whether the HTTP request was successful.""" + + ACTIVE = 'ACTIVE' + SUCCEEDED = 'SUCCEEDED' + FAILED = 'FAILED' @docs_group('Models') -class EncodeAndSignData(BaseModel): - model_config = ConfigDict( - extra='allow', - populate_by_name=True, - ) - encoded: Annotated[str, Field(examples=['eyJwYXlsb2FkIjoiLi4uIiwic2lnbmF0dXJlIjoiLi4uIn0='])] +class WebhookEventType(StrEnum): + """Type of event that triggers the webhook.""" + + ACTOR_BUILD_ABORTED = 'ACTOR.BUILD.ABORTED' + ACTOR_BUILD_CREATED = 'ACTOR.BUILD.CREATED' + ACTOR_BUILD_FAILED = 'ACTOR.BUILD.FAILED' + ACTOR_BUILD_SUCCEEDED = 'ACTOR.BUILD.SUCCEEDED' + ACTOR_BUILD_TIMED_OUT = 'ACTOR.BUILD.TIMED_OUT' + ACTOR_RUN_ABORTED = 'ACTOR.RUN.ABORTED' + ACTOR_RUN_CREATED = 'ACTOR.RUN.CREATED' + ACTOR_RUN_FAILED = 'ACTOR.RUN.FAILED' + ACTOR_RUN_RESURRECTED = 'ACTOR.RUN.RESURRECTED' + ACTOR_RUN_SUCCEEDED = 'ACTOR.RUN.SUCCEEDED' + ACTOR_RUN_TIMED_OUT = 'ACTOR.RUN.TIMED_OUT' + TEST = 'TEST' @docs_group('Models') -class EncodeAndSignResponse(BaseModel): +class WebhookResponse(BaseModel): + """Response containing webhook data.""" + model_config = ConfigDict( extra='allow', populate_by_name=True, ) - data: EncodeAndSignData + data: Webhook @docs_group('Models') -class DecodeAndVerifyRequest(BaseModel): +class WebhookShort(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - encoded: Annotated[str, Field(examples=['eyJwYXlsb2FkIjoiLi4uIiwic2lnbmF0dXJlIjoiLi4uIn0='])] + id: Annotated[str, Field(examples=['YiKoxjkaS9gjGTqhF'])] + created_at: Annotated[AwareDatetime, Field(alias='createdAt', examples=['2019-12-12T07:34:14.202Z'])] + modified_at: Annotated[AwareDatetime, Field(alias='modifiedAt', examples=['2019-12-13T08:36:13.202Z'])] + user_id: Annotated[str, Field(alias='userId', examples=['wRsJZtadYvn4mBZmm'])] + is_ad_hoc: Annotated[bool | None, Field(alias='isAdHoc', examples=[False])] = None + should_interpolate_strings: Annotated[bool | None, Field(alias='shouldInterpolateStrings', examples=[False])] = None + event_types: Annotated[list[WebhookEventType], Field(alias='eventTypes', examples=[['ACTOR.RUN.SUCCEEDED']])] + condition: WebhookCondition + ignore_ssl_errors: Annotated[bool, Field(alias='ignoreSslErrors', examples=[False])] + do_not_retry: Annotated[bool, Field(alias='doNotRetry', examples=[False])] + request_url: Annotated[AnyUrl, Field(alias='requestUrl', examples=['http://example.com/'])] + last_dispatch: Annotated[ExampleWebhookDispatch | None, Field(alias='lastDispatch')] = None + stats: WebhookStats | None = None @docs_group('Models') -class DecodeAndVerifyData(BaseModel): +class WebhookStats(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - decoded: Any - """ - The original object that was encoded. - """ - encoded_by_user_id: Annotated[str | None, Field(alias='encodedByUserId', examples=['wRwJZtadYvn4mBZmm'])] - is_verified_user: Annotated[bool, Field(alias='isVerifiedUser', examples=[False])] + total_dispatches: Annotated[int, Field(alias='totalDispatches', examples=[1])] @docs_group('Models') -class DecodeAndVerifyResponse(BaseModel): +class WebhookUpdate(BaseModel): model_config = ConfigDict( extra='allow', populate_by_name=True, ) - data: DecodeAndVerifyData + is_ad_hoc: Annotated[bool | None, Field(alias='isAdHoc', examples=[False])] = None + event_types: Annotated[ + list[WebhookEventType] | None, Field(alias='eventTypes', examples=[['ACTOR.RUN.SUCCEEDED']]) + ] = None + condition: WebhookCondition | None = None + ignore_ssl_errors: Annotated[bool | None, Field(alias='ignoreSslErrors', examples=[False])] = None + do_not_retry: Annotated[bool | None, Field(alias='doNotRetry', examples=[False])] = None + request_url: Annotated[AnyUrl | None, Field(alias='requestUrl', examples=['http://example.com/'])] = None + payload_template: Annotated[ + str | None, Field(alias='payloadTemplate', examples=['{\\n "userId": {{userId}}...']) + ] = None + headers_template: Annotated[ + str | None, Field(alias='headersTemplate', examples=['{\\n "Authorization": "Bearer ..."}']) + ] = None + description: Annotated[str | None, Field(examples=['this is webhook description'])] = None + should_interpolate_strings: Annotated[bool | None, Field(alias='shouldInterpolateStrings', examples=[False])] = None From dc3769d39cd9dc3229d307d85e6eea3382d57247 Mon Sep 17 00:00:00 2001 From: Vlada Dusek Date: Wed, 15 Apr 2026 09:38:52 +0200 Subject: [PATCH 2/4] polish --- scripts/postprocess_generated_models.py | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/scripts/postprocess_generated_models.py b/scripts/postprocess_generated_models.py index 86cd3b34..6336c0ee 100644 --- a/scripts/postprocess_generated_models.py +++ b/scripts/postprocess_generated_models.py @@ -10,9 +10,8 @@ class alongside the canonical `ErrorType(StrEnum)`. This script removes the dupl rewires references to use `ErrorType`. - Missing @docs_group decorator: Adds `@docs_group('Models')` to all model classes for API reference documentation grouping, along with the required import. -- Class sorting: Sorts class definitions alphabetically (with topological ordering to respect - inheritance dependencies), so that regeneration from a reordered OpenAPI spec produces - minimal diffs. +- Class sorting: Sorts class definitions alphabetically (with topological ordering to respect inheritance + dependencies), so that regeneration from a reordered OpenAPI spec produces minimal diffs. """ from __future__ import annotations @@ -62,8 +61,7 @@ def deduplicate_error_type_enum(content: str) -> str: def add_docs_group_decorators(content: str) -> str: """Add `@docs_group('Models')` decorator to all model classes and the required import. - This function is idempotent — it skips the import and decorators if they - already exist. + This function is idempotent — it skips the import and decorators if they already exist. """ # Add the import after the existing imports (only if not already present). if 'from apify_client._docs import docs_group' not in content: @@ -85,15 +83,12 @@ def add_docs_group_decorators(content: str) -> str: def sort_classes(content: str) -> str: """Sort class definitions alphabetically while respecting inheritance order. - Uses topological sorting so that base classes always appear before their - subclasses, with alphabetical ordering as the tie-breaker. This makes the - output deterministic regardless of the order in the OpenAPI spec, which - keeps diffs minimal across regenerations. + Uses topological sorting so that base classes always appear before their subclasses, with alphabetical ordering as + the tie-breaker. This makes the output deterministic regardless of the order in the OpenAPI spec, which keeps diffs + minimal across regenerations. - Only the class statement's base-class expression creates an ordering - constraint — field type annotations are lazy strings thanks to - ``from __future__ import annotations`` and don't require forward - declaration. + Only the class statement's base-class expression creates an ordering constraint — field type annotations are lazy + strings thanks to `from __future__ import annotations` and don't require forward declaration. """ lines = content.split('\n') @@ -111,7 +106,7 @@ def sort_classes(content: str) -> str: header = '\n'.join(header_lines) # Split the remainder into class blocks. - # Each block starts with ``@docs_group('Models')`` on its own line. + # Each block starts with `@docs_group('Models')` on its own line. rest = '\n'.join(lines[header_end:]) decorator_escaped = re.escape(DOCS_GROUP_DECORATOR) raw_blocks = re.split(rf'(?=^{decorator_escaped}$)', rest, flags=re.MULTILINE) @@ -127,6 +122,7 @@ def sort_classes(content: str) -> str: continue class_name = match.group(1) base_expr = match.group(2) + # Collect all capitalized identifiers from the base-class expression. referenced = set(re.findall(r'\b([A-Z]\w+)\b', base_expr)) class_blocks[class_name] = block From e8ff89f56d67096d93bc6374dbb5c6d25fcec929 Mon Sep 17 00:00:00 2001 From: Vlada Dusek Date: Wed, 15 Apr 2026 13:41:05 +0200 Subject: [PATCH 3/4] test: add unit tests for postprocess_generated_models script Co-Authored-By: Claude Opus 4.6 (1M context) --- pyproject.toml | 1 + .../unit/test_postprocess_generated_models.py | 538 ++++++++++++++++++ 2 files changed, 539 insertions(+) create mode 100644 tests/unit/test_postprocess_generated_models.py diff --git a/pyproject.toml b/pyproject.toml index abc89b14..e445331e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -176,6 +176,7 @@ max-branches = 18 addopts = "-r a --verbose" asyncio_default_fixture_loop_scope = "function" asyncio_mode = "auto" +pythonpath = ["."] timeout = 1800 [tool.ty.environment] diff --git a/tests/unit/test_postprocess_generated_models.py b/tests/unit/test_postprocess_generated_models.py new file mode 100644 index 00000000..fa475dd3 --- /dev/null +++ b/tests/unit/test_postprocess_generated_models.py @@ -0,0 +1,538 @@ +from __future__ import annotations + +import re +import textwrap + +from scripts.postprocess_generated_models import ( + add_docs_group_decorators, + deduplicate_error_type_enum, + fix_discriminators, + sort_classes, +) + +# -- Helpers ------------------------------------------------------------------ + + +def _make_file(header: str, classes: list[str]) -> str: + """Build a fake models file with header and decorated class blocks.""" + parts = [header.rstrip()] + parts.extend(f"@docs_group('Models')\n{cls}" for cls in classes) + return '\n\n\n'.join(parts) + '\n' + + +def _extract_class_names(content: str) -> list[str]: + """Extract class names in order of appearance.""" + return re.findall(r'^class\s+(\w+)\(', content, re.MULTILINE) + + +# -- fix_discriminators ------------------------------------------------------- + + +def test_fix_discriminators_replaces_camel_case() -> None: + content = "items: list[Pricing] = Field(discriminator='pricingModel')" + result = fix_discriminators(content) + assert result == "items: list[Pricing] = Field(discriminator='pricing_model')" + + +def test_fix_discriminators_replaces_multiple_occurrences() -> None: + content = "a: list[X] = Field(discriminator='pricingModel')\nb: list[Y] = Field(discriminator='pricingModel')\n" + result = fix_discriminators(content) + assert "discriminator='pricingModel'" not in result + assert result.count("discriminator='pricing_model'") == 2 + + +def test_fix_discriminators_leaves_already_snake_case() -> None: + content = "items: list[Pricing] = Field(discriminator='pricing_model')" + result = fix_discriminators(content) + assert result == content + + +def test_fix_discriminators_no_change_when_no_discriminators() -> None: + content = 'class Foo(BaseModel):\n name: str\n' + result = fix_discriminators(content) + assert result == content + + +def test_fix_discriminators_does_not_touch_unrelated() -> None: + content = "items: list[X] = Field(discriminator='event_type')" + result = fix_discriminators(content) + assert result == content + + +# -- deduplicate_error_type_enum ---------------------------------------------- + + +def test_deduplicate_error_type_enum_removes_duplicate() -> None: + content = textwrap.dedent("""\ + class ErrorType(StrEnum): + SOME_ERROR = 'some-error' + + class Type(StrEnum): + SOME_ERROR = 'some-error' + OTHER = 'other' + + class ErrorResponse(BaseModel): + error_type: Type + """) + result = deduplicate_error_type_enum(content) + assert 'class Type(StrEnum)' not in result + assert 'class ErrorType(StrEnum)' in result + + +def test_deduplicate_error_type_enum_rewires_colon_annotation() -> None: + content = textwrap.dedent("""\ + class ErrorType(StrEnum): + SOME_ERROR = 'some-error' + + class Type(StrEnum): + SOME_ERROR = 'some-error' + + class ErrorResponse(BaseModel): + error_type: Type + """) + result = deduplicate_error_type_enum(content) + assert 'error_type: ErrorType' in result + + +def test_deduplicate_error_type_enum_rewires_union_annotation() -> None: + content = textwrap.dedent("""\ + class ErrorType(StrEnum): + X = 'x' + + class Type(StrEnum): + X = 'x' + + class Foo(BaseModel): + field: str | Type + """) + result = deduplicate_error_type_enum(content) + assert '| ErrorType' in result + assert '| Type' not in result + + +def test_deduplicate_error_type_enum_rewires_bracket_annotation() -> None: + content = textwrap.dedent("""\ + class ErrorType(StrEnum): + X = 'x' + + class Type(StrEnum): + X = 'x' + + class Foo(BaseModel): + field: list[Type] + """) + result = deduplicate_error_type_enum(content) + assert 'list[ErrorType]' in result + assert 'list[Type]' not in result + + +def test_deduplicate_error_type_enum_collapses_extra_blank_lines() -> None: + content = "\nclass Type(StrEnum):\n X = 'x'\n\n\n\n\nclass Next(BaseModel):\n pass\n" + result = deduplicate_error_type_enum(content) + assert '\n\n\n\n' not in result + + +def test_deduplicate_error_type_enum_no_change_when_no_duplicate() -> None: + content = textwrap.dedent("""\ + class ErrorType(StrEnum): + SOME_ERROR = 'some-error' + + class Foo(BaseModel): + field: ErrorType + """) + result = deduplicate_error_type_enum(content) + assert result == content + + +def test_deduplicate_error_type_enum_does_not_touch_type_in_class_names() -> None: + """Ensure `Type` in class names like `ContentType` is not replaced.""" + content = textwrap.dedent("""\ + class ErrorType(StrEnum): + X = 'x' + + class Type(StrEnum): + X = 'x' + + class ContentType(BaseModel): + value: str + """) + result = deduplicate_error_type_enum(content) + assert 'class ContentType(BaseModel)' in result + + +# -- add_docs_group_decorators ------------------------------------------------ + + +def test_add_docs_group_decorators_adds_import_and_decorators() -> None: + content = textwrap.dedent("""\ + from pydantic import BaseModel + + class Foo(BaseModel): + name: str + + class Bar(BaseModel): + value: int + """) + result = add_docs_group_decorators(content) + assert 'from apify_client._docs import docs_group' in result + assert result.count("@docs_group('Models')") == 2 + + +def test_add_docs_group_decorators_places_import_after_pydantic() -> None: + content = textwrap.dedent("""\ + from pydantic import BaseModel + + class Foo(BaseModel): + pass + """) + result = add_docs_group_decorators(content) + lines = result.split('\n') + pydantic_idx = next(i for i, line in enumerate(lines) if 'from pydantic' in line) + docs_import_idx = next(i for i, line in enumerate(lines) if 'from apify_client._docs' in line) + assert docs_import_idx == pydantic_idx + 2 # blank line + import + + +def test_add_docs_group_decorators_idempotent_import() -> None: + content = textwrap.dedent("""\ + from pydantic import BaseModel + + from apify_client._docs import docs_group + + class Foo(BaseModel): + pass + """) + result = add_docs_group_decorators(content) + assert result.count('from apify_client._docs import docs_group') == 1 + + +def test_add_docs_group_decorators_idempotent_decorators() -> None: + content = textwrap.dedent("""\ + from pydantic import BaseModel + + from apify_client._docs import docs_group + + @docs_group('Models') + class Foo(BaseModel): + pass + + @docs_group('Models') + class Bar(BaseModel): + pass + """) + result = add_docs_group_decorators(content) + assert result.count("@docs_group('Models')") == 2 + + +def test_add_docs_group_decorators_placed_before_each_class() -> None: + content = textwrap.dedent("""\ + from pydantic import BaseModel + + class Alpha(BaseModel): + pass + + class Beta(BaseModel): + pass + """) + result = add_docs_group_decorators(content) + lines = result.split('\n') + for i, line in enumerate(lines): + if line.startswith('class '): + assert lines[i - 1] == "@docs_group('Models')" + + +def test_add_docs_group_decorators_no_classes() -> None: + content = 'from pydantic import BaseModel\n\nx = 1\n' + result = add_docs_group_decorators(content) + assert "@docs_group('Models')" not in result + + +# -- sort_classes ------------------------------------------------------------- + + +def test_sort_classes_alphabetically() -> None: + content = _make_file( + 'from pydantic import BaseModel\n', + [ + 'class Charlie(BaseModel):\n pass', + 'class Alpha(BaseModel):\n pass', + 'class Bravo(BaseModel):\n pass', + ], + ) + result = sort_classes(content) + names = _extract_class_names(result) + assert names == ['Alpha', 'Bravo', 'Charlie'] + + +def test_sort_classes_respects_inheritance_order() -> None: + """A child class must come after its parent, even if alphabetically first.""" + content = _make_file( + 'from pydantic import BaseModel\n', + [ + 'class Apple(Fruit):\n pass', + 'class Fruit(BaseModel):\n pass', + ], + ) + result = sort_classes(content) + names = _extract_class_names(result) + assert names.index('Fruit') < names.index('Apple') + + +def test_sort_classes_diamond_inheritance() -> None: + content = _make_file( + 'from pydantic import BaseModel\n', + [ + 'class Diamond(Left, Right):\n pass', + 'class Right(Base):\n pass', + 'class Left(Base):\n pass', + 'class Base(BaseModel):\n pass', + ], + ) + result = sort_classes(content) + names = _extract_class_names(result) + assert names.index('Base') < names.index('Left') + assert names.index('Base') < names.index('Right') + assert names.index('Left') < names.index('Diamond') + assert names.index('Right') < names.index('Diamond') + + +def test_sort_classes_alphabetical_tiebreaking() -> None: + content = _make_file( + 'from pydantic import BaseModel\n', + [ + 'class Zulu(BaseModel):\n pass', + 'class Mike(BaseModel):\n pass', + 'class Alpha(BaseModel):\n pass', + ], + ) + result = sort_classes(content) + names = _extract_class_names(result) + assert names == ['Alpha', 'Mike', 'Zulu'] + + +def test_sort_classes_already_sorted_is_stable() -> None: + content = _make_file( + 'from pydantic import BaseModel\n', + [ + 'class Alpha(BaseModel):\n pass', + 'class Bravo(BaseModel):\n pass', + 'class Charlie(BaseModel):\n pass', + ], + ) + result = sort_classes(content) + assert result == content + + +def test_sort_classes_preserves_header() -> None: + header = 'from __future__ import annotations\n\nfrom pydantic import BaseModel\n\nX = 1\n' + content = _make_file( + header, + [ + 'class Bravo(BaseModel):\n pass', + 'class Alpha(BaseModel):\n pass', + ], + ) + result = sort_classes(content) + assert result.startswith('from __future__ import annotations\n\nfrom pydantic import BaseModel\n\nX = 1') + + +def test_sort_classes_preserves_class_body() -> None: + body_a = 'class Alpha(BaseModel):\n name: str\n age: int = 0' + body_b = 'class Bravo(BaseModel):\n value: float' + content = _make_file('from pydantic import BaseModel\n', [body_b, body_a]) + result = sort_classes(content) + assert body_a in result + assert body_b in result + + +def test_sort_classes_chain_inheritance() -> None: + """Child -> Parent -> GrandParent must preserve order GrandParent, Parent, Child.""" + content = _make_file( + 'from pydantic import BaseModel\n', + [ + 'class Child(Parent):\n pass', + 'class Parent(GrandParent):\n pass', + 'class GrandParent(BaseModel):\n pass', + ], + ) + result = sort_classes(content) + names = _extract_class_names(result) + assert names == ['GrandParent', 'Parent', 'Child'] + + +def test_sort_classes_ignores_external_base_classes() -> None: + content = _make_file( + 'from pydantic import BaseModel\n', + [ + 'class Zeta(BaseModel):\n pass', + 'class Alpha(BaseModel):\n pass', + ], + ) + result = sort_classes(content) + names = _extract_class_names(result) + assert names == ['Alpha', 'Zeta'] + + +def test_sort_classes_self_reference_in_base_ignored() -> None: + """A class listing itself in the base expression should not deadlock.""" + content = _make_file( + 'from pydantic import BaseModel\n', + [ + 'class Foo(BaseModel):\n pass', + ], + ) + result = sort_classes(content) + assert 'class Foo(BaseModel)' in result + + +def test_sort_classes_single_class() -> None: + content = _make_file( + 'from pydantic import BaseModel\n', + [ + 'class Only(BaseModel):\n name: str', + ], + ) + result = sort_classes(content) + assert 'class Only(BaseModel)' in result + + +def test_sort_classes_generic_base_class() -> None: + """Classes with generic bases like RootModel[list[Foo]] should parse correctly.""" + content = _make_file( + 'from pydantic import BaseModel, RootModel\n', + [ + 'class FooList(RootModel[list[Foo]]):\n pass', + 'class Foo(BaseModel):\n name: str', + ], + ) + result = sort_classes(content) + names = _extract_class_names(result) + # Foo is referenced in FooList's base expression, so Foo must come first. + assert names.index('Foo') < names.index('FooList') + + +def test_sort_classes_multiple_independent_trees() -> None: + """Two separate inheritance trees should each be sorted correctly.""" + content = _make_file( + 'from pydantic import BaseModel\n', + [ + 'class DogBreed(Dog):\n pass', + 'class Cat(BaseModel):\n pass', + 'class Dog(BaseModel):\n pass', + 'class Ant(BaseModel):\n pass', + ], + ) + result = sort_classes(content) + names = _extract_class_names(result) + assert names.index('Dog') < names.index('DogBreed') + # All independent classes should be in alphabetical order relative to each other. + independent = [n for n in names if n != 'DogBreed'] + assert independent == sorted(independent) + + +def test_sort_classes_fallback_on_cycle() -> None: + """If there's a cycle in inheritance, the original content is returned unchanged.""" + content = _make_file( + 'from pydantic import BaseModel\n', + [ + 'class A(B):\n pass', + 'class B(A):\n pass', + ], + ) + result = sort_classes(content) + assert result == content + + +def test_sort_classes_fallback_on_unparseable_block() -> None: + header = 'from pydantic import BaseModel' + # Insert a decorated block that has no valid class definition. + content = ( + f'{header}\n\n\n' + f"@docs_group('Models')\n" + f'# This is not a class\n' + f'some_var = 1\n\n\n' + f"@docs_group('Models')\n" + f'class Foo(BaseModel):\n' + f' pass\n' + ) + result = sort_classes(content) + assert result == content + + +def test_sort_classes_multiline_class_body_preserved() -> None: + """Ensure multi-line class bodies with various field types are fully preserved.""" + body = textwrap.dedent("""\ + class Config(BaseModel): + name: str + value: int = 0 + tags: list[str] = Field(default_factory=list) + + def validate_name(self) -> None: + pass""") + content = _make_file( + 'from pydantic import BaseModel, Field\n', + [ + 'class Zebra(BaseModel):\n pass', + body, + ], + ) + result = sort_classes(content) + names = _extract_class_names(result) + assert names == ['Config', 'Zebra'] + assert 'def validate_name(self) -> None:' in result + + +def test_sort_classes_strips_trailing_header_blanks() -> None: + """Trailing blank lines in the header should not cause extra spacing.""" + content = _make_file( + 'from pydantic import BaseModel\n\n\n\n', + [ + 'class Foo(BaseModel):\n pass', + ], + ) + result = sort_classes(content) + # Should not have more than 3 consecutive newlines. + assert '\n\n\n\n' not in result + + +# -- Integration: full pipeline ----------------------------------------------- + + +def test_full_pipeline() -> None: + content = textwrap.dedent("""\ + from pydantic import BaseModel + + class Zebra(BaseModel): + items: list[Pricing] = Field(discriminator='pricingModel') + + class ErrorType(StrEnum): + SOME_ERROR = 'some-error' + + class Type(StrEnum): + SOME_ERROR = 'some-error' + + class ErrorResponse(BaseModel): + error_type: Type + + class Alpha(BaseModel): + name: str + """) + result = fix_discriminators(content) + result = deduplicate_error_type_enum(result) + result = add_docs_group_decorators(result) + result = sort_classes(result) + + # Discriminator fixed. + assert "discriminator='pricing_model'" in result + assert "discriminator='pricingModel'" not in result + + # Duplicate Type enum removed and references rewired. + assert 'class Type(StrEnum)' not in result + assert 'error_type: ErrorType' in result + + # Decorators added. + assert "@docs_group('Models')" in result + + # Classes sorted (Alpha before ErrorResponse before Zebra). + names = _extract_class_names(result) + model_names = [n for n in names if n != 'ErrorType'] + assert model_names == sorted(model_names) From fc7066a53bab45ed078d0076d934c96559534184 Mon Sep 17 00:00:00 2001 From: Vlada Dusek Date: Wed, 15 Apr 2026 14:02:33 +0200 Subject: [PATCH 4/4] fix: typo unparseable -> unparsable in test name Co-Authored-By: Claude Opus 4.6 (1M context) --- tests/unit/test_postprocess_generated_models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/test_postprocess_generated_models.py b/tests/unit/test_postprocess_generated_models.py index fa475dd3..99c275d6 100644 --- a/tests/unit/test_postprocess_generated_models.py +++ b/tests/unit/test_postprocess_generated_models.py @@ -442,7 +442,7 @@ def test_sort_classes_fallback_on_cycle() -> None: assert result == content -def test_sort_classes_fallback_on_unparseable_block() -> None: +def test_sort_classes_fallback_on_unparsable_block() -> None: header = 'from pydantic import BaseModel' # Insert a decorated block that has no valid class definition. content = (