Benefits
December 19, 2025 ยท View on GitHub
(benefits)
Overview
Available Operations
- list - List Benefits
- create - Create Benefit
- get - Get Benefit
- update - Update Benefit
- delete - Delete Benefit
- grants - List Benefit Grants
list
List benefits.
Scopes: benefits:read benefits:write
Example Usage
from polar_sdk import Polar
with Polar(
access_token="<YOUR_BEARER_TOKEN_HERE>",
) as polar:
res = polar.benefits.list(organization_id="1dbfc517-0bbf-4301-9ba8-555ca42b9737", page=1, limit=10)
while res is not None:
# Handle items
res = res.next()
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
organization_id | OptionalNullable[models.QueryParamOrganizationIDFilter] | :heavy_minus_sign: | Filter by organization ID. |
type_filter | OptionalNullable[models.BenefitTypeFilter] | :heavy_minus_sign: | Filter by benefit type. |
id | OptionalNullable[models.FilterIDs] | :heavy_minus_sign: | Filter by benefit IDs. |
exclude_id | OptionalNullable[models.ExcludeIDs] | :heavy_minus_sign: | Exclude benefits with these IDs. |
query | OptionalNullable[str] | :heavy_minus_sign: | Filter by description. |
page | Optional[int] | :heavy_minus_sign: | Page number, defaults to 1. |
limit | Optional[int] | :heavy_minus_sign: | Size of a page, defaults to 10. Maximum is 100. |
sorting | List[models.BenefitSortProperty] | :heavy_minus_sign: | Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign - before the criteria name to sort by descending order. |
metadata | Dict[str, models.MetadataQuery] | :heavy_minus_sign: | Filter by metadata key-value pairs. It uses the deepObject style, e.g. ?metadata[key]=value. |
retries | Optional[utils.RetryConfig] | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. |
Response
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| models.HTTPValidationError | 422 | application/json |
| models.SDKError | 4XX, 5XX | */* |
create
Create a benefit.
Scopes: benefits:write
Example Usage
from polar_sdk import Polar
with Polar(
access_token="<YOUR_BEARER_TOKEN_HERE>",
) as polar:
res = polar.benefits.create(request={
"type": "license_keys",
"description": "mature emergent at outside arrogantly gadzooks zealous equatorial notwithstanding",
"properties": {},
})
# Handle response
print(res)
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request | models.BenefitCreate | :heavy_check_mark: | The request object to use for the request. |
retries | Optional[utils.RetryConfig] | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. |
Response
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| models.HTTPValidationError | 422 | application/json |
| models.SDKError | 4XX, 5XX | */* |
get
Get a benefit by ID.
Scopes: benefits:read benefits:write
Example Usage
from polar_sdk import Polar
with Polar(
access_token="<YOUR_BEARER_TOKEN_HERE>",
) as polar:
res = polar.benefits.get(id="<value>")
# Handle response
print(res)
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | str | :heavy_check_mark: | N/A |
retries | Optional[utils.RetryConfig] | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. |
Response
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| models.ResourceNotFound | 404 | application/json |
| models.HTTPValidationError | 422 | application/json |
| models.SDKError | 4XX, 5XX | */* |
update
Update a benefit.
Scopes: benefits:write
Example Usage
from polar_sdk import Polar
with Polar(
access_token="<YOUR_BEARER_TOKEN_HERE>",
) as polar:
res = polar.benefits.update(id="<value>", request_body={
"type": "custom",
})
# Handle response
print(res)
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | str | :heavy_check_mark: | N/A |
request_body | models.BenefitsUpdateBenefitUpdate | :heavy_check_mark: | N/A |
retries | Optional[utils.RetryConfig] | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. |
Response
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| models.ResourceNotFound | 404 | application/json |
| models.HTTPValidationError | 422 | application/json |
| models.SDKError | 4XX, 5XX | */* |
delete
Delete a benefit.
Warning
Every grants associated with the benefit will be revoked. Users will lose access to the benefit.
Scopes: benefits:write
Example Usage
from polar_sdk import Polar
with Polar(
access_token="<YOUR_BEARER_TOKEN_HERE>",
) as polar:
polar.benefits.delete(id="<value>")
# Use the SDK ...
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | str | :heavy_check_mark: | N/A |
retries | Optional[utils.RetryConfig] | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. |
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| models.NotPermitted | 403 | application/json |
| models.ResourceNotFound | 404 | application/json |
| models.HTTPValidationError | 422 | application/json |
| models.SDKError | 4XX, 5XX | */* |
grants
List the individual grants for a benefit.
It's especially useful to check if a user has been granted a benefit.
Scopes: benefits:read benefits:write
Example Usage
from polar_sdk import Polar
with Polar(
access_token="<YOUR_BEARER_TOKEN_HERE>",
) as polar:
res = polar.benefits.grants(id="<value>", page=1, limit=10)
while res is not None:
# Handle items
res = res.next()
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | str | :heavy_check_mark: | N/A |
is_granted | OptionalNullable[bool] | :heavy_minus_sign: | Filter by granted status. If true, only granted benefits will be returned. If false, only revoked benefits will be returned. |
customer_id | OptionalNullable[models.QueryParamCustomerIDFilter] | :heavy_minus_sign: | Filter by customer. |
member_id | OptionalNullable[models.MemberIDFilter] | :heavy_minus_sign: | Filter by member. |
page | Optional[int] | :heavy_minus_sign: | Page number, defaults to 1. |
limit | Optional[int] | :heavy_minus_sign: | Size of a page, defaults to 10. Maximum is 100. |
retries | Optional[utils.RetryConfig] | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. |
Response
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| models.ResourceNotFound | 404 | application/json |
| models.HTTPValidationError | 422 | application/json |
| models.SDKError | 4XX, 5XX | */* |