Webhooks#

class WebhooksClient(*, sdk_config: SDKConfiguration, generated_client: ApiClient)[source]#

Bases: object

Client for managing webhooks and their subscriptions.

A webhook is an organization-level destination: an HTTPS endpoint plus the authentication used to call it. A subscription delivers one event from one prompt or evaluator to one webhook.

This class is primarily intended for internal use within the SDK. Users are highly encouraged to access resource-specific functionality via arize.ArizeClient.

The webhooks client is a thin wrapper around the generated REST API client, using the shared generated API client owned by arize.config.SDKConfiguration.

Parameters:
  • sdk_config (SDKConfiguration) – Resolved SDK configuration.

  • generated_client (ApiClient) – Shared generated API client instance.

list(*, organization: str | None = None, name: str | None = None, limit: int = DEFAULT_LIST_LIMIT, cursor: str | None = None) → ListWebhooksResponse[source]#

List webhooks the user has access to.

Webhooks are returned in descending creation order (most recently created first). Webhooks used as monitor notification channels are included.

Parameters:
  • organization (str | None) – Optional organization ID or name to narrow the list to a single organization.

  • name (str | None) – Optional case-insensitive substring filter on the webhook name.

  • limit (int) – Maximum number of webhooks to return. The server enforces an upper bound.

  • cursor (str | None) – Opaque pagination cursor returned from a previous response.

Returns:

A response object with the webhooks and pagination information.

Raises:
  • NotFoundError – If the organization name cannot be resolved.

  • ApiException – If the REST API returns an error response (e.g. 400/401/403/404/429).

Return type:

ListWebhooksResponse

get(*, webhook: str, organization: str | None = None) → Webhook[source]#

Get a webhook by ID or name.

Parameters:
  • webhook (str) – Webhook ID or name. If a name is provided, organization is required for resolution.

  • organization (str | None) – Organization ID or name. Required when webhook is a name so it can be resolved to an ID.

Returns:

The webhook object. Credentials (auth_token, header values, signing secret) are never included.

Raises:
  • NotFoundError – If the webhook name cannot be resolved.

  • ApiException – If the REST API returns an error response (e.g. 400/401/404/429).

Return type:

Webhook

create(*, organization: str, name: str, url: str, description: str | None = None, auth_type: WebhookAuthType | None = None, auth_token: str | None = None, timeout_ms: int | None = None, headers: dict[str, str] | None = None) → CreateWebhookResponse[source]#

Create a webhook.

For HMAC_SHA256 webhooks the response carries signing_secret. This is the only time the secret is ever returned; store it securely. Afterwards only the redacted signing_secret_hint is readable, and losing the secret means deleting and recreating the webhook.

Parameters:
  • organization (str) – Organization ID or name to create the webhook in.

  • name (str) – Webhook name (must be unique within the organization, max 255 characters).

  • url (str) – The HTTPS endpoint events are delivered to.

  • description (str | None) – Optional description. Defaults to an empty string.

  • auth_type (WebhookAuthType | None) – How deliveries are authenticated. Defaults to BEARER and cannot be changed after creation.

  • auth_token (str | None) – The complete Authorization header value sent with each delivery, e.g. "Bearer my-token". It is sent verbatim, so include the Bearer `` prefix if the endpoint expects one. Only valid when *auth_type* is ``BEARER. Never returned.

  • timeout_ms (int | None) – Delivery timeout in milliseconds, between 1000 and 60000. Defaults to 30000.

  • headers (dict[str, str] | None) – Custom HTTP headers sent with each delivery, at most 20. Header values are never returned.

Returns:

The created webhook, including signing_secret for HMAC_SHA256 webhooks.

Raises:
  • NotFoundError – If the organization name cannot be resolved.

  • ApiException – If the REST API returns an error response (e.g. 400/401/403/404/409/422/429).

Return type:

CreateWebhookResponse

update(*, webhook: str, organization: str | None = None, name: str | UNSET = _UNSET, description: str | None | UNSET = _UNSET, url: str | UNSET = _UNSET, auth_token: str | UNSET = _UNSET, timeout_ms: int | UNSET = _UNSET, headers: dict[str, str] | UNSET = _UNSET) → Webhook[source]#

Update a webhook.

Only the fields passed are updated. At least one field must be provided. auth_type cannot be changed after creation, and the signing secret of an HMAC_SHA256 webhook cannot be rotated; create a new webhook instead.

Parameters:
  • webhook (str) – Webhook ID or name. If a name is provided, organization is required for resolution.

  • organization (str | None) – Organization ID or name. Required when webhook is a name so it can be resolved to an ID.

  • name (str | UNSET) – New name (must remain unique within the organization).

  • description (str | None | UNSET) – New description. Pass None to clear it.

  • url (str | UNSET) – New HTTPS endpoint.

  • auth_token (str | UNSET) – Replacement Authorization header value. Only valid when the webhook’s auth_type is BEARER.

  • timeout_ms (int | UNSET) – New delivery timeout in milliseconds (1000 to 60000).

  • headers (dict[str, str] | UNSET) – Replacement custom headers. Replaces the whole header map; headers not included are removed.

Returns:

The updated webhook object as returned by the API.

Raises:
  • ValueError – If no fields to update are provided.

  • NotFoundError – If the webhook name cannot be resolved.

  • ApiException – If the REST API returns an error response (e.g. 400/401/403/404/409/422/429).

Return type:

Webhook

delete(*, webhook: str, organization: str | None = None) → None[source]#

Delete a webhook by ID or name.

The webhook stops receiving events and is detached from every prompt, evaluator, and monitor it was subscribed to. This operation is irreversible.

Parameters:
  • webhook (str) – Webhook ID or name. If a name is provided, organization is required for resolution.

  • organization (str | None) – Organization ID or name. Required when webhook is a name so it can be resolved to an ID.

Returns:

This method returns None on success (HTTP 204 No Content).

Raises:
  • NotFoundError – If the webhook name cannot be resolved.

  • ApiException – If the REST API returns an error response (e.g. 400/401/403/404/429).

Return type:

None

test(*, webhook: str, organization: str | None = None) → TestWebhookResponse[source]#

Send a test event to a webhook’s endpoint and report the outcome.

A successful call means the test ran; check status_code and error_message on the response for the endpoint’s actual outcome. status_code is 502 when no response was received. Test deliveries are not supported for HMAC_SHA256 webhooks.

Parameters:
  • webhook (str) – Webhook ID or name. If a name is provided, organization is required for resolution.

  • organization (str | None) – Organization ID or name. Required when webhook is a name so it can be resolved to an ID.

Returns:

The endpoint’s status code and error message, if any.

Raises:
  • NotFoundError – If the webhook name cannot be resolved.

  • ApiException – If the REST API returns an error response (e.g. 400/401/403/404/429/503).

Return type:

TestWebhookResponse

list_delivery_attempts(*, webhook: str, organization: str | None = None, limit: int = DEFAULT_LIST_LIMIT, cursor: str | None = None) → ListWebhookDeliveryAttemptsResponse[source]#

List a webhook’s delivery attempts, most recent first.

Each event may have several attempts, since failed deliveries are retried.

Parameters:
  • webhook (str) – Webhook ID or name. If a name is provided, organization is required for resolution.

  • organization (str | None) – Organization ID or name. Required when webhook is a name so it can be resolved to an ID.

  • limit (int) – Maximum number of attempts to return. The server enforces an upper bound.

  • cursor (str | None) – Opaque pagination cursor returned from a previous response.

Returns:

A response object with the delivery attempts and pagination information.

Raises:
  • NotFoundError – If the webhook name cannot be resolved.

  • ApiException – If the REST API returns an error response (e.g. 400/401/403/404/429).

Return type:

ListWebhookDeliveryAttemptsResponse

list_subscriptions(*, source_type: WebhookSourceType | None = None, source_id: str | None = None, limit: int = DEFAULT_LIST_LIMIT, cursor: str | None = None) → ListWebhookSubscriptionsResponse[source]#

List webhook subscriptions on prompts and evaluators.

Subscriptions are returned in descending creation order. Each subscription delivers one event to one webhook, so a webhook that receives several events from a source appears once per event.

Subscriptions whose webhook has since been deleted are dropped after the page is read, so a page may hold fewer than limit items while pagination.has_more is still true. Keep paging until it is false.

Parameters:
  • source_type (WebhookSourceType | None) – Restrict to one source kind. Must be given together with source_id.

  • source_id (str | None) – Restrict to one prompt or evaluator by ID. Must be given together with source_type.

  • limit (int) – Maximum number of subscriptions to return. The server enforces an upper bound.

  • cursor (str | None) – Opaque pagination cursor returned from a previous response.

Returns:

A response object with the subscriptions and pagination information.

Raises:
  • ValueError – If only one of source_type and source_id is given.

  • ApiException – If the REST API returns an error response (e.g. 400/401/403/404/429).

Return type:

ListWebhookSubscriptionsResponse

create_subscription(*, webhook: str, source_type: WebhookSourceType, source_id: str, event: WebhookEventType, organization: str | None = None) → WebhookSubscription[source]#

Subscribe a webhook to one event on a prompt or evaluator.

To deliver several events to the same webhook, create one subscription per event. The event must belong to the source type: prompt events for PROMPT sources and evaluator events for EVALUATOR sources.

Parameters:
  • webhook (str) – Webhook ID or name. Must belong to the source’s organization. If a name is provided, organization is required for resolution.

  • source_type (WebhookSourceType) – The kind of resource to attach the webhook to.

  • source_id (str) – The ID of the prompt or evaluator.

  • event (WebhookEventType) – The event to deliver.

  • organization (str | None) – Organization ID or name. Required when webhook is a name so it can be resolved to an ID.

Returns:

The created subscription.

Raises:
  • NotFoundError – If the webhook name cannot be resolved.

  • ApiException – If the REST API returns an error response (e.g. 400/401/403/404/409/422/429).

Return type:

WebhookSubscription

get_subscription(*, subscription_id: str) → WebhookSubscription[source]#

Get a webhook subscription by ID.

Parameters:

subscription_id (str) – The subscription ID.

Returns:

The subscription object.

Raises:

ApiException – If the REST API returns an error response (e.g. 400/401/404/429). A 404 is returned when the subscription does not exist, its source is not readable, or its webhook has since been deleted.

Return type:

WebhookSubscription

delete_subscription(*, subscription_id: str) → None[source]#

Delete a webhook subscription by ID.

The webhook stops receiving that event from the source. Other subscriptions on the source and the webhook itself are unaffected.

Parameters:

subscription_id (str) – The subscription ID.

Returns:

This method returns None on success (HTTP 204 No Content).

Raises:

ApiException – If the REST API returns an error response (e.g. 400/401/403/404/429).

Return type:

None

Response Types#

Public type re-exports for the webhooks subdomain.

class CreateWebhookResponse(*, id: Annotated[str, Strict(strict=True)], organization_id: Annotated[str, Strict(strict=True)], name: Annotated[str, Strict(strict=True), MaxLen(max_length=255)], description: Annotated[str, Strict(strict=True)], url: Annotated[str, Strict(strict=True)], auth_type: WebhookAuthType, signing_secret: Annotated[str, Strict(strict=True)] | None = None, signing_secret_hint: Annotated[str, Strict(strict=True)] | None = None, timeout_ms: Annotated[int, Strict(strict=True), Ge(ge=1000), Le(le=60000)], created_at: datetime, updated_at: datetime, created_by_user_id: Annotated[str, Strict(strict=True)] | None = None)[source]#

Bases: BaseModel

The created webhook, plus signing_secret for HMAC_SHA256 webhooks — the only time the secret is ever returned.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
  • id (Annotated[str, Strict(strict=True)])

  • organization_id (Annotated[str, Strict(strict=True)])

  • name (Annotated[str, FieldInfo(annotation=NoneType, required=True, metadata=[Strict(strict=True), MaxLen(max_length=255)])])

  • description (Annotated[str, Strict(strict=True)])

  • url (Annotated[str, Strict(strict=True)])

  • auth_type (WebhookAuthType)

  • signing_secret (Annotated[str, Strict(strict=True)] | None)

  • signing_secret_hint (Annotated[str, Strict(strict=True)] | None)

  • timeout_ms (Annotated[int, FieldInfo(annotation=NoneType, required=True, metadata=[Strict(strict=True), Ge(ge=1000), Le(le=60000)])])

  • created_at (datetime)

  • updated_at (datetime)

  • created_by_user_id (Annotated[str, Strict(strict=True)] | None)

id: StrictStr#
organization_id: StrictStr#
name: Annotated[str, Field(strict=True, max_length=255)]#
description: StrictStr#
url: StrictStr#
auth_type: WebhookAuthType#
signing_secret: StrictStr | None#
signing_secret_hint: StrictStr | None#
timeout_ms: Annotated[int, Field(le=60000, strict=True, ge=1000)]#
created_at: datetime#
updated_at: datetime#
created_by_user_id: StrictStr | None#
model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'protected_namespaces': (), 'validate_assignment': True, 'validate_by_alias': True, 'validate_by_name': True}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

to_str() → str[source]#

Returns the string representation of the model using alias

Return type:

str

to_json() → str[source]#

Returns the JSON representation of the model using alias

Return type:

str

classmethod from_json(json_str: str) → Self | None[source]#

Create an instance of CreateWebhookResponse from a JSON string

Parameters:

json_str (str)

Return type:

Self | None

to_dict() → Dict[str, Any][source]#

Return the dictionary representation of the model using alias.

This has the following differences from calling pydantic’s self.model_dump(by_alias=True):

  • None is only added to the output dict for nullable fields that were set at model initialization. Other fields with value None are ignored.

Return type:

Dict[str, Any]

classmethod from_dict(obj: Dict[str, Any] | None) → Self | None[source]#

Create an instance of CreateWebhookResponse from a dict

Parameters:

obj (Dict[str, Any] | None)

Return type:

Self | None

class ListWebhookDeliveryAttemptsResponse(*, delivery_attempts: List[WebhookDeliveryAttempt], pagination: PaginationMetadata)[source]#

Bases: BaseModel

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
delivery_attempts: List[WebhookDeliveryAttempt]#
pagination: PaginationMetadata#
model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'protected_namespaces': (), 'validate_assignment': True, 'validate_by_alias': True, 'validate_by_name': True}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

to_str() → str[source]#

Returns the string representation of the model using alias

Return type:

str

to_json() → str[source]#

Returns the JSON representation of the model using alias

Return type:

str

classmethod from_json(json_str: str) → Self | None[source]#

Create an instance of ListWebhookDeliveryAttemptsResponse from a JSON string

Parameters:

json_str (str)

Return type:

Self | None

to_dict() → Dict[str, Any][source]#

Return the dictionary representation of the model using alias.

This has the following differences from calling pydantic’s self.model_dump(by_alias=True):

  • None is only added to the output dict for nullable fields that were set at model initialization. Other fields with value None are ignored.

Return type:

Dict[str, Any]

classmethod from_dict(obj: Dict[str, Any] | None) → Self | None[source]#

Create an instance of ListWebhookDeliveryAttemptsResponse from a dict

Parameters:

obj (Dict[str, Any] | None)

Return type:

Self | None

class ListWebhookSubscriptionsResponse(*, subscriptions: List[WebhookSubscription], pagination: PaginationMetadata)[source]#

Bases: BaseModel

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
subscriptions: List[WebhookSubscription]#
pagination: PaginationMetadata#
model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'protected_namespaces': (), 'validate_assignment': True, 'validate_by_alias': True, 'validate_by_name': True}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

to_str() → str[source]#

Returns the string representation of the model using alias

Return type:

str

to_json() → str[source]#

Returns the JSON representation of the model using alias

Return type:

str

classmethod from_json(json_str: str) → Self | None[source]#

Create an instance of ListWebhookSubscriptionsResponse from a JSON string

Parameters:

json_str (str)

Return type:

Self | None

to_dict() → Dict[str, Any][source]#

Return the dictionary representation of the model using alias.

This has the following differences from calling pydantic’s self.model_dump(by_alias=True):

  • None is only added to the output dict for nullable fields that were set at model initialization. Other fields with value None are ignored.

Return type:

Dict[str, Any]

classmethod from_dict(obj: Dict[str, Any] | None) → Self | None[source]#

Create an instance of ListWebhookSubscriptionsResponse from a dict

Parameters:

obj (Dict[str, Any] | None)

Return type:

Self | None

class ListWebhooksResponse(*, webhooks: List[Webhook], pagination: PaginationMetadata)[source]#

Bases: BaseModel

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
webhooks: List[Webhook]#
pagination: PaginationMetadata#
model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'protected_namespaces': (), 'validate_assignment': True, 'validate_by_alias': True, 'validate_by_name': True}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

to_str() → str[source]#

Returns the string representation of the model using alias

Return type:

str

to_json() → str[source]#

Returns the JSON representation of the model using alias

Return type:

str

classmethod from_json(json_str: str) → Self | None[source]#

Create an instance of ListWebhooksResponse from a JSON string

Parameters:

json_str (str)

Return type:

Self | None

to_dict() → Dict[str, Any][source]#

Return the dictionary representation of the model using alias.

This has the following differences from calling pydantic’s self.model_dump(by_alias=True):

  • None is only added to the output dict for nullable fields that were set at model initialization. Other fields with value None are ignored.

Return type:

Dict[str, Any]

classmethod from_dict(obj: Dict[str, Any] | None) → Self | None[source]#

Create an instance of ListWebhooksResponse from a dict

Parameters:

obj (Dict[str, Any] | None)

Return type:

Self | None

class PaginationMetadata(*, next_cursor: Annotated[str, Strict(strict=True)] | None = None, has_more: Annotated[bool, Strict(strict=True)])[source]#

Bases: BaseModel

Cursor-based pagination metadata. Use next_cursor in the subsequent request’s cursor query parameter.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
next_cursor: StrictStr | None#
has_more: StrictBool#
model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'protected_namespaces': (), 'validate_assignment': True, 'validate_by_alias': True, 'validate_by_name': True}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

to_str() → str[source]#

Returns the string representation of the model using alias

Return type:

str

to_json() → str[source]#

Returns the JSON representation of the model using alias

Return type:

str

classmethod from_json(json_str: str) → Self | None[source]#

Create an instance of PaginationMetadata from a JSON string

Parameters:

json_str (str)

Return type:

Self | None

to_dict() → Dict[str, Any][source]#

Return the dictionary representation of the model using alias.

This has the following differences from calling pydantic’s self.model_dump(by_alias=True):

  • None is only added to the output dict for nullable fields that were set at model initialization. Other fields with value None are ignored.

Return type:

Dict[str, Any]

classmethod from_dict(obj: Dict[str, Any] | None) → Self | None[source]#

Create an instance of PaginationMetadata from a dict

Parameters:

obj (Dict[str, Any] | None)

Return type:

Self | None

class TestWebhookResponse(*, status_code: Annotated[int, Strict(strict=True)], error_message: Annotated[str, Strict(strict=True)] | None)[source]#

Bases: BaseModel

The outcome of a test delivery to the webhook’s endpoint.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
status_code: StrictInt#
error_message: StrictStr | None#
model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'protected_namespaces': (), 'validate_assignment': True, 'validate_by_alias': True, 'validate_by_name': True}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

to_str() → str[source]#

Returns the string representation of the model using alias

Return type:

str

to_json() → str[source]#

Returns the JSON representation of the model using alias

Return type:

str

classmethod from_json(json_str: str) → Self | None[source]#

Create an instance of TestWebhookResponse from a JSON string

Parameters:

json_str (str)

Return type:

Self | None

to_dict() → Dict[str, Any][source]#

Return the dictionary representation of the model using alias.

This has the following differences from calling pydantic’s self.model_dump(by_alias=True):

  • None is only added to the output dict for nullable fields that were set at model initialization. Other fields with value None are ignored.

Return type:

Dict[str, Any]

classmethod from_dict(obj: Dict[str, Any] | None) → Self | None[source]#

Create an instance of TestWebhookResponse from a dict

Parameters:

obj (Dict[str, Any] | None)

Return type:

Self | None

class Webhook(*, id: Annotated[str, Strict(strict=True)], organization_id: Annotated[str, Strict(strict=True)], name: Annotated[str, Strict(strict=True), MaxLen(max_length=255)], description: Annotated[str, Strict(strict=True)], url: Annotated[str, Strict(strict=True)], auth_type: WebhookAuthType, signing_secret_hint: Annotated[str, Strict(strict=True)] | None = None, timeout_ms: Annotated[int, Strict(strict=True), Ge(ge=1000), Le(le=60000)], created_at: datetime, updated_at: datetime, created_by_user_id: Annotated[str, Strict(strict=True)] | None = None)[source]#

Bases: BaseModel

A webhook is an organization-owned destination that receives event deliveries over HTTPS. Create webhook subscriptions to choose which prompt and evaluator events it receives. Credentials are write-only: the bearer token and custom header values are never returned, and the HMAC signing secret is returned exactly once, in the create response — only its redacted hint is readable afterwards.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
  • id (Annotated[str, Strict(strict=True)])

  • organization_id (Annotated[str, Strict(strict=True)])

  • name (Annotated[str, FieldInfo(annotation=NoneType, required=True, metadata=[Strict(strict=True), MaxLen(max_length=255)])])

  • description (Annotated[str, Strict(strict=True)])

  • url (Annotated[str, Strict(strict=True)])

  • auth_type (WebhookAuthType)

  • signing_secret_hint (Annotated[str, Strict(strict=True)] | None)

  • timeout_ms (Annotated[int, FieldInfo(annotation=NoneType, required=True, metadata=[Strict(strict=True), Ge(ge=1000), Le(le=60000)])])

  • created_at (datetime)

  • updated_at (datetime)

  • created_by_user_id (Annotated[str, Strict(strict=True)] | None)

id: StrictStr#
organization_id: StrictStr#
name: Annotated[str, Field(strict=True, max_length=255)]#
description: StrictStr#
url: StrictStr#
auth_type: WebhookAuthType#
signing_secret_hint: StrictStr | None#
timeout_ms: Annotated[int, Field(le=60000, strict=True, ge=1000)]#
created_at: datetime#
updated_at: datetime#
created_by_user_id: StrictStr | None#
model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'protected_namespaces': (), 'validate_assignment': True, 'validate_by_alias': True, 'validate_by_name': True}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

to_str() → str[source]#

Returns the string representation of the model using alias

Return type:

str

to_json() → str[source]#

Returns the JSON representation of the model using alias

Return type:

str

classmethod from_json(json_str: str) → Self | None[source]#

Create an instance of Webhook from a JSON string

Parameters:

json_str (str)

Return type:

Self | None

to_dict() → Dict[str, Any][source]#

Return the dictionary representation of the model using alias.

This has the following differences from calling pydantic’s self.model_dump(by_alias=True):

  • None is only added to the output dict for nullable fields that were set at model initialization. Other fields with value None are ignored.

Return type:

Dict[str, Any]

classmethod from_dict(obj: Dict[str, Any] | None) → Self | None[source]#

Create an instance of Webhook from a dict

Parameters:

obj (Dict[str, Any] | None)

Return type:

Self | None

class WebhookAuthType(value, names=_not_given, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]#

Bases: str, Enum

How deliveries from this webhook are authenticated. - BEARER: the stored auth_token is sent verbatim as the Authorization header of each delivery request. - HMAC_SHA256: each delivery is signed with the webhook’s signing secret. The X-Arize-Webhook-Signature header carries v1=<hex-encoded HMAC-SHA256> computed over <timestamp>.<raw request body>, where <timestamp> is the Unix-seconds value from the X-Arize-Webhook-Timestamp header and the raw body is the exact bytes received. Deliveries also carry X-Arize-Webhook-Id (event identifier) and X-Arize-Webhook-Event (event type). To verify, recompute the HMAC over the received timestamp and raw body with your stored secret and compare it to the signature.

BEARER = 'BEARER'#
HMAC_SHA256 = 'HMAC_SHA256'#
classmethod from_json(json_str: str) → Self[source]#

Create an instance of WebhookAuthType from a JSON string

Parameters:

json_str (str)

Return type:

Self

class WebhookDeliveryAttempt(*, event_id: Annotated[str, Strict(strict=True)], attempt_number: Annotated[int, Strict(strict=True), Ge(ge=1)], payload: Dict[str, Any], status_code: Annotated[int, Strict(strict=True)] | None = None, error_message: Annotated[str, Strict(strict=True)] | None = None, created_at: datetime)[source]#

Bases: BaseModel

A single attempt to deliver an event to a webhook’s endpoint.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
  • event_id (Annotated[str, Strict(strict=True)])

  • attempt_number (Annotated[int, FieldInfo(annotation=NoneType, required=True, metadata=[Strict(strict=True), Ge(ge=1)])])

  • payload (Dict[str, Any])

  • status_code (Annotated[int, Strict(strict=True)] | None)

  • error_message (Annotated[str, Strict(strict=True)] | None)

  • created_at (datetime)

event_id: StrictStr#
attempt_number: Annotated[int, Field(strict=True, ge=1)]#
payload: Dict[str, Any]#
status_code: StrictInt | None#
error_message: StrictStr | None#
created_at: datetime#
model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'protected_namespaces': (), 'validate_assignment': True, 'validate_by_alias': True, 'validate_by_name': True}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

to_str() → str[source]#

Returns the string representation of the model using alias

Return type:

str

to_json() → str[source]#

Returns the JSON representation of the model using alias

Return type:

str

classmethod from_json(json_str: str) → Self | None[source]#

Create an instance of WebhookDeliveryAttempt from a JSON string

Parameters:

json_str (str)

Return type:

Self | None

to_dict() → Dict[str, Any][source]#

Return the dictionary representation of the model using alias.

This has the following differences from calling pydantic’s self.model_dump(by_alias=True):

  • None is only added to the output dict for nullable fields that were set at model initialization. Other fields with value None are ignored.

Return type:

Dict[str, Any]

classmethod from_dict(obj: Dict[str, Any] | None) → Self | None[source]#

Create an instance of WebhookDeliveryAttempt from a dict

Parameters:

obj (Dict[str, Any] | None)

Return type:

Self | None

class WebhookEventType(value, names=_not_given, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]#

Bases: str, Enum

An event that a webhook can subscribe to. - PROMPT_VERSION_CREATED — a new version of the prompt was created. - PROMPT_VERSION_LABELED — a label was added to a version of the prompt. - PROMPT_VERSION_UNLABELED — a label was removed from a version of the prompt. - EVALUATOR_VERSION_CREATED — a new version of the evaluator was created. Prompt events are valid only for PROMPT sources, and evaluator events only for EVALUATOR sources.

PROMPT_VERSION_CREATED = 'PROMPT_VERSION_CREATED'#
PROMPT_VERSION_LABELED = 'PROMPT_VERSION_LABELED'#
PROMPT_VERSION_UNLABELED = 'PROMPT_VERSION_UNLABELED'#
EVALUATOR_VERSION_CREATED = 'EVALUATOR_VERSION_CREATED'#
classmethod from_json(json_str: str) → Self[source]#

Create an instance of WebhookEventType from a JSON string

Parameters:

json_str (str)

Return type:

Self

class WebhookSourceType(value, names=_not_given, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]#

Bases: str, Enum

The kind of resource a webhook subscription is attached to. - PROMPT — source_id is a prompt id. Prompt events apply. - EVALUATOR — source_id is an evaluator id. Evaluator events apply.

PROMPT = 'PROMPT'#
EVALUATOR = 'EVALUATOR'#
classmethod from_json(json_str: str) → Self[source]#

Create an instance of WebhookSourceType from a JSON string

Parameters:

json_str (str)

Return type:

Self

class WebhookSubscription(*, id: Annotated[str, Strict(strict=True)], webhook_id: Annotated[str, Strict(strict=True)], source_type: WebhookSourceType, source_id: Annotated[str, Strict(strict=True)], event: WebhookEventType, created_at: datetime)[source]#

Bases: BaseModel

A subscription delivers one event from one prompt or evaluator to one webhook. A webhook that should receive several events from the same resource has one subscription per event.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
id: StrictStr#
webhook_id: StrictStr#
source_type: WebhookSourceType#
source_id: StrictStr#
event: WebhookEventType#
created_at: datetime#
model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'protected_namespaces': (), 'validate_assignment': True, 'validate_by_alias': True, 'validate_by_name': True}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

to_str() → str[source]#

Returns the string representation of the model using alias

Return type:

str

to_json() → str[source]#

Returns the JSON representation of the model using alias

Return type:

str

classmethod from_json(json_str: str) → Self | None[source]#

Create an instance of WebhookSubscription from a JSON string

Parameters:

json_str (str)

Return type:

Self | None

to_dict() → Dict[str, Any][source]#

Return the dictionary representation of the model using alias.

This has the following differences from calling pydantic’s self.model_dump(by_alias=True):

  • None is only added to the output dict for nullable fields that were set at model initialization. Other fields with value None are ignored.

Return type:

Dict[str, Any]

classmethod from_dict(obj: Dict[str, Any] | None) → Self | None[source]#

Create an instance of WebhookSubscription from a dict

Parameters:

obj (Dict[str, Any] | None)

Return type:

Self | None