Webhooks

January 26, 2026 ยท View on GitHub

(webhooks)

Overview

Available Operations

list_webhook_endpoints

List webhook endpoints.

Scopes: webhooks:read webhooks:write

Example Usage

from polar_sdk import Polar


with Polar(
    access_token="<YOUR_BEARER_TOKEN_HERE>",
) as polar:

    res = polar.webhooks.list_webhook_endpoints(organization_id="1dbfc517-0bbf-4301-9ba8-555ca42b9737", page=1, limit=10)

    while res is not None:
        # Handle items

        res = res.next()

Parameters

ParameterTypeRequiredDescription
organization_idOptionalNullable[models.QueryParamOrganizationID]:heavy_minus_sign:Filter by organization ID.
pageOptional[int]:heavy_minus_sign:Page number, defaults to 1.
limitOptional[int]:heavy_minus_sign:Size of a page, defaults to 10. Maximum is 100.
retriesOptional[utils.RetryConfig]:heavy_minus_sign:Configuration to override the default retry behavior of the client.

Response

models.WebhooksListWebhookEndpointsResponse

Errors

Error TypeStatus CodeContent Type
models.HTTPValidationError422application/json
models.SDKError4XX, 5XX*/*

create_webhook_endpoint

Create a webhook endpoint.

Scopes: webhooks:write

Example Usage

import polar_sdk
from polar_sdk import Polar


with Polar(
    access_token="<YOUR_BEARER_TOKEN_HERE>",
) as polar:

    res = polar.webhooks.create_webhook_endpoint(request={
        "url": "https://webhook.site/cb791d80-f26e-4f8c-be88-6e56054192b0",
        "format_": polar_sdk.WebhookFormat.SLACK,
        "events": [
            polar_sdk.WebhookEventType.SUBSCRIPTION_UNCANCELED,
        ],
        "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737",
    })

    # Handle response
    print(res)

Parameters

ParameterTypeRequiredDescription
requestmodels.WebhookEndpointCreate:heavy_check_mark:The request object to use for the request.
retriesOptional[utils.RetryConfig]:heavy_minus_sign:Configuration to override the default retry behavior of the client.

Response

models.WebhookEndpoint

Errors

Error TypeStatus CodeContent Type
models.HTTPValidationError422application/json
models.SDKError4XX, 5XX*/*

get_webhook_endpoint

Get a webhook endpoint by ID.

Scopes: webhooks:read webhooks:write

Example Usage

from polar_sdk import Polar


with Polar(
    access_token="<YOUR_BEARER_TOKEN_HERE>",
) as polar:

    res = polar.webhooks.get_webhook_endpoint(id="<value>")

    # Handle response
    print(res)

Parameters

ParameterTypeRequiredDescription
idstr:heavy_check_mark:The webhook endpoint ID.
retriesOptional[utils.RetryConfig]:heavy_minus_sign:Configuration to override the default retry behavior of the client.

Response

models.WebhookEndpoint

Errors

Error TypeStatus CodeContent Type
models.ResourceNotFound404application/json
models.HTTPValidationError422application/json
models.SDKError4XX, 5XX*/*

update_webhook_endpoint

Update a webhook endpoint.

Scopes: webhooks:write

Example Usage

from polar_sdk import Polar


with Polar(
    access_token="<YOUR_BEARER_TOKEN_HERE>",
) as polar:

    res = polar.webhooks.update_webhook_endpoint(id="<value>", webhook_endpoint_update={
        "url": "https://webhook.site/cb791d80-f26e-4f8c-be88-6e56054192b0",
    })

    # Handle response
    print(res)

Parameters

ParameterTypeRequiredDescription
idstr:heavy_check_mark:The webhook endpoint ID.
webhook_endpoint_updatemodels.WebhookEndpointUpdate:heavy_check_mark:N/A
retriesOptional[utils.RetryConfig]:heavy_minus_sign:Configuration to override the default retry behavior of the client.

Response

models.WebhookEndpoint

Errors

Error TypeStatus CodeContent Type
models.ResourceNotFound404application/json
models.HTTPValidationError422application/json
models.SDKError4XX, 5XX*/*

delete_webhook_endpoint

Delete a webhook endpoint.

Scopes: webhooks:write

Example Usage

from polar_sdk import Polar


with Polar(
    access_token="<YOUR_BEARER_TOKEN_HERE>",
) as polar:

    polar.webhooks.delete_webhook_endpoint(id="<value>")

    # Use the SDK ...

Parameters

ParameterTypeRequiredDescription
idstr:heavy_check_mark:The webhook endpoint ID.
retriesOptional[utils.RetryConfig]:heavy_minus_sign:Configuration to override the default retry behavior of the client.

Errors

Error TypeStatus CodeContent Type
models.ResourceNotFound404application/json
models.HTTPValidationError422application/json
models.SDKError4XX, 5XX*/*

reset_webhook_endpoint_secret

Regenerate a webhook endpoint secret.

Scopes: webhooks:write

Example Usage

from polar_sdk import Polar


with Polar(
    access_token="<YOUR_BEARER_TOKEN_HERE>",
) as polar:

    res = polar.webhooks.reset_webhook_endpoint_secret(id="<value>")

    # Handle response
    print(res)

Parameters

ParameterTypeRequiredDescription
idstr:heavy_check_mark:The webhook endpoint ID.
retriesOptional[utils.RetryConfig]:heavy_minus_sign:Configuration to override the default retry behavior of the client.

Response

models.WebhookEndpoint

Errors

Error TypeStatus CodeContent Type
models.ResourceNotFound404application/json
models.HTTPValidationError422application/json
models.SDKError4XX, 5XX*/*

list_webhook_deliveries

List webhook deliveries.

Deliveries are all the attempts to deliver a webhook event to an endpoint.

Scopes: webhooks:read webhooks:write

Example Usage

from polar_sdk import Polar


with Polar(
    access_token="<YOUR_BEARER_TOKEN_HERE>",
) as polar:

    res = polar.webhooks.list_webhook_deliveries(page=1, limit=10)

    while res is not None:
        # Handle items

        res = res.next()

Parameters

ParameterTypeRequiredDescription
endpoint_idOptionalNullable[models.EndpointID]:heavy_minus_sign:Filter by webhook endpoint ID.
start_timestampdate:heavy_minus_sign:Filter deliveries after this timestamp.
end_timestampdate:heavy_minus_sign:Filter deliveries before this timestamp.
succeededOptionalNullable[bool]:heavy_minus_sign:Filter by delivery success status.
queryOptionalNullable[str]:heavy_minus_sign:Query to filter webhook deliveries.
http_code_classOptionalNullable[models.HTTPCodeClass]:heavy_minus_sign:Filter by HTTP response code class (2xx, 3xx, 4xx, 5xx).
event_typeOptionalNullable[models.QueryParamEventType]:heavy_minus_sign:Filter by webhook event type.
pageOptional[int]:heavy_minus_sign:Page number, defaults to 1.
limitOptional[int]:heavy_minus_sign:Size of a page, defaults to 10. Maximum is 100.
retriesOptional[utils.RetryConfig]:heavy_minus_sign:Configuration to override the default retry behavior of the client.

Response

models.WebhooksListWebhookDeliveriesResponse

Errors

Error TypeStatus CodeContent Type
models.HTTPValidationError422application/json
models.SDKError4XX, 5XX*/*

redeliver_webhook_event

Schedule the re-delivery of a webhook event.

Scopes: webhooks:write

Example Usage

from polar_sdk import Polar


with Polar(
    access_token="<YOUR_BEARER_TOKEN_HERE>",
) as polar:

    res = polar.webhooks.redeliver_webhook_event(id="<value>")

    # Handle response
    print(res)

Parameters

ParameterTypeRequiredDescription
idstr:heavy_check_mark:The webhook event ID.
retriesOptional[utils.RetryConfig]:heavy_minus_sign:Configuration to override the default retry behavior of the client.

Response

Any

Errors

Error TypeStatus CodeContent Type
models.ResourceNotFound404application/json
models.HTTPValidationError422application/json
models.SDKError4XX, 5XX*/*