{ "openapi": "3.1.0", "info": { "title": "Polar API", "summary": "Polar HTTP and Webhooks API", "description": "Read the docs at https://polar.sh/docs/api-reference", "version": "0.1.0" }, "servers": [ { "url": "https://api.polar.sh", "description": "Production environment", "x-speakeasy-server-id": "production" }, { "url": "https://sandbox-api.polar.sh", "description": "Sandbox environment", "x-speakeasy-server-id": "sandbox" } ], "paths": { "/v1/organizations/": { "get": { "tags": [ "organizations", "public" ], "summary": "List Organizations", "description": "List organizations.\n\n**Scopes**: `organizations:read` `organizations:write`", "operationId": "organizations:list", "parameters": [ { "name": "slug", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "description": "Filter by slug.", "title": "Slug" }, "description": "Filter by slug." }, { "name": "page", "in": "query", "required": false, "schema": { "type": "integer", "exclusiveMinimum": 0, "description": "Page number, defaults to 1.", "default": 1, "title": "Page" }, "description": "Page number, defaults to 1." }, { "name": "limit", "in": "query", "required": false, "schema": { "type": "integer", "exclusiveMinimum": 0, "description": "Size of a page, defaults to 10. Maximum is 100.", "default": 10, "title": "Limit" }, "description": "Size of a page, defaults to 10. Maximum is 100." }, { "name": "sorting", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "array", "items": { "$ref": "#/components/schemas/OrganizationSortProperty" } }, { "type": "null" } ], "description": "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.", "default": [ "created_at" ], "title": "Sorting" }, "description": "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." } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ListResource_Organization_" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-pagination": { "type": "offsetLimit", "inputs": [ { "name": "page", "in": "parameters", "type": "page" }, { "name": "limit", "in": "parameters", "type": "limit" } ], "outputs": { "results": "$.items", "numPages": "$.pagination.max_page" } }, "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "organizations", "x-speakeasy-name-override": "list", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Organizations.List(ctx, nil, polargo.Pointer[int64](1), polargo.Pointer[int64](10), nil)\n if err != nil {\n log.Fatal(err)\n }\n if res.ListResourceOrganization != nil {\n for {\n // handle items\n\n res, err = res.Next()\n\n if err != nil {\n // handle error\n }\n\n if res == nil {\n break\n }\n }\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.organizations.list(page=1, limit=10)\n\n while res is not None:\n # Handle items\n\n res = res.next()" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.organizations.list({});\n\n for await (const page of result) {\n console.log(page);\n }\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n\n\n$responses = $sdk->organizations->list(\n page: 1,\n limit: 10\n\n);\n\n\nforeach ($responses as $response) {\n if ($response->statusCode === 200) {\n // handle response\n }\n}" } ] }, "post": { "tags": [ "organizations", "public" ], "summary": "Create Organization", "description": "Create an organization.\n\n**Scopes**: `organizations:write`", "operationId": "organizations:create", "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/OrganizationCreate" } } } }, "responses": { "201": { "description": "Organization created.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Organization" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "User" ], "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "organizations", "x-speakeasy-name-override": "create", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Organizations.Create(ctx, components.OrganizationCreate{\n Name: \"\",\n Slug: \"\",\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.Organization != nil {\n // handle response\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.organizations.create(request={\n \"name\": \"\",\n \"slug\": \"\",\n })\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.organizations.create({\n name: \"\",\n slug: \"\",\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Components;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n$request = new Components\\OrganizationCreate(\n name: '',\n slug: '',\n);\n\n$response = $sdk->organizations->create(\n request: $request\n);\n\nif ($response->organization !== null) {\n // handle response\n}" } ] } }, "/v1/organizations/{id}": { "get": { "tags": [ "organizations", "public" ], "summary": "Get Organization", "description": "Get an organization by ID.\n\n**Scopes**: `organizations:read` `organizations:write`", "operationId": "organizations:get", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid4", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "description": "The organization ID.", "x-polar-selector-widget": { "resourceRoot": "/v1/organizations", "resourceName": "Organization", "displayProperty": "name" }, "title": "Id" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Organization" } } } }, "404": { "description": "Organization not found.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ResourceNotFound" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "organizations", "x-speakeasy-name-override": "get", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Organizations.Get(ctx, \"1dbfc517-0bbf-4301-9ba8-555ca42b9737\")\n if err != nil {\n log.Fatal(err)\n }\n if res.Organization != nil {\n // handle response\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.organizations.get(id=\"1dbfc517-0bbf-4301-9ba8-555ca42b9737\")\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.organizations.get({\n id: \"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n\n\n$response = $sdk->organizations->get(\n id: '1dbfc517-0bbf-4301-9ba8-555ca42b9737'\n);\n\nif ($response->organization !== null) {\n // handle response\n}" } ] }, "patch": { "tags": [ "organizations", "public" ], "summary": "Update Organization", "description": "Update an organization.\n\n**Scopes**: `organizations:write`", "operationId": "organizations:update", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid4", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "description": "The organization ID.", "x-polar-selector-widget": { "resourceRoot": "/v1/organizations", "resourceName": "Organization", "displayProperty": "name" }, "title": "Id" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/OrganizationUpdate" } } } }, "responses": { "200": { "description": "Organization updated.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Organization" } } } }, "403": { "description": "You don't have the permission to update this organization.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/NotPermitted" } } } }, "404": { "description": "Organization not found.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ResourceNotFound" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "organizations", "x-speakeasy-name-override": "update", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Organizations.Update(ctx, \"1dbfc517-0bbf-4301-9ba8-555ca42b9737\", components.OrganizationUpdate{})\n if err != nil {\n log.Fatal(err)\n }\n if res.Organization != nil {\n // handle response\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.organizations.update(id=\"1dbfc517-0bbf-4301-9ba8-555ca42b9737\", organization_update={})\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.organizations.update({\n id: \"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n organizationUpdate: {},\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Components;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n$organizationUpdate = new Components\\OrganizationUpdate();\n\n$response = $sdk->organizations->update(\n id: '1dbfc517-0bbf-4301-9ba8-555ca42b9737',\n organizationUpdate: $organizationUpdate\n\n);\n\nif ($response->organization !== null) {\n // handle response\n}" } ] } }, "/v1/subscriptions/": { "get": { "tags": [ "subscriptions", "public", "mcp" ], "summary": "List Subscriptions", "description": "List subscriptions.\n\n**Scopes**: `subscriptions:read` `subscriptions:write`", "operationId": "subscriptions:list", "parameters": [ { "name": "organization_id", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string", "format": "uuid4", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "description": "The organization ID.", "x-polar-selector-widget": { "resourceRoot": "/v1/organizations", "resourceName": "Organization", "displayProperty": "name" } }, { "type": "array", "items": { "type": "string", "format": "uuid4", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "description": "The organization ID.", "x-polar-selector-widget": { "resourceRoot": "/v1/organizations", "resourceName": "Organization", "displayProperty": "name" } } }, { "type": "null" } ], "title": "OrganizationID Filter", "description": "Filter by organization ID." }, "description": "Filter by organization ID." }, { "name": "product_id", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string", "format": "uuid4", "description": "The product ID.", "x-polar-selector-widget": { "resourceRoot": "/v1/products", "resourceName": "Product", "displayProperty": "name" } }, { "type": "array", "items": { "type": "string", "format": "uuid4", "description": "The product ID.", "x-polar-selector-widget": { "resourceRoot": "/v1/products", "resourceName": "Product", "displayProperty": "name" } } }, { "type": "null" } ], "title": "ProductID Filter", "description": "Filter by product ID." }, "description": "Filter by product ID." }, { "name": "customer_id", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string", "format": "uuid4", "description": "The customer ID." }, { "type": "array", "items": { "type": "string", "format": "uuid4", "description": "The customer ID." } }, { "type": "null" } ], "title": "CustomerID Filter", "description": "Filter by customer ID." }, "description": "Filter by customer ID." }, { "name": "external_customer_id", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string", "description": "The customer external ID." }, { "type": "array", "items": { "type": "string", "description": "The customer external ID." } }, { "type": "null" } ], "title": "ExternalCustomerID Filter", "description": "Filter by customer external ID." }, "description": "Filter by customer external ID." }, { "name": "discount_id", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string", "format": "uuid4", "description": "The product ID.", "x-polar-selector-widget": { "resourceRoot": "/v1/products", "resourceName": "Product", "displayProperty": "name" } }, { "type": "array", "items": { "type": "string", "format": "uuid4", "description": "The product ID.", "x-polar-selector-widget": { "resourceRoot": "/v1/products", "resourceName": "Product", "displayProperty": "name" } } }, { "type": "null" } ], "title": "DiscountID Filter", "description": "Filter by discount ID." }, "description": "Filter by discount ID." }, { "name": "active", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "description": "Filter by active or inactive subscription.", "title": "Active" }, "description": "Filter by active or inactive subscription." }, { "name": "cancel_at_period_end", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "description": "Filter by subscriptions that are set to cancel at period end.", "title": "Cancel At Period End" }, "description": "Filter by subscriptions that are set to cancel at period end." }, { "name": "page", "in": "query", "required": false, "schema": { "type": "integer", "exclusiveMinimum": 0, "description": "Page number, defaults to 1.", "default": 1, "title": "Page" }, "description": "Page number, defaults to 1." }, { "name": "limit", "in": "query", "required": false, "schema": { "type": "integer", "exclusiveMinimum": 0, "description": "Size of a page, defaults to 10. Maximum is 100.", "default": 10, "title": "Limit" }, "description": "Size of a page, defaults to 10. Maximum is 100." }, { "name": "sorting", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "array", "items": { "$ref": "#/components/schemas/SubscriptionSortProperty" } }, { "type": "null" } ], "description": "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.", "default": [ "-started_at" ], "title": "Sorting" }, "description": "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." }, { "name": "metadata", "in": "query", "required": false, "style": "deepObject", "schema": { "$ref": "#/components/schemas/MetadataQuery" }, "description": "Filter by metadata key-value pairs. It uses the `deepObject` style, e.g. `?metadata[key]=value`." } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ListResource_Subscription_" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-pagination": { "type": "offsetLimit", "inputs": [ { "name": "page", "in": "parameters", "type": "page" }, { "name": "limit", "in": "parameters", "type": "limit" } ], "outputs": { "results": "$.items", "numPages": "$.pagination.max_page" } }, "x-speakeasy-mcp": { "disabled": false, "scopes": [ "read", "subscriptions" ] }, "x-speakeasy-group": "subscriptions", "x-speakeasy-name-override": "list", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Subscriptions.List(ctx, operations.SubscriptionsListRequest{\n OrganizationID: polargo.Pointer(operations.CreateOrganizationIDFilterStr(\n \"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n )),\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.ListResourceSubscription != nil {\n for {\n // handle items\n\n res, err = res.Next()\n\n if err != nil {\n // handle error\n }\n\n if res == nil {\n break\n }\n }\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.subscriptions.list(organization_id=\"1dbfc517-0bbf-4301-9ba8-555ca42b9737\", page=1, limit=10)\n\n while res is not None:\n # Handle items\n\n res = res.next()" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.subscriptions.list({\n organizationId: \"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n });\n\n for await (const page of result) {\n console.log(page);\n }\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Operations;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n$request = new Operations\\SubscriptionsListRequest(\n organizationId: '1dbfc517-0bbf-4301-9ba8-555ca42b9737',\n);\n\n$responses = $sdk->subscriptions->list(\n request: $request\n);\n\n\nforeach ($responses as $response) {\n if ($response->statusCode === 200) {\n // handle response\n }\n}" } ] }, "post": { "tags": [ "subscriptions", "public", "mcp" ], "summary": "Create Subscription", "description": "Create a subscription programmatically.\n\nThis endpoint only allows to create subscription on free products.\nFor paid products, use the checkout flow.\n\nNo initial order will be created and no confirmation email will be sent.\n\n**Scopes**: `subscriptions:write`", "operationId": "subscriptions:create", "requestBody": { "required": true, "content": { "application/json": { "schema": { "anyOf": [ { "$ref": "#/components/schemas/SubscriptionCreateCustomer" }, { "$ref": "#/components/schemas/SubscriptionCreateExternalCustomer" } ], "title": "Subscription Create" } } } }, "responses": { "201": { "description": "Subscription created.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Subscription" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-mcp": { "disabled": false, "scopes": [ "write", "subscriptions" ] }, "x-speakeasy-group": "subscriptions", "x-speakeasy-name-override": "create", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"github.com/polarsource/polar-go/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Subscriptions.Create(ctx, operations.CreateSubscriptionsCreateSubscriptionCreateSubscriptionCreateCustomer(\n components.SubscriptionCreateCustomer{\n ProductID: \"d8dd2de1-21b7-4a41-8bc3-ce909c0cfe23\",\n CustomerID: \"992fae2a-2a17-4b7a-8d9e-e287cf90131b\",\n },\n ))\n if err != nil {\n log.Fatal(err)\n }\n if res.Subscription != nil {\n switch res.Subscription.Discount.Type {\n case components.SubscriptionDiscountTypeDiscountFixedOnceForeverDurationBase:\n // res.Subscription.Discount.DiscountFixedOnceForeverDurationBase is populated\n case components.SubscriptionDiscountTypeDiscountFixedRepeatDurationBase:\n // res.Subscription.Discount.DiscountFixedRepeatDurationBase is populated\n case components.SubscriptionDiscountTypeDiscountPercentageOnceForeverDurationBase:\n // res.Subscription.Discount.DiscountPercentageOnceForeverDurationBase is populated\n case components.SubscriptionDiscountTypeDiscountPercentageRepeatDurationBase:\n // res.Subscription.Discount.DiscountPercentageRepeatDurationBase is populated\n }\n\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.subscriptions.create(request={\n \"product_id\": \"d8dd2de1-21b7-4a41-8bc3-ce909c0cfe23\",\n \"customer_id\": \"992fae2a-2a17-4b7a-8d9e-e287cf90131b\",\n })\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.subscriptions.create({\n productId: \"d8dd2de1-21b7-4a41-8bc3-ce909c0cfe23\",\n customerId: \"992fae2a-2a17-4b7a-8d9e-e287cf90131b\",\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Components;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n$request = new Components\\SubscriptionCreateCustomer(\n productId: 'd8dd2de1-21b7-4a41-8bc3-ce909c0cfe23',\n customerId: '992fae2a-2a17-4b7a-8d9e-e287cf90131b',\n);\n\n$response = $sdk->subscriptions->create(\n request: $request\n);\n\nif ($response->subscription !== null) {\n // handle response\n}" } ] } }, "/v1/subscriptions/export": { "get": { "tags": [ "subscriptions", "public", "mcp" ], "summary": "Export Subscriptions", "description": "Export subscriptions as a CSV file.\n\n**Scopes**: `subscriptions:read` `subscriptions:write`", "operationId": "subscriptions:export", "parameters": [ { "name": "organization_id", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string", "format": "uuid4", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "description": "The organization ID.", "x-polar-selector-widget": { "resourceRoot": "/v1/organizations", "resourceName": "Organization", "displayProperty": "name" } }, { "type": "array", "items": { "type": "string", "format": "uuid4", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "description": "The organization ID.", "x-polar-selector-widget": { "resourceRoot": "/v1/organizations", "resourceName": "Organization", "displayProperty": "name" } } }, { "type": "null" } ], "description": "Filter by organization ID.", "title": "Organization Id" }, "description": "Filter by organization ID." } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} }, "text/csv": { "schema": { "type": "string" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-mcp": { "disabled": false, "scopes": [ "read", "subscriptions" ] }, "x-speakeasy-group": "subscriptions", "x-speakeasy-name-override": "export", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Subscriptions.Export(ctx, polargo.Pointer(operations.CreateOrganizationIDStr(\n \"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n )))\n if err != nil {\n log.Fatal(err)\n }\n if res.Any != nil {\n // handle response\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.subscriptions.export(organization_id=\"1dbfc517-0bbf-4301-9ba8-555ca42b9737\")\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.subscriptions.export({\n organizationId: \"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n\n\n$response = $sdk->subscriptions->export(\n organizationId: '1dbfc517-0bbf-4301-9ba8-555ca42b9737'\n);\n\nif ($response->any !== null) {\n // handle response\n}" } ] } }, "/v1/subscriptions/{id}": { "get": { "tags": [ "subscriptions", "public", "mcp" ], "summary": "Get Subscription", "description": "Get a subscription by ID.\n\n**Scopes**: `subscriptions:read` `subscriptions:write`", "operationId": "subscriptions:get", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid4", "description": "The subscription ID.", "title": "Id" }, "description": "The subscription ID." } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Subscription" } } } }, "404": { "description": "Subscription not found.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ResourceNotFound" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-mcp": { "disabled": false, "scopes": [ "read", "subscriptions" ] }, "x-speakeasy-group": "subscriptions", "x-speakeasy-name-override": "get", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"log\"\n\t\"github.com/polarsource/polar-go/models/components\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Subscriptions.Get(ctx, \"\")\n if err != nil {\n log.Fatal(err)\n }\n if res.Subscription != nil {\n switch res.Subscription.Discount.Type {\n case components.SubscriptionDiscountTypeDiscountFixedOnceForeverDurationBase:\n // res.Subscription.Discount.DiscountFixedOnceForeverDurationBase is populated\n case components.SubscriptionDiscountTypeDiscountFixedRepeatDurationBase:\n // res.Subscription.Discount.DiscountFixedRepeatDurationBase is populated\n case components.SubscriptionDiscountTypeDiscountPercentageOnceForeverDurationBase:\n // res.Subscription.Discount.DiscountPercentageOnceForeverDurationBase is populated\n case components.SubscriptionDiscountTypeDiscountPercentageRepeatDurationBase:\n // res.Subscription.Discount.DiscountPercentageRepeatDurationBase is populated\n }\n\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.subscriptions.get(id=\"\")\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.subscriptions.get({\n id: \"\",\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n\n\n$response = $sdk->subscriptions->get(\n id: ''\n);\n\nif ($response->subscription !== null) {\n // handle response\n}" } ] }, "patch": { "tags": [ "subscriptions", "public", "mcp" ], "summary": "Update Subscription", "description": "Update a subscription.\n\n**Scopes**: `subscriptions:write`", "operationId": "subscriptions:update", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid4", "description": "The subscription ID.", "title": "Id" }, "description": "The subscription ID." } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SubscriptionUpdate" } } } }, "responses": { "200": { "description": "Subscription updated.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Subscription" } } } }, "403": { "description": "Subscription is already canceled or will be at the end of the period.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AlreadyCanceledSubscription" } } } }, "404": { "description": "Subscription not found.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ResourceNotFound" } } } }, "409": { "description": "Subscription is pending an update.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SubscriptionLocked" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-mcp": { "disabled": false, "scopes": [ "write", "subscriptions" ] }, "x-speakeasy-group": "subscriptions", "x-speakeasy-name-override": "update", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Subscriptions.Update(ctx, \"\", components.CreateSubscriptionUpdateSubscriptionUpdateProduct(\n components.SubscriptionUpdateProduct{\n ProductID: \"\",\n },\n ))\n if err != nil {\n log.Fatal(err)\n }\n if res.Subscription != nil {\n switch res.Subscription.Discount.Type {\n case components.SubscriptionDiscountTypeDiscountFixedOnceForeverDurationBase:\n // res.Subscription.Discount.DiscountFixedOnceForeverDurationBase is populated\n case components.SubscriptionDiscountTypeDiscountFixedRepeatDurationBase:\n // res.Subscription.Discount.DiscountFixedRepeatDurationBase is populated\n case components.SubscriptionDiscountTypeDiscountPercentageOnceForeverDurationBase:\n // res.Subscription.Discount.DiscountPercentageOnceForeverDurationBase is populated\n case components.SubscriptionDiscountTypeDiscountPercentageRepeatDurationBase:\n // res.Subscription.Discount.DiscountPercentageRepeatDurationBase is populated\n }\n\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\nfrom polar_sdk.utils import parse_datetime\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.subscriptions.update(id=\"\", subscription_update={\n \"trial_end\": parse_datetime(\"2024-12-03T14:44:14.136Z\"),\n })\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.subscriptions.update({\n id: \"\",\n subscriptionUpdate: {\n productId: \"\",\n },\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Components;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n\n\n$response = $sdk->subscriptions->update(\n id: '',\n subscriptionUpdate: new Components\\SubscriptionUpdateProduct(\n productId: '',\n )\n\n);\n\nif ($response->subscription !== null) {\n // handle response\n}" } ] }, "delete": { "tags": [ "subscriptions", "public", "mcp" ], "summary": "Revoke Subscription", "description": "Revoke a subscription, i.e cancel immediately.\n\n**Scopes**: `subscriptions:write`", "operationId": "subscriptions:revoke", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid4", "description": "The subscription ID.", "title": "Id" }, "description": "The subscription ID." } ], "responses": { "200": { "description": "Subscription revoked.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Subscription" } } } }, "403": { "description": "This subscription is already revoked.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AlreadyCanceledSubscription" } } } }, "404": { "description": "Subscription not found.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ResourceNotFound" } } } }, "409": { "description": "Subscription is pending an update.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SubscriptionLocked" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-mcp": { "disabled": false, "scopes": [ "write", "subscriptions" ] }, "x-speakeasy-group": "subscriptions", "x-speakeasy-name-override": "revoke", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"log\"\n\t\"github.com/polarsource/polar-go/models/components\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Subscriptions.Revoke(ctx, \"\")\n if err != nil {\n log.Fatal(err)\n }\n if res.Subscription != nil {\n switch res.Subscription.Discount.Type {\n case components.SubscriptionDiscountTypeDiscountFixedOnceForeverDurationBase:\n // res.Subscription.Discount.DiscountFixedOnceForeverDurationBase is populated\n case components.SubscriptionDiscountTypeDiscountFixedRepeatDurationBase:\n // res.Subscription.Discount.DiscountFixedRepeatDurationBase is populated\n case components.SubscriptionDiscountTypeDiscountPercentageOnceForeverDurationBase:\n // res.Subscription.Discount.DiscountPercentageOnceForeverDurationBase is populated\n case components.SubscriptionDiscountTypeDiscountPercentageRepeatDurationBase:\n // res.Subscription.Discount.DiscountPercentageRepeatDurationBase is populated\n }\n\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.subscriptions.revoke(id=\"\")\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.subscriptions.revoke({\n id: \"\",\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n\n\n$response = $sdk->subscriptions->revoke(\n id: ''\n);\n\nif ($response->subscription !== null) {\n // handle response\n}" } ] } }, "/v1/oauth2/register": { "post": { "tags": [ "oauth2", "clients", "public" ], "summary": "Create Client", "description": "Create an OAuth2 client.", "operationId": "oauth2:clients:oauth2:create_client", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/OAuth2ClientConfiguration" } } }, "required": true }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Anonymous", "User" ], "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "oauth2.clients", "x-speakeasy-name-override": "create", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Oauth2.Clients.Create(ctx, components.OAuth2ClientConfiguration{\n RedirectUris: []string{\n \"https://impolite-hippodrome.com/\",\n \"https://acidic-tomography.net/\",\n },\n ClientName: \"\",\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.Any != nil {\n // handle response\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.oauth2.clients.create(request={\n \"redirect_uris\": [\n \"https://impolite-hippodrome.com/\",\n \"https://acidic-tomography.net/\",\n ],\n \"client_name\": \"\",\n })\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.oauth2.clients.create({\n redirectUris: [\n \"https://impolite-hippodrome.com/\",\n \"https://acidic-tomography.net/\",\n ],\n clientName: \"\",\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Components;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n$request = new Components\\OAuth2ClientConfiguration(\n redirectUris: [\n 'https://impolite-hippodrome.com/',\n 'https://acidic-tomography.net/',\n ],\n clientName: '',\n);\n\n$response = $sdk->oauth2->clients->create(\n request: $request\n);\n\nif ($response->any !== null) {\n // handle response\n}" } ] } }, "/v1/oauth2/register/{client_id}": { "get": { "tags": [ "oauth2", "clients", "public" ], "summary": "Get Client", "description": "Get an OAuth2 client by Client ID.", "operationId": "oauth2:clients:oauth2:get_client", "parameters": [ { "name": "client_id", "in": "path", "required": true, "schema": { "type": "string", "title": "Client Id" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Anonymous", "User" ], "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "oauth2.clients", "x-speakeasy-name-override": "get", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Oauth2.Clients.Get(ctx, \"\")\n if err != nil {\n log.Fatal(err)\n }\n if res.Any != nil {\n // handle response\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.oauth2.clients.get(client_id=\"\")\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.oauth2.clients.get({\n clientId: \"\",\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n\n\n$response = $sdk->oauth2->clients->get(\n clientId: ''\n);\n\nif ($response->any !== null) {\n // handle response\n}" } ] }, "put": { "tags": [ "oauth2", "clients", "public" ], "summary": "Update Client", "description": "Update an OAuth2 client.", "operationId": "oauth2:clients:oauth2:update_client", "parameters": [ { "name": "client_id", "in": "path", "required": true, "schema": { "type": "string", "title": "Client Id" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/OAuth2ClientConfigurationUpdate" } } } }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Anonymous", "User" ], "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "oauth2.clients", "x-speakeasy-name-override": "update", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Oauth2.Clients.Update(ctx, \"\", components.OAuth2ClientConfigurationUpdate{\n RedirectUris: []string{\n \"https://classic-cantaloupe.org\",\n \"https://corrupt-status.biz/\",\n },\n ClientName: \"\",\n ClientID: \"\",\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.Any != nil {\n // handle response\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.oauth2.clients.update(client_id=\"\", o_auth2_client_configuration_update={\n \"redirect_uris\": [\n \"https://classic-cantaloupe.org\",\n \"https://corrupt-status.biz/\",\n ],\n \"client_name\": \"\",\n \"client_id\": \"\",\n })\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.oauth2.clients.update({\n clientId: \"\",\n oAuth2ClientConfigurationUpdate: {\n redirectUris: [\n \"https://classic-cantaloupe.org\",\n \"https://corrupt-status.biz/\",\n ],\n clientName: \"\",\n clientId: \"\",\n },\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Components;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n$oAuth2ClientConfigurationUpdate = new Components\\OAuth2ClientConfigurationUpdate(\n redirectUris: [\n 'https://classic-cantaloupe.org',\n 'https://corrupt-status.biz/',\n ],\n clientName: '',\n clientId: '',\n);\n\n$response = $sdk->oauth2->clients->update(\n clientId: '',\n oAuth2ClientConfigurationUpdate: $oAuth2ClientConfigurationUpdate\n\n);\n\nif ($response->any !== null) {\n // handle response\n}" } ] }, "delete": { "tags": [ "oauth2", "clients", "public" ], "summary": "Delete Client", "description": "Delete an OAuth2 client.", "operationId": "oauth2:clients:oauth2:delete_client", "parameters": [ { "name": "client_id", "in": "path", "required": true, "schema": { "type": "string", "title": "Client Id" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Anonymous", "User" ], "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "oauth2.clients", "x-speakeasy-name-override": "delete", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Oauth2.Clients.Delete(ctx, \"\")\n if err != nil {\n log.Fatal(err)\n }\n if res.Any != nil {\n // handle response\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.oauth2.clients.delete(client_id=\"\")\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.oauth2.clients.delete({\n clientId: \"\",\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n\n\n$response = $sdk->oauth2->clients->delete(\n clientId: ''\n);\n\nif ($response->any !== null) {\n // handle response\n}" } ] } }, "/v1/oauth2/authorize": { "get": { "tags": [ "oauth2", "public" ], "summary": "Authorize", "operationId": "oauth2:authorize", "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "oneOf": [ { "$ref": "#/components/schemas/AuthorizeResponseUser" }, { "$ref": "#/components/schemas/AuthorizeResponseOrganization" } ], "title": "Response Oauth2:Authorize", "discriminator": { "propertyName": "sub_type", "mapping": { "user": "#/components/schemas/AuthorizeResponseUser", "organization": "#/components/schemas/AuthorizeResponseOrganization" } } } } } } }, "x-polar-allowed-subjects": [ "Anonymous", "User" ], "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "oauth2", "x-speakeasy-name-override": "authorize", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"log\"\n\t\"github.com/polarsource/polar-go/models/operations\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Oauth2.Authorize(ctx)\n if err != nil {\n log.Fatal(err)\n }\n if res.ResponseOauth2Authorize != nil {\n switch res.ResponseOauth2Authorize.Type {\n case operations.Oauth2AuthorizeResponseOauth2AuthorizeTypeUser:\n // res.ResponseOauth2Authorize.AuthorizeResponseUser is populated\n case operations.Oauth2AuthorizeResponseOauth2AuthorizeTypeOrganization:\n // res.ResponseOauth2Authorize.AuthorizeResponseOrganization is populated\n }\n\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.oauth2.authorize()\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.oauth2.authorize();\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n\n\n$response = $sdk->oauth2->authorize(\n\n);\n\nif ($response->responseOauth2Authorize !== null) {\n // handle response\n}" } ] } }, "/v1/oauth2/token": { "post": { "tags": [ "oauth2", "public" ], "summary": "Request Token", "description": "Request an access token using a valid grant.", "operationId": "oauth2:request_token", "requestBody": { "content": { "application/x-www-form-urlencoded": { "schema": { "oneOf": [ { "$ref": "#/components/schemas/AuthorizationCodeTokenRequest" }, { "$ref": "#/components/schemas/RefreshTokenRequest" }, { "$ref": "#/components/schemas/WebTokenRequest" } ] } } }, "required": true }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/TokenResponse" } } } } }, "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "oauth2", "x-speakeasy-name-override": "token", "security": [ {} ], "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"github.com/polarsource/polar-go/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New()\n\n res, err := s.Oauth2.Token(ctx, operations.CreateOauth2RequestTokenRequestBodyAuthorizationCodeTokenRequest(\n components.AuthorizationCodeTokenRequest{\n ClientID: \"\",\n ClientSecret: \"\",\n Code: \"\",\n RedirectURI: \"https://memorable-season.name\",\n },\n ))\n if err != nil {\n log.Fatal(err)\n }\n if res.TokenResponse != nil {\n // handle response\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar() as polar:\n\n res = polar.oauth2.token(request={\n \"grant_type\": \"authorization_code\",\n \"client_id\": \"\",\n \"client_secret\": \"\",\n \"code\": \"\",\n \"redirect_uri\": \"https://memorable-season.name\",\n })\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar();\n\nasync function run() {\n const result = await polar.oauth2.token({\n grantType: \"authorization_code\",\n clientId: \"\",\n clientSecret: \"\",\n code: \"\",\n redirectUri: \"https://memorable-season.name\",\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Components;\n\n$sdk = Polar\\Polar::builder()->build();\n\n$request = new Components\\AuthorizationCodeTokenRequest(\n clientId: '',\n clientSecret: '',\n code: '',\n redirectUri: 'https://memorable-season.name',\n);\n\n$response = $sdk->oauth2->token(\n request: $request\n);\n\nif ($response->tokenResponse !== null) {\n // handle response\n}" } ] } }, "/v1/oauth2/revoke": { "post": { "tags": [ "oauth2", "public" ], "summary": "Revoke Token", "description": "Revoke an access token or a refresh token.", "operationId": "oauth2:revoke_token", "requestBody": { "content": { "application/x-www-form-urlencoded": { "schema": { "$ref": "#/components/schemas/RevokeTokenRequest" } } }, "required": true }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/RevokeTokenResponse" } } } } }, "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "oauth2", "x-speakeasy-name-override": "revoke", "security": [ {} ], "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New()\n\n res, err := s.Oauth2.Revoke(ctx, components.RevokeTokenRequest{\n Token: \"\",\n ClientID: \"\",\n ClientSecret: \"\",\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.RevokeTokenResponse != nil {\n // handle response\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar() as polar:\n\n res = polar.oauth2.revoke(request={\n \"token\": \"\",\n \"client_id\": \"\",\n \"client_secret\": \"\",\n })\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar();\n\nasync function run() {\n const result = await polar.oauth2.revoke({\n token: \"\",\n clientId: \"\",\n clientSecret: \"\",\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Components;\n\n$sdk = Polar\\Polar::builder()->build();\n\n$request = new Components\\RevokeTokenRequest(\n token: '',\n clientId: '',\n clientSecret: '',\n);\n\n$response = $sdk->oauth2->revoke(\n request: $request\n);\n\nif ($response->revokeTokenResponse !== null) {\n // handle response\n}" } ] } }, "/v1/oauth2/introspect": { "post": { "tags": [ "oauth2", "public" ], "summary": "Introspect Token", "description": "Get information about an access token.", "operationId": "oauth2:introspect_token", "requestBody": { "content": { "application/x-www-form-urlencoded": { "schema": { "$ref": "#/components/schemas/IntrospectTokenRequest" } } }, "required": true }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/IntrospectTokenResponse" } } } } }, "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "oauth2", "x-speakeasy-name-override": "introspect", "security": [ {} ], "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New()\n\n res, err := s.Oauth2.Introspect(ctx, components.IntrospectTokenRequest{\n Token: \"\",\n ClientID: \"\",\n ClientSecret: \"\",\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.IntrospectTokenResponse != nil {\n // handle response\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar() as polar:\n\n res = polar.oauth2.introspect(request={\n \"token\": \"\",\n \"client_id\": \"\",\n \"client_secret\": \"\",\n })\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar();\n\nasync function run() {\n const result = await polar.oauth2.introspect({\n token: \"\",\n clientId: \"\",\n clientSecret: \"\",\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Components;\n\n$sdk = Polar\\Polar::builder()->build();\n\n$request = new Components\\IntrospectTokenRequest(\n token: '',\n clientId: '',\n clientSecret: '',\n);\n\n$response = $sdk->oauth2->introspect(\n request: $request\n);\n\nif ($response->introspectTokenResponse !== null) {\n // handle response\n}" } ] } }, "/v1/oauth2/userinfo": { "get": { "tags": [ "oauth2", "public" ], "summary": "Get User Info", "description": "Get information about the authenticated user.", "operationId": "oauth2:userinfo", "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "anyOf": [ { "$ref": "#/components/schemas/UserInfoUser" }, { "$ref": "#/components/schemas/UserInfoOrganization" } ], "title": "Response Oauth2:Userinfo" } } } } }, "x-speakeasy-name-override": "userinfo", "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "oauth2", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"log\"\n\t\"github.com/polarsource/polar-go/models/operations\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Oauth2.Userinfo(ctx)\n if err != nil {\n log.Fatal(err)\n }\n if res.ResponseOauth2Userinfo != nil {\n switch res.ResponseOauth2Userinfo.Type {\n case operations.Oauth2UserinfoResponseOauth2UserinfoTypeUserInfoUser:\n // res.ResponseOauth2Userinfo.UserInfoUser is populated\n case operations.Oauth2UserinfoResponseOauth2UserinfoTypeUserInfoOrganization:\n // res.ResponseOauth2Userinfo.UserInfoOrganization is populated\n }\n\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.oauth2.userinfo()\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.oauth2.userinfo();\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n\n\n$response = $sdk->oauth2->userinfo(\n\n);\n\nif ($response->responseOauth2Userinfo !== null) {\n // handle response\n}" } ] } }, "/v1/benefits/": { "get": { "tags": [ "benefits", "public" ], "summary": "List Benefits", "description": "List benefits.\n\n**Scopes**: `benefits:read` `benefits:write`", "operationId": "benefits:list", "parameters": [ { "name": "organization_id", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string", "format": "uuid4", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "description": "The organization ID.", "x-polar-selector-widget": { "resourceRoot": "/v1/organizations", "resourceName": "Organization", "displayProperty": "name" } }, { "type": "array", "items": { "type": "string", "format": "uuid4", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "description": "The organization ID.", "x-polar-selector-widget": { "resourceRoot": "/v1/organizations", "resourceName": "Organization", "displayProperty": "name" } } }, { "type": "null" } ], "title": "OrganizationID Filter", "description": "Filter by organization ID." }, "description": "Filter by organization ID." }, { "name": "type", "in": "query", "required": false, "schema": { "anyOf": [ { "$ref": "#/components/schemas/BenefitType" }, { "type": "array", "items": { "$ref": "#/components/schemas/BenefitType" } }, { "type": "null" } ], "title": "BenefitType Filter", "description": "Filter by benefit type." }, "description": "Filter by benefit type.", "x-speakeasy-name-override": "type_filter" }, { "name": "id", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string", "format": "uuid4", "description": "The benefit ID.", "x-polar-selector-widget": { "resourceRoot": "/v1/benefits", "resourceName": "Benefit", "displayProperty": "description" } }, { "type": "array", "items": { "type": "string", "format": "uuid4", "description": "The benefit ID.", "x-polar-selector-widget": { "resourceRoot": "/v1/benefits", "resourceName": "Benefit", "displayProperty": "description" } } }, { "type": "null" } ], "title": "Filter IDs", "description": "Filter by benefit IDs." }, "description": "Filter by benefit IDs." }, { "name": "exclude_id", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string", "format": "uuid4", "description": "The benefit ID.", "x-polar-selector-widget": { "resourceRoot": "/v1/benefits", "resourceName": "Benefit", "displayProperty": "description" } }, { "type": "array", "items": { "type": "string", "format": "uuid4", "description": "The benefit ID.", "x-polar-selector-widget": { "resourceRoot": "/v1/benefits", "resourceName": "Benefit", "displayProperty": "description" } } }, { "type": "null" } ], "title": "Exclude IDs", "description": "Exclude benefits with these IDs." }, "description": "Exclude benefits with these IDs." }, { "name": "query", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Query", "description": "Filter by description." }, "description": "Filter by description." }, { "name": "page", "in": "query", "required": false, "schema": { "type": "integer", "exclusiveMinimum": 0, "description": "Page number, defaults to 1.", "default": 1, "title": "Page" }, "description": "Page number, defaults to 1." }, { "name": "limit", "in": "query", "required": false, "schema": { "type": "integer", "exclusiveMinimum": 0, "description": "Size of a page, defaults to 10. Maximum is 100.", "default": 10, "title": "Limit" }, "description": "Size of a page, defaults to 10. Maximum is 100." }, { "name": "sorting", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "array", "items": { "$ref": "#/components/schemas/BenefitSortProperty" } }, { "type": "null" } ], "description": "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.", "default": [ "-created_at" ], "title": "Sorting" }, "description": "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." }, { "name": "metadata", "in": "query", "required": false, "style": "deepObject", "schema": { "$ref": "#/components/schemas/MetadataQuery" }, "description": "Filter by metadata key-value pairs. It uses the `deepObject` style, e.g. `?metadata[key]=value`." } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ListResource_Benefit_" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-pagination": { "type": "offsetLimit", "inputs": [ { "name": "page", "in": "parameters", "type": "page" }, { "name": "limit", "in": "parameters", "type": "limit" } ], "outputs": { "results": "$.items", "numPages": "$.pagination.max_page" } }, "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "benefits", "x-speakeasy-name-override": "list", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Benefits.List(ctx, operations.BenefitsListRequest{\n OrganizationID: polargo.Pointer(operations.CreateQueryParamOrganizationIDFilterStr(\n \"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n )),\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.ListResourceBenefit != nil {\n for {\n // handle items\n\n res, err = res.Next()\n\n if err != nil {\n // handle error\n }\n\n if res == nil {\n break\n }\n }\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.benefits.list(organization_id=\"1dbfc517-0bbf-4301-9ba8-555ca42b9737\", page=1, limit=10)\n\n while res is not None:\n # Handle items\n\n res = res.next()" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.benefits.list({\n organizationId: \"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n });\n\n for await (const page of result) {\n console.log(page);\n }\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Operations;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n$request = new Operations\\BenefitsListRequest(\n organizationId: '1dbfc517-0bbf-4301-9ba8-555ca42b9737',\n);\n\n$responses = $sdk->benefits->list(\n request: $request\n);\n\n\nforeach ($responses as $response) {\n if ($response->statusCode === 200) {\n // handle response\n }\n}" } ] }, "post": { "tags": [ "benefits", "public" ], "summary": "Create Benefit", "description": "Create a benefit.\n\n**Scopes**: `benefits:write`", "operationId": "benefits:create", "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/BenefitCreate" } } } }, "responses": { "201": { "description": "Benefit created.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Benefit", "title": "Benefit" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "benefits", "x-speakeasy-name-override": "create", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Benefits.Create(ctx, components.CreateBenefitCreateLicenseKeys(\n components.BenefitLicenseKeysCreate{\n Description: \"mature emergent at outside arrogantly gadzooks zealous equatorial notwithstanding\",\n OrganizationID: polargo.Pointer(\"1dbfc517-0bbf-4301-9ba8-555ca42b9737\"),\n Properties: components.BenefitLicenseKeysCreateProperties{},\n },\n ))\n if err != nil {\n log.Fatal(err)\n }\n if res.Benefit != nil {\n switch res.Benefit.Type {\n case components.BenefitUnionTypeCustom:\n // res.Benefit.BenefitCustom is populated\n case components.BenefitUnionTypeDiscord:\n // res.Benefit.BenefitDiscord is populated\n case components.BenefitUnionTypeDownloadables:\n // res.Benefit.BenefitDownloadables is populated\n case components.BenefitUnionTypeGithubRepository:\n // res.Benefit.BenefitGitHubRepository is populated\n case components.BenefitUnionTypeLicenseKeys:\n // res.Benefit.BenefitLicenseKeys is populated\n case components.BenefitUnionTypeMeterCredit:\n // res.Benefit.BenefitMeterCredit is populated\n }\n\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.benefits.create(request={\n \"type\": \"license_keys\",\n \"description\": \"mature emergent at outside arrogantly gadzooks zealous equatorial notwithstanding\",\n \"properties\": {},\n })\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.benefits.create({\n type: \"license_keys\",\n description: \"mature emergent at outside arrogantly gadzooks zealous equatorial notwithstanding\",\n organizationId: \"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n properties: {},\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Components;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n$request = new Components\\BenefitLicenseKeysCreate(\n description: 'mature emergent at outside arrogantly gadzooks zealous equatorial notwithstanding',\n organizationId: '1dbfc517-0bbf-4301-9ba8-555ca42b9737',\n properties: new Components\\BenefitLicenseKeysCreateProperties(),\n);\n\n$response = $sdk->benefits->create(\n request: $request\n);\n\nif ($response->benefit !== null) {\n // handle response\n}" } ] } }, "/v1/benefits/{id}": { "get": { "tags": [ "benefits", "public" ], "summary": "Get Benefit", "description": "Get a benefit by ID.\n\n**Scopes**: `benefits:read` `benefits:write`", "operationId": "benefits:get", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid4", "description": "The benefit ID.", "x-polar-selector-widget": { "resourceRoot": "/v1/benefits", "resourceName": "Benefit", "displayProperty": "description" }, "title": "Id" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Benefit", "title": "Benefit" } } } }, "404": { "description": "Benefit not found.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ResourceNotFound" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "benefits", "x-speakeasy-name-override": "get", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"log\"\n\t\"github.com/polarsource/polar-go/models/components\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Benefits.Get(ctx, \"\")\n if err != nil {\n log.Fatal(err)\n }\n if res.Benefit != nil {\n switch res.Benefit.Type {\n case components.BenefitUnionTypeCustom:\n // res.Benefit.BenefitCustom is populated\n case components.BenefitUnionTypeDiscord:\n // res.Benefit.BenefitDiscord is populated\n case components.BenefitUnionTypeDownloadables:\n // res.Benefit.BenefitDownloadables is populated\n case components.BenefitUnionTypeGithubRepository:\n // res.Benefit.BenefitGitHubRepository is populated\n case components.BenefitUnionTypeLicenseKeys:\n // res.Benefit.BenefitLicenseKeys is populated\n case components.BenefitUnionTypeMeterCredit:\n // res.Benefit.BenefitMeterCredit is populated\n }\n\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.benefits.get(id=\"\")\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.benefits.get({\n id: \"\",\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n\n\n$response = $sdk->benefits->get(\n id: ''\n);\n\nif ($response->benefit !== null) {\n // handle response\n}" } ] }, "patch": { "tags": [ "benefits", "public" ], "summary": "Update Benefit", "description": "Update a benefit.\n\n**Scopes**: `benefits:write`", "operationId": "benefits:update", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid4", "description": "The benefit ID.", "x-polar-selector-widget": { "resourceRoot": "/v1/benefits", "resourceName": "Benefit", "displayProperty": "description" }, "title": "Id" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "anyOf": [ { "$ref": "#/components/schemas/BenefitCustomUpdate" }, { "$ref": "#/components/schemas/BenefitDiscordUpdate" }, { "$ref": "#/components/schemas/BenefitGitHubRepositoryUpdate" }, { "$ref": "#/components/schemas/BenefitDownloadablesUpdate" }, { "$ref": "#/components/schemas/BenefitLicenseKeysUpdate" }, { "$ref": "#/components/schemas/BenefitMeterCreditUpdate" }, { "$ref": "#/components/schemas/BenefitFeatureFlagUpdate" } ], "title": "Benefit Update" } } } }, "responses": { "200": { "description": "Benefit updated.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Benefit", "title": "Benefit" } } } }, "404": { "description": "Benefit not found.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ResourceNotFound" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "benefits", "x-speakeasy-name-override": "update", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"github.com/polarsource/polar-go/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Benefits.Update(ctx, \"\", operations.CreateBenefitsUpdateBenefitUpdateBenefitCustomUpdate(\n components.BenefitCustomUpdate{},\n ))\n if err != nil {\n log.Fatal(err)\n }\n if res.Benefit != nil {\n switch res.Benefit.Type {\n case components.BenefitUnionTypeCustom:\n // res.Benefit.BenefitCustom is populated\n case components.BenefitUnionTypeDiscord:\n // res.Benefit.BenefitDiscord is populated\n case components.BenefitUnionTypeDownloadables:\n // res.Benefit.BenefitDownloadables is populated\n case components.BenefitUnionTypeGithubRepository:\n // res.Benefit.BenefitGitHubRepository is populated\n case components.BenefitUnionTypeLicenseKeys:\n // res.Benefit.BenefitLicenseKeys is populated\n case components.BenefitUnionTypeMeterCredit:\n // res.Benefit.BenefitMeterCredit is populated\n }\n\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.benefits.update(id=\"\", request_body={\n \"type\": \"meter_credit\",\n })\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.benefits.update({\n id: \"\",\n requestBody: {\n type: \"custom\",\n },\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Components;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n\n\n$response = $sdk->benefits->update(\n id: '',\n requestBody: new Components\\BenefitCustomUpdate()\n\n);\n\nif ($response->benefit !== null) {\n // handle response\n}" } ] }, "delete": { "tags": [ "benefits", "public" ], "summary": "Delete Benefit", "description": "Delete a benefit.\n\n> [!WARNING]\n> Every grants associated with the benefit will be revoked.\n> Users will lose access to the benefit.\n\n**Scopes**: `benefits:write`", "operationId": "benefits:delete", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid4", "description": "The benefit ID.", "x-polar-selector-widget": { "resourceRoot": "/v1/benefits", "resourceName": "Benefit", "displayProperty": "description" }, "title": "Id" } } ], "responses": { "204": { "description": "Benefit deleted." }, "403": { "description": "This benefit is not deletable.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/NotPermitted" } } } }, "404": { "description": "Benefit not found.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ResourceNotFound" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "benefits", "x-speakeasy-name-override": "delete", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Benefits.Delete(ctx, \"\")\n if err != nil {\n log.Fatal(err)\n }\n if res != nil {\n // handle response\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n polar.benefits.delete(id=\"\")\n\n # Use the SDK ..." }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n await polar.benefits.delete({\n id: \"\",\n });\n\n\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n\n\n$response = $sdk->benefits->delete(\n id: ''\n);\n\nif ($response->statusCode === 200) {\n // handle response\n}" } ] } }, "/v1/benefits/{id}/grants": { "get": { "tags": [ "benefits", "public" ], "summary": "List Benefit Grants", "description": "List the individual grants for a benefit.\n\nIt's especially useful to check if a user has been granted a benefit.\n\n**Scopes**: `benefits:read` `benefits:write`", "operationId": "benefits:grants", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid4", "description": "The benefit ID.", "x-polar-selector-widget": { "resourceRoot": "/v1/benefits", "resourceName": "Benefit", "displayProperty": "description" }, "title": "Id" } }, { "name": "is_granted", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "description": "Filter by granted status. If `true`, only granted benefits will be returned. If `false`, only revoked benefits will be returned. ", "title": "Is Granted" }, "description": "Filter by granted status. If `true`, only granted benefits will be returned. If `false`, only revoked benefits will be returned. " }, { "name": "customer_id", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string", "format": "uuid4", "description": "The customer ID." }, { "type": "array", "items": { "type": "string", "format": "uuid4", "description": "The customer ID." } }, { "type": "null" } ], "title": "CustomerID Filter", "description": "Filter by customer." }, "description": "Filter by customer." }, { "name": "member_id", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "array", "items": { "type": "string", "format": "uuid4" } }, { "type": "null" } ], "title": "MemberID Filter", "description": "Filter by member." }, "description": "Filter by member." }, { "name": "page", "in": "query", "required": false, "schema": { "type": "integer", "exclusiveMinimum": 0, "description": "Page number, defaults to 1.", "default": 1, "title": "Page" }, "description": "Page number, defaults to 1." }, { "name": "limit", "in": "query", "required": false, "schema": { "type": "integer", "exclusiveMinimum": 0, "description": "Size of a page, defaults to 10. Maximum is 100.", "default": 10, "title": "Limit" }, "description": "Size of a page, defaults to 10. Maximum is 100." } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ListResource_BenefitGrant_" } } } }, "404": { "description": "Benefit not found.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ResourceNotFound" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-pagination": { "type": "offsetLimit", "inputs": [ { "name": "page", "in": "parameters", "type": "page" }, { "name": "limit", "in": "parameters", "type": "limit" } ], "outputs": { "results": "$.items", "numPages": "$.pagination.max_page" } }, "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "benefits", "x-speakeasy-name-override": "grants", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Benefits.Grants(ctx, operations.BenefitsGrantsRequest{\n ID: \"\",\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.ListResourceBenefitGrant != nil {\n for {\n // handle items\n\n res, err = res.Next()\n\n if err != nil {\n // handle error\n }\n\n if res == nil {\n break\n }\n }\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.benefits.grants(id=\"\", page=1, limit=10)\n\n while res is not None:\n # Handle items\n\n res = res.next()" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.benefits.grants({\n id: \"\",\n });\n\n for await (const page of result) {\n console.log(page);\n }\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Operations;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n$request = new Operations\\BenefitsGrantsRequest(\n id: '',\n);\n\n$responses = $sdk->benefits->grants(\n request: $request\n);\n\n\nforeach ($responses as $response) {\n if ($response->statusCode === 200) {\n // handle response\n }\n}" } ] } }, "/v1/benefit-grants/": { "get": { "tags": [ "benefit-grants", "public" ], "summary": "List Benefit Grants", "description": "List benefit grants across all benefits for the authenticated organization.\n\n**Scopes**: `benefits:read` `benefits:write`", "operationId": "benefit-grants:list", "parameters": [ { "name": "organization_id", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string", "format": "uuid4", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "description": "The organization ID.", "x-polar-selector-widget": { "resourceRoot": "/v1/organizations", "resourceName": "Organization", "displayProperty": "name" } }, { "type": "array", "items": { "type": "string", "format": "uuid4", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "description": "The organization ID.", "x-polar-selector-widget": { "resourceRoot": "/v1/organizations", "resourceName": "Organization", "displayProperty": "name" } } }, { "type": "null" } ], "title": "OrganizationID Filter", "description": "Filter by organization ID." }, "description": "Filter by organization ID." }, { "name": "customer_id", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string", "format": "uuid4", "description": "The customer ID." }, { "type": "array", "items": { "type": "string", "format": "uuid4", "description": "The customer ID." } }, { "type": "null" } ], "title": "CustomerID Filter", "description": "Filter by customer ID." }, "description": "Filter by customer ID." }, { "name": "external_customer_id", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string", "description": "The customer external ID." }, { "type": "array", "items": { "type": "string", "description": "The customer external ID." } }, { "type": "null" } ], "title": "ExternalCustomerID Filter", "description": "Filter by customer external ID." }, "description": "Filter by customer external ID." }, { "name": "is_granted", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "description": "Filter by granted status. If `true`, only granted benefits will be returned. If `false`, only revoked benefits will be returned. ", "title": "Is Granted" }, "description": "Filter by granted status. If `true`, only granted benefits will be returned. If `false`, only revoked benefits will be returned. " }, { "name": "page", "in": "query", "required": false, "schema": { "type": "integer", "exclusiveMinimum": 0, "description": "Page number, defaults to 1.", "default": 1, "title": "Page" }, "description": "Page number, defaults to 1." }, { "name": "limit", "in": "query", "required": false, "schema": { "type": "integer", "exclusiveMinimum": 0, "description": "Size of a page, defaults to 10. Maximum is 100.", "default": 10, "title": "Limit" }, "description": "Size of a page, defaults to 10. Maximum is 100." }, { "name": "sorting", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "array", "items": { "$ref": "#/components/schemas/BenefitGrantSortProperty" } }, { "type": "null" } ], "description": "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.", "default": [ "-created_at" ], "title": "Sorting" }, "description": "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." } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ListResource_BenefitGrant_" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-pagination": { "type": "offsetLimit", "inputs": [ { "name": "page", "in": "parameters", "type": "page" }, { "name": "limit", "in": "parameters", "type": "limit" } ], "outputs": { "results": "$.items", "numPages": "$.pagination.max_page" } }, "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "benefit-grants", "x-speakeasy-name-override": "list", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.BenefitGrants.List(ctx, operations.BenefitGrantsListRequest{\n OrganizationID: polargo.Pointer(operations.CreateBenefitGrantsListQueryParamOrganizationIDFilterStr(\n \"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n )),\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.ListResourceBenefitGrant != nil {\n for {\n // handle items\n\n res, err = res.Next()\n\n if err != nil {\n // handle error\n }\n\n if res == nil {\n break\n }\n }\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.benefit_grants.list(organization_id=\"1dbfc517-0bbf-4301-9ba8-555ca42b9737\", page=1, limit=10)\n\n while res is not None:\n # Handle items\n\n res = res.next()" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.benefitGrants.list({\n organizationId: \"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n });\n\n for await (const page of result) {\n console.log(page);\n }\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Operations;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n$request = new Operations\\BenefitGrantsListRequest(\n organizationId: '1dbfc517-0bbf-4301-9ba8-555ca42b9737',\n);\n\n$responses = $sdk->benefitGrants->list(\n request: $request\n);\n\n\nforeach ($responses as $response) {\n if ($response->statusCode === 200) {\n // handle response\n }\n}" } ] } }, "/v1/webhooks/endpoints": { "get": { "tags": [ "webhooks", "public" ], "summary": "List Webhook Endpoints", "description": "List webhook endpoints.\n\n**Scopes**: `webhooks:read` `webhooks:write`", "operationId": "webhooks:list_webhook_endpoints", "parameters": [ { "name": "organization_id", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string", "format": "uuid4", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "description": "The organization ID.", "x-polar-selector-widget": { "resourceRoot": "/v1/organizations", "resourceName": "Organization", "displayProperty": "name" } }, { "type": "array", "items": { "type": "string", "format": "uuid4", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "description": "The organization ID.", "x-polar-selector-widget": { "resourceRoot": "/v1/organizations", "resourceName": "Organization", "displayProperty": "name" } } }, { "type": "null" } ], "description": "Filter by organization ID.", "title": "Organization Id" }, "description": "Filter by organization ID." }, { "name": "page", "in": "query", "required": false, "schema": { "type": "integer", "exclusiveMinimum": 0, "description": "Page number, defaults to 1.", "default": 1, "title": "Page" }, "description": "Page number, defaults to 1." }, { "name": "limit", "in": "query", "required": false, "schema": { "type": "integer", "exclusiveMinimum": 0, "description": "Size of a page, defaults to 10. Maximum is 100.", "default": 10, "title": "Limit" }, "description": "Size of a page, defaults to 10. Maximum is 100." } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ListResource_WebhookEndpoint_" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-pagination": { "type": "offsetLimit", "inputs": [ { "name": "page", "in": "parameters", "type": "page" }, { "name": "limit", "in": "parameters", "type": "limit" } ], "outputs": { "results": "$.items", "numPages": "$.pagination.max_page" } }, "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "webhooks", "x-speakeasy-name-override": "list_webhook_endpoints", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Webhooks.ListWebhookEndpoints(ctx, polargo.Pointer(operations.CreateQueryParamOrganizationIDStr(\n \"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n )), polargo.Pointer[int64](1), polargo.Pointer[int64](10))\n if err != nil {\n log.Fatal(err)\n }\n if res.ListResourceWebhookEndpoint != nil {\n for {\n // handle items\n\n res, err = res.Next()\n\n if err != nil {\n // handle error\n }\n\n if res == nil {\n break\n }\n }\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.webhooks.list_webhook_endpoints(organization_id=\"1dbfc517-0bbf-4301-9ba8-555ca42b9737\", page=1, limit=10)\n\n while res is not None:\n # Handle items\n\n res = res.next()" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.webhooks.listWebhookEndpoints({\n organizationId: \"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n });\n\n for await (const page of result) {\n console.log(page);\n }\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n\n\n$responses = $sdk->webhooks->listWebhookEndpoints(\n organizationId: '1dbfc517-0bbf-4301-9ba8-555ca42b9737',\n page: 1,\n limit: 10\n\n);\n\n\nforeach ($responses as $response) {\n if ($response->statusCode === 200) {\n // handle response\n }\n}" } ] }, "post": { "tags": [ "webhooks", "public" ], "summary": "Create Webhook Endpoint", "description": "Create a webhook endpoint.\n\n**Scopes**: `webhooks:write`", "operationId": "webhooks:create_webhook_endpoint", "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/WebhookEndpointCreate" } } } }, "responses": { "201": { "description": "Webhook endpoint created.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/WebhookEndpoint" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "webhooks", "x-speakeasy-name-override": "create_webhook_endpoint", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Webhooks.CreateWebhookEndpoint(ctx, components.WebhookEndpointCreate{\n URL: \"https://webhook.site/cb791d80-f26e-4f8c-be88-6e56054192b0\",\n Format: components.WebhookFormatSlack,\n Events: []components.WebhookEventType{\n components.WebhookEventTypeSubscriptionUncanceled,\n },\n OrganizationID: polargo.Pointer(\"1dbfc517-0bbf-4301-9ba8-555ca42b9737\"),\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.WebhookEndpoint != nil {\n // handle response\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "import polar_sdk\nfrom polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.webhooks.create_webhook_endpoint(request={\n \"url\": \"https://webhook.site/cb791d80-f26e-4f8c-be88-6e56054192b0\",\n \"format_\": polar_sdk.WebhookFormat.SLACK,\n \"events\": [\n polar_sdk.WebhookEventType.SUBSCRIPTION_ACTIVE,\n ],\n \"organization_id\": \"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n })\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.webhooks.createWebhookEndpoint({\n url: \"https://webhook.site/cb791d80-f26e-4f8c-be88-6e56054192b0\",\n format: \"slack\",\n events: [\n \"subscription.uncanceled\",\n ],\n organizationId: \"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Components;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n$request = new Components\\WebhookEndpointCreate(\n url: 'https://webhook.site/cb791d80-f26e-4f8c-be88-6e56054192b0',\n format: Components\\WebhookFormat::Slack,\n events: [\n Components\\WebhookEventType::SubscriptionUncanceled,\n ],\n organizationId: '1dbfc517-0bbf-4301-9ba8-555ca42b9737',\n);\n\n$response = $sdk->webhooks->createWebhookEndpoint(\n request: $request\n);\n\nif ($response->webhookEndpoint !== null) {\n // handle response\n}" } ] } }, "/v1/webhooks/endpoints/{id}": { "get": { "tags": [ "webhooks", "public" ], "summary": "Get Webhook Endpoint", "description": "Get a webhook endpoint by ID.\n\n**Scopes**: `webhooks:read` `webhooks:write`", "operationId": "webhooks:get_webhook_endpoint", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid4", "description": "The webhook endpoint ID.", "title": "Id" }, "description": "The webhook endpoint ID." } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/WebhookEndpoint" } } } }, "404": { "description": "Webhook endpoint not found.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ResourceNotFound" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "webhooks", "x-speakeasy-name-override": "get_webhook_endpoint", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Webhooks.GetWebhookEndpoint(ctx, \"\")\n if err != nil {\n log.Fatal(err)\n }\n if res.WebhookEndpoint != nil {\n // handle response\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.webhooks.get_webhook_endpoint(id=\"\")\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.webhooks.getWebhookEndpoint({\n id: \"\",\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n\n\n$response = $sdk->webhooks->getWebhookEndpoint(\n id: ''\n);\n\nif ($response->webhookEndpoint !== null) {\n // handle response\n}" } ] }, "patch": { "tags": [ "webhooks", "public" ], "summary": "Update Webhook Endpoint", "description": "Update a webhook endpoint.\n\n**Scopes**: `webhooks:write`", "operationId": "webhooks:update_webhook_endpoint", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid4", "description": "The webhook endpoint ID.", "title": "Id" }, "description": "The webhook endpoint ID." } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/WebhookEndpointUpdate" } } } }, "responses": { "200": { "description": "Webhook endpoint updated.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/WebhookEndpoint" } } } }, "404": { "description": "Webhook endpoint not found.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ResourceNotFound" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "webhooks", "x-speakeasy-name-override": "update_webhook_endpoint", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Webhooks.UpdateWebhookEndpoint(ctx, \"\", components.WebhookEndpointUpdate{\n URL: polargo.Pointer(\"https://webhook.site/cb791d80-f26e-4f8c-be88-6e56054192b0\"),\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.WebhookEndpoint != nil {\n // handle response\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.webhooks.update_webhook_endpoint(id=\"\", webhook_endpoint_update={\n \"url\": \"https://webhook.site/cb791d80-f26e-4f8c-be88-6e56054192b0\",\n })\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.webhooks.updateWebhookEndpoint({\n id: \"\",\n webhookEndpointUpdate: {\n url: \"https://webhook.site/cb791d80-f26e-4f8c-be88-6e56054192b0\",\n },\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Components;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n$webhookEndpointUpdate = new Components\\WebhookEndpointUpdate(\n url: 'https://webhook.site/cb791d80-f26e-4f8c-be88-6e56054192b0',\n);\n\n$response = $sdk->webhooks->updateWebhookEndpoint(\n id: '',\n webhookEndpointUpdate: $webhookEndpointUpdate\n\n);\n\nif ($response->webhookEndpoint !== null) {\n // handle response\n}" } ] }, "delete": { "tags": [ "webhooks", "public" ], "summary": "Delete Webhook Endpoint", "description": "Delete a webhook endpoint.\n\n**Scopes**: `webhooks:write`", "operationId": "webhooks:delete_webhook_endpoint", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid4", "description": "The webhook endpoint ID.", "title": "Id" }, "description": "The webhook endpoint ID." } ], "responses": { "204": { "description": "Webhook endpoint deleted." }, "404": { "description": "Webhook endpoint not found.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ResourceNotFound" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "webhooks", "x-speakeasy-name-override": "delete_webhook_endpoint", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Webhooks.DeleteWebhookEndpoint(ctx, \"\")\n if err != nil {\n log.Fatal(err)\n }\n if res != nil {\n // handle response\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n polar.webhooks.delete_webhook_endpoint(id=\"\")\n\n # Use the SDK ..." }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n await polar.webhooks.deleteWebhookEndpoint({\n id: \"\",\n });\n\n\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n\n\n$response = $sdk->webhooks->deleteWebhookEndpoint(\n id: ''\n);\n\nif ($response->statusCode === 200) {\n // handle response\n}" } ] } }, "/v1/webhooks/endpoints/{id}/secret": { "patch": { "tags": [ "webhooks", "public" ], "summary": "Reset Webhook Endpoint Secret", "description": "Regenerate a webhook endpoint secret.\n\n**Scopes**: `webhooks:write`", "operationId": "webhooks:reset_webhook_endpoint_secret", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid4", "description": "The webhook endpoint ID.", "title": "Id" }, "description": "The webhook endpoint ID." } ], "responses": { "200": { "description": "Webhook endpoint secret reset.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/WebhookEndpoint" } } } }, "404": { "description": "Webhook endpoint not found.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ResourceNotFound" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "webhooks", "x-speakeasy-name-override": "reset_webhook_endpoint_secret", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Webhooks.ResetWebhookEndpointSecret(ctx, \"\")\n if err != nil {\n log.Fatal(err)\n }\n if res.WebhookEndpoint != nil {\n // handle response\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.webhooks.reset_webhook_endpoint_secret(id=\"\")\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.webhooks.resetWebhookEndpointSecret({\n id: \"\",\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n\n\n$response = $sdk->webhooks->resetWebhookEndpointSecret(\n id: ''\n);\n\nif ($response->webhookEndpoint !== null) {\n // handle response\n}" } ] } }, "/v1/webhooks/deliveries": { "get": { "tags": [ "webhooks", "public" ], "summary": "List Webhook Deliveries", "description": "List webhook deliveries.\n\nDeliveries are all the attempts to deliver a webhook event to an endpoint.\n\n**Scopes**: `webhooks:read` `webhooks:write`", "operationId": "webhooks:list_webhook_deliveries", "parameters": [ { "name": "endpoint_id", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "array", "items": { "type": "string", "format": "uuid4" } }, { "type": "null" } ], "description": "Filter by webhook endpoint ID.", "title": "Endpoint Id" }, "description": "Filter by webhook endpoint ID." }, { "name": "start_timestamp", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "description": "Filter deliveries after this timestamp.", "title": "Start Timestamp" }, "description": "Filter deliveries after this timestamp." }, { "name": "end_timestamp", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "description": "Filter deliveries before this timestamp.", "title": "End Timestamp" }, "description": "Filter deliveries before this timestamp." }, { "name": "succeeded", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "description": "Filter by delivery success status.", "title": "Succeeded" }, "description": "Filter by delivery success status." }, { "name": "query", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "description": "Query to filter webhook deliveries.", "title": "Query" }, "description": "Query to filter webhook deliveries." }, { "name": "http_code_class", "in": "query", "required": false, "schema": { "anyOf": [ { "enum": [ "2xx", "3xx", "4xx", "5xx" ], "type": "string" }, { "type": "null" } ], "description": "Filter by HTTP response code class (2xx, 3xx, 4xx, 5xx).", "title": "Http Code Class" }, "description": "Filter by HTTP response code class (2xx, 3xx, 4xx, 5xx)." }, { "name": "event_type", "in": "query", "required": false, "schema": { "anyOf": [ { "$ref": "#/components/schemas/WebhookEventType" }, { "type": "array", "items": { "$ref": "#/components/schemas/WebhookEventType" } }, { "type": "null" } ], "description": "Filter by webhook event type.", "title": "Event Type" }, "description": "Filter by webhook event type." }, { "name": "page", "in": "query", "required": false, "schema": { "type": "integer", "exclusiveMinimum": 0, "description": "Page number, defaults to 1.", "default": 1, "title": "Page" }, "description": "Page number, defaults to 1." }, { "name": "limit", "in": "query", "required": false, "schema": { "type": "integer", "exclusiveMinimum": 0, "description": "Size of a page, defaults to 10. Maximum is 100.", "default": 10, "title": "Limit" }, "description": "Size of a page, defaults to 10. Maximum is 100." } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ListResource_WebhookDelivery_" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-pagination": { "type": "offsetLimit", "inputs": [ { "name": "page", "in": "parameters", "type": "page" }, { "name": "limit", "in": "parameters", "type": "limit" } ], "outputs": { "results": "$.items", "numPages": "$.pagination.max_page" } }, "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "webhooks", "x-speakeasy-name-override": "list_webhook_deliveries", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Webhooks.ListWebhookDeliveries(ctx, operations.WebhooksListWebhookDeliveriesRequest{})\n if err != nil {\n log.Fatal(err)\n }\n if res.ListResourceWebhookDelivery != nil {\n for {\n // handle items\n\n res, err = res.Next()\n\n if err != nil {\n // handle error\n }\n\n if res == nil {\n break\n }\n }\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.webhooks.list_webhook_deliveries(page=1, limit=10)\n\n while res is not None:\n # Handle items\n\n res = res.next()" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.webhooks.listWebhookDeliveries({});\n\n for await (const page of result) {\n console.log(page);\n }\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Operations;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n$request = new Operations\\WebhooksListWebhookDeliveriesRequest();\n\n$responses = $sdk->webhooks->listWebhookDeliveries(\n request: $request\n);\n\n\nforeach ($responses as $response) {\n if ($response->statusCode === 200) {\n // handle response\n }\n}" } ] } }, "/v1/webhooks/events/{id}/redeliver": { "post": { "tags": [ "webhooks", "public" ], "summary": "Redeliver Webhook Event", "description": "Schedule the re-delivery of a webhook event.\n\n**Scopes**: `webhooks:write`", "operationId": "webhooks:redeliver_webhook_event", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid4", "description": "The webhook event ID.", "title": "Id" }, "description": "The webhook event ID." } ], "responses": { "202": { "description": "Webhook event re-delivery scheduled.", "content": { "application/json": { "schema": {} } } }, "404": { "description": "Webhook event not found.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ResourceNotFound" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "webhooks", "x-speakeasy-name-override": "redeliver_webhook_event", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Webhooks.RedeliverWebhookEvent(ctx, \"\")\n if err != nil {\n log.Fatal(err)\n }\n if res.Any != nil {\n // handle response\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.webhooks.redeliver_webhook_event(id=\"\")\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.webhooks.redeliverWebhookEvent({\n id: \"\",\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n\n\n$response = $sdk->webhooks->redeliverWebhookEvent(\n id: ''\n);\n\nif ($response->any !== null) {\n // handle response\n}" } ] } }, "/v1/products/": { "get": { "tags": [ "products", "public", "mcp" ], "summary": "List Products", "description": "List products.\n\n**Scopes**: `products:read` `products:write`", "operationId": "products:list", "parameters": [ { "name": "id", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string", "format": "uuid4", "description": "The product ID.", "x-polar-selector-widget": { "resourceRoot": "/v1/products", "resourceName": "Product", "displayProperty": "name" } }, { "type": "array", "items": { "type": "string", "format": "uuid4", "description": "The product ID.", "x-polar-selector-widget": { "resourceRoot": "/v1/products", "resourceName": "Product", "displayProperty": "name" } } }, { "type": "null" } ], "title": "ProductID Filter", "description": "Filter by product ID." }, "description": "Filter by product ID." }, { "name": "organization_id", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string", "format": "uuid4", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "description": "The organization ID.", "x-polar-selector-widget": { "resourceRoot": "/v1/organizations", "resourceName": "Organization", "displayProperty": "name" } }, { "type": "array", "items": { "type": "string", "format": "uuid4", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "description": "The organization ID.", "x-polar-selector-widget": { "resourceRoot": "/v1/organizations", "resourceName": "Organization", "displayProperty": "name" } } }, { "type": "null" } ], "title": "OrganizationID Filter", "description": "Filter by organization ID." }, "description": "Filter by organization ID." }, { "name": "query", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "description": "Filter by product name.", "title": "Query" }, "description": "Filter by product name." }, { "name": "is_archived", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "description": "Filter on archived products.", "title": "Is Archived" }, "description": "Filter on archived products." }, { "name": "is_recurring", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "description": "Filter on recurring products. If `true`, only subscriptions tiers are returned. If `false`, only one-time purchase products are returned. ", "title": "Is Recurring" }, "description": "Filter on recurring products. If `true`, only subscriptions tiers are returned. If `false`, only one-time purchase products are returned. " }, { "name": "benefit_id", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string", "format": "uuid4", "description": "The benefit ID.", "x-polar-selector-widget": { "resourceRoot": "/v1/benefits", "resourceName": "Benefit", "displayProperty": "description" } }, { "type": "array", "items": { "type": "string", "format": "uuid4", "description": "The benefit ID.", "x-polar-selector-widget": { "resourceRoot": "/v1/benefits", "resourceName": "Benefit", "displayProperty": "description" } } }, { "type": "null" } ], "title": "BenefitID Filter", "description": "Filter products granting specific benefit." }, "description": "Filter products granting specific benefit." }, { "name": "visibility", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "array", "items": { "$ref": "#/components/schemas/ProductVisibility" } }, { "type": "null" } ], "description": "Filter by visibility.", "title": "Visibility" }, "description": "Filter by visibility." }, { "name": "page", "in": "query", "required": false, "schema": { "type": "integer", "exclusiveMinimum": 0, "description": "Page number, defaults to 1.", "default": 1, "title": "Page" }, "description": "Page number, defaults to 1." }, { "name": "limit", "in": "query", "required": false, "schema": { "type": "integer", "exclusiveMinimum": 0, "description": "Size of a page, defaults to 10. Maximum is 100.", "default": 10, "title": "Limit" }, "description": "Size of a page, defaults to 10. Maximum is 100." }, { "name": "sorting", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "array", "items": { "$ref": "#/components/schemas/ProductSortProperty" } }, { "type": "null" } ], "description": "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.", "default": [ "-created_at" ], "title": "Sorting" }, "description": "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." }, { "name": "metadata", "in": "query", "required": false, "style": "deepObject", "schema": { "$ref": "#/components/schemas/MetadataQuery" }, "description": "Filter by metadata key-value pairs. It uses the `deepObject` style, e.g. `?metadata[key]=value`." } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ListResource_Product_" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-pagination": { "type": "offsetLimit", "inputs": [ { "name": "page", "in": "parameters", "type": "page" }, { "name": "limit", "in": "parameters", "type": "limit" } ], "outputs": { "results": "$.items", "numPages": "$.pagination.max_page" } }, "x-speakeasy-mcp": { "disabled": false, "scopes": [ "read", "products" ] }, "x-speakeasy-group": "products", "x-speakeasy-name-override": "list", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Products.List(ctx, operations.ProductsListRequest{\n OrganizationID: polargo.Pointer(operations.CreateProductsListQueryParamOrganizationIDFilterStr(\n \"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n )),\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.ListResourceProduct != nil {\n for {\n // handle items\n\n res, err = res.Next()\n\n if err != nil {\n // handle error\n }\n\n if res == nil {\n break\n }\n }\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.products.list(organization_id=None, page=1, limit=10)\n\n while res is not None:\n # Handle items\n\n res = res.next()" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.products.list({\n organizationId: \"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n });\n\n for await (const page of result) {\n console.log(page);\n }\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Operations;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n$request = new Operations\\ProductsListRequest(\n organizationId: '1dbfc517-0bbf-4301-9ba8-555ca42b9737',\n);\n\n$responses = $sdk->products->list(\n request: $request\n);\n\n\nforeach ($responses as $response) {\n if ($response->statusCode === 200) {\n // handle response\n }\n}" } ] }, "post": { "tags": [ "products", "public", "mcp" ], "summary": "Create Product", "description": "Create a product.\n\n**Scopes**: `products:write`", "operationId": "products:create", "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ProductCreate" } } } }, "responses": { "201": { "description": "Product created.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Product" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-mcp": { "disabled": false, "scopes": [ "write", "products" ] }, "x-speakeasy-group": "products", "x-speakeasy-name-override": "create", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Products.Create(ctx, components.CreateProductCreateProductCreateOneTime(\n components.ProductCreateOneTime{\n Name: \"\",\n Prices: []components.ProductCreateOneTimePrices{\n components.CreateProductCreateOneTimePricesFixed(\n components.ProductPriceFixedCreate{\n PriceCurrency: components.PresentmentCurrencyUsd.ToPointer(),\n PriceAmount: 677078,\n },\n ),\n components.CreateProductCreateOneTimePricesCustom(\n components.ProductPriceCustomCreate{\n PriceCurrency: components.PresentmentCurrencyUsd.ToPointer(),\n },\n ),\n },\n OrganizationID: polargo.Pointer(\"1dbfc517-0bbf-4301-9ba8-555ca42b9737\"),\n RecurringInterval: \"year\",\n },\n ))\n if err != nil {\n log.Fatal(err)\n }\n if res.Product != nil {\n // handle response\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.products.create(request={\n \"name\": \"\",\n \"prices\": [\n {\n \"amount_type\": \"custom\",\n \"minimum_amount\": 50,\n },\n ],\n \"organization_id\": \"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n })\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.products.create({\n name: \"\",\n prices: [\n {\n amountType: \"fixed\",\n priceCurrency: \"usd\",\n priceAmount: 677078,\n },\n {\n amountType: \"free\",\n },\n ],\n organizationId: \"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n recurringInterval: \"year\",\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Components;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n$request = new Components\\ProductCreateOneTime(\n name: '',\n prices: [\n new Components\\ProductPriceFixedCreate(\n priceCurrency: Components\\PresentmentCurrency::Usd,\n priceAmount: 677078,\n ),\n new Components\\ProductPriceCustomCreate(\n priceCurrency: Components\\PresentmentCurrency::Usd,\n ),\n ],\n organizationId: '1dbfc517-0bbf-4301-9ba8-555ca42b9737',\n recurringInterval: 'year',\n);\n\n$response = $sdk->products->create(\n request: $request\n);\n\nif ($response->product !== null) {\n // handle response\n}" } ] } }, "/v1/products/{id}": { "get": { "tags": [ "products", "public", "mcp" ], "summary": "Get Product", "description": "Get a product by ID.\n\n**Scopes**: `products:read` `products:write`", "operationId": "products:get", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid4", "description": "The product ID.", "x-polar-selector-widget": { "resourceRoot": "/v1/products", "resourceName": "Product", "displayProperty": "name" }, "title": "Id" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Product" } } } }, "404": { "description": "Product not found.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ResourceNotFound" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-mcp": { "disabled": false, "scopes": [ "read", "products" ] }, "x-speakeasy-group": "products", "x-speakeasy-name-override": "get", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Products.Get(ctx, \"\")\n if err != nil {\n log.Fatal(err)\n }\n if res.Product != nil {\n // handle response\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.products.get(id=\"\")\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.products.get({\n id: \"\",\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n\n\n$response = $sdk->products->get(\n id: ''\n);\n\nif ($response->product !== null) {\n // handle response\n}" } ] }, "patch": { "tags": [ "products", "public", "mcp" ], "summary": "Update Product", "description": "Update a product.\n\n**Scopes**: `products:write`", "operationId": "products:update", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid4", "description": "The product ID.", "x-polar-selector-widget": { "resourceRoot": "/v1/products", "resourceName": "Product", "displayProperty": "name" }, "title": "Id" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ProductUpdate" } } } }, "responses": { "200": { "description": "Product updated.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Product" } } } }, "403": { "description": "You don't have the permission to update this product.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/NotPermitted" } } } }, "404": { "description": "Product not found.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ResourceNotFound" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-mcp": { "disabled": false, "scopes": [ "write", "products" ] }, "x-speakeasy-group": "products", "x-speakeasy-name-override": "update", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Products.Update(ctx, \"\", components.ProductUpdate{})\n if err != nil {\n log.Fatal(err)\n }\n if res.Product != nil {\n // handle response\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.products.update(id=\"\", product_update={})\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.products.update({\n id: \"\",\n productUpdate: {},\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Components;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n$productUpdate = new Components\\ProductUpdate();\n\n$response = $sdk->products->update(\n id: '',\n productUpdate: $productUpdate\n\n);\n\nif ($response->product !== null) {\n // handle response\n}" } ] } }, "/v1/products/{id}/benefits": { "post": { "tags": [ "products", "public", "mcp" ], "summary": "Update Product Benefits", "description": "Update benefits granted by a product.\n\n**Scopes**: `products:write`", "operationId": "products:update_benefits", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid4", "description": "The product ID.", "x-polar-selector-widget": { "resourceRoot": "/v1/products", "resourceName": "Product", "displayProperty": "name" }, "title": "Id" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ProductBenefitsUpdate" } } } }, "responses": { "200": { "description": "Product benefits updated.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Product" } } } }, "403": { "description": "You don't have the permission to update this product.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/NotPermitted" } } } }, "404": { "description": "Product not found.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ResourceNotFound" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-mcp": { "disabled": false, "scopes": [ "write", "products" ] }, "x-speakeasy-group": "products", "x-speakeasy-name-override": "update_benefits", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Products.UpdateBenefits(ctx, \"\", components.ProductBenefitsUpdate{\n Benefits: []string{\n \"\",\n \"\",\n \"\",\n },\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.Product != nil {\n // handle response\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.products.update_benefits(id=\"\", product_benefits_update={\n \"benefits\": [\n \"\",\n \"\",\n \"\",\n ],\n })\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.products.updateBenefits({\n id: \"\",\n productBenefitsUpdate: {\n benefits: [\n \"\",\n \"\",\n \"\",\n ],\n },\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Components;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n$productBenefitsUpdate = new Components\\ProductBenefitsUpdate(\n benefits: [\n '',\n '',\n '',\n ],\n);\n\n$response = $sdk->products->updateBenefits(\n id: '',\n productBenefitsUpdate: $productBenefitsUpdate\n\n);\n\nif ($response->product !== null) {\n // handle response\n}" } ] } }, "/v1/orders/": { "get": { "tags": [ "orders", "public", "mcp" ], "summary": "List Orders", "description": "List orders.\n\n**Scopes**: `orders:read`", "operationId": "orders:list", "parameters": [ { "name": "organization_id", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string", "format": "uuid4", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "description": "The organization ID.", "x-polar-selector-widget": { "resourceRoot": "/v1/organizations", "resourceName": "Organization", "displayProperty": "name" } }, { "type": "array", "items": { "type": "string", "format": "uuid4", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "description": "The organization ID.", "x-polar-selector-widget": { "resourceRoot": "/v1/organizations", "resourceName": "Organization", "displayProperty": "name" } } }, { "type": "null" } ], "title": "OrganizationID Filter", "description": "Filter by organization ID." }, "description": "Filter by organization ID." }, { "name": "product_id", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string", "format": "uuid4", "description": "The product ID.", "x-polar-selector-widget": { "resourceRoot": "/v1/products", "resourceName": "Product", "displayProperty": "name" } }, { "type": "array", "items": { "type": "string", "format": "uuid4", "description": "The product ID.", "x-polar-selector-widget": { "resourceRoot": "/v1/products", "resourceName": "Product", "displayProperty": "name" } } }, { "type": "null" } ], "title": "ProductID Filter", "description": "Filter by product ID." }, "description": "Filter by product ID." }, { "name": "product_billing_type", "in": "query", "required": false, "schema": { "anyOf": [ { "$ref": "#/components/schemas/ProductBillingType" }, { "type": "array", "items": { "$ref": "#/components/schemas/ProductBillingType" } }, { "type": "null" } ], "title": "ProductBillingType Filter", "description": "Filter by product billing type. `recurring` will filter data corresponding to subscriptions creations or renewals. `one_time` will filter data corresponding to one-time purchases." }, "description": "Filter by product billing type. `recurring` will filter data corresponding to subscriptions creations or renewals. `one_time` will filter data corresponding to one-time purchases." }, { "name": "discount_id", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "array", "items": { "type": "string", "format": "uuid4" } }, { "type": "null" } ], "title": "DiscountID Filter", "description": "Filter by discount ID." }, "description": "Filter by discount ID." }, { "name": "customer_id", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string", "format": "uuid4", "description": "The customer ID." }, { "type": "array", "items": { "type": "string", "format": "uuid4", "description": "The customer ID." } }, { "type": "null" } ], "title": "CustomerID Filter", "description": "Filter by customer ID." }, "description": "Filter by customer ID." }, { "name": "external_customer_id", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string", "description": "The customer external ID." }, { "type": "array", "items": { "type": "string", "description": "The customer external ID." } }, { "type": "null" } ], "title": "ExternalCustomerID Filter", "description": "Filter by customer external ID." }, "description": "Filter by customer external ID." }, { "name": "checkout_id", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "array", "items": { "type": "string", "format": "uuid4" } }, { "type": "null" } ], "title": "CheckoutID Filter", "description": "Filter by checkout ID." }, "description": "Filter by checkout ID." }, { "name": "page", "in": "query", "required": false, "schema": { "type": "integer", "exclusiveMinimum": 0, "description": "Page number, defaults to 1.", "default": 1, "title": "Page" }, "description": "Page number, defaults to 1." }, { "name": "limit", "in": "query", "required": false, "schema": { "type": "integer", "exclusiveMinimum": 0, "description": "Size of a page, defaults to 10. Maximum is 100.", "default": 10, "title": "Limit" }, "description": "Size of a page, defaults to 10. Maximum is 100." }, { "name": "sorting", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "array", "items": { "$ref": "#/components/schemas/OrderSortProperty" } }, { "type": "null" } ], "description": "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.", "default": [ "-created_at" ], "title": "Sorting" }, "description": "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." }, { "name": "metadata", "in": "query", "required": false, "style": "deepObject", "schema": { "$ref": "#/components/schemas/MetadataQuery" }, "description": "Filter by metadata key-value pairs. It uses the `deepObject` style, e.g. `?metadata[key]=value`." } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ListResource_Order_" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-pagination": { "type": "offsetLimit", "inputs": [ { "name": "page", "in": "parameters", "type": "page" }, { "name": "limit", "in": "parameters", "type": "limit" } ], "outputs": { "results": "$.items", "numPages": "$.pagination.max_page" } }, "x-speakeasy-mcp": { "disabled": false, "scopes": [ "read", "orders" ] }, "x-speakeasy-group": "orders", "x-speakeasy-name-override": "list", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Orders.List(ctx, operations.OrdersListRequest{\n OrganizationID: polargo.Pointer(operations.CreateOrdersListQueryParamOrganizationIDFilterStr(\n \"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n )),\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.ListResourceOrder != nil {\n for {\n // handle items\n\n res, err = res.Next()\n\n if err != nil {\n // handle error\n }\n\n if res == nil {\n break\n }\n }\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.orders.list(organization_id=\"1dbfc517-0bbf-4301-9ba8-555ca42b9737\", page=1, limit=10)\n\n while res is not None:\n # Handle items\n\n res = res.next()" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.orders.list({\n organizationId: \"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n });\n\n for await (const page of result) {\n console.log(page);\n }\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Operations;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n$request = new Operations\\OrdersListRequest(\n organizationId: '1dbfc517-0bbf-4301-9ba8-555ca42b9737',\n);\n\n$responses = $sdk->orders->list(\n request: $request\n);\n\n\nforeach ($responses as $response) {\n if ($response->statusCode === 200) {\n // handle response\n }\n}" } ] } }, "/v1/orders/export": { "get": { "tags": [ "orders", "public", "mcp" ], "summary": "Export Orders", "description": "Export orders as a CSV file.\n\n**Scopes**: `orders:read`", "operationId": "orders:export", "parameters": [ { "name": "organization_id", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string", "format": "uuid4", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "description": "The organization ID.", "x-polar-selector-widget": { "resourceRoot": "/v1/organizations", "resourceName": "Organization", "displayProperty": "name" } }, { "type": "array", "items": { "type": "string", "format": "uuid4", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "description": "The organization ID.", "x-polar-selector-widget": { "resourceRoot": "/v1/organizations", "resourceName": "Organization", "displayProperty": "name" } } }, { "type": "null" } ], "title": "OrganizationID Filter", "description": "Filter by organization ID." }, "description": "Filter by organization ID." }, { "name": "product_id", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string", "format": "uuid4", "description": "The product ID.", "x-polar-selector-widget": { "resourceRoot": "/v1/products", "resourceName": "Product", "displayProperty": "name" } }, { "type": "array", "items": { "type": "string", "format": "uuid4", "description": "The product ID.", "x-polar-selector-widget": { "resourceRoot": "/v1/products", "resourceName": "Product", "displayProperty": "name" } } }, { "type": "null" } ], "title": "ProductID Filter", "description": "Filter by product ID." }, "description": "Filter by product ID." } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} }, "text/csv": { "schema": { "type": "string" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-mcp": { "disabled": false, "scopes": [ "read", "orders" ] }, "x-speakeasy-group": "orders", "x-speakeasy-name-override": "export", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Orders.Export(ctx, nil, nil)\n if err != nil {\n log.Fatal(err)\n }\n if res.Any != nil {\n // handle response\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.orders.export(organization_id=None)\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.orders.export({\n organizationId: null,\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n\n\n$response = $sdk->orders->export(\n organizationId: null\n);\n\nif ($response->any !== null) {\n // handle response\n}" } ] } }, "/v1/orders/{id}": { "get": { "tags": [ "orders", "public", "mcp" ], "summary": "Get Order", "description": "Get an order by ID.\n\n**Scopes**: `orders:read`", "operationId": "orders:get", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid4", "description": "The order ID.", "title": "Id" }, "description": "The order ID." } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Order" } } } }, "404": { "description": "Order not found.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ResourceNotFound" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-mcp": { "disabled": false, "scopes": [ "read", "orders" ] }, "x-speakeasy-group": "orders", "x-speakeasy-name-override": "get", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"log\"\n\t\"github.com/polarsource/polar-go/models/components\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Orders.Get(ctx, \"\")\n if err != nil {\n log.Fatal(err)\n }\n if res.Order != nil {\n switch res.Order.Discount.Type {\n case components.OrderDiscountTypeDiscountFixedOnceForeverDurationBase:\n // res.Order.Discount.DiscountFixedOnceForeverDurationBase is populated\n case components.OrderDiscountTypeDiscountFixedRepeatDurationBase:\n // res.Order.Discount.DiscountFixedRepeatDurationBase is populated\n case components.OrderDiscountTypeDiscountPercentageOnceForeverDurationBase:\n // res.Order.Discount.DiscountPercentageOnceForeverDurationBase is populated\n case components.OrderDiscountTypeDiscountPercentageRepeatDurationBase:\n // res.Order.Discount.DiscountPercentageRepeatDurationBase is populated\n }\n\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.orders.get(id=\"\")\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.orders.get({\n id: \"\",\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n\n\n$response = $sdk->orders->get(\n id: ''\n);\n\nif ($response->order !== null) {\n // handle response\n}" } ] }, "patch": { "tags": [ "orders", "public", "mcp" ], "summary": "Update Order", "description": "Update an order.\n\n**Scopes**: `orders:write`", "operationId": "orders:update", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid4", "description": "The order ID.", "title": "Id" }, "description": "The order ID." } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/OrderUpdate" } } } }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Order" } } } }, "404": { "description": "Order not found.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ResourceNotFound" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-mcp": { "disabled": false, "scopes": [ "write", "orders" ] }, "x-speakeasy-group": "orders", "x-speakeasy-name-override": "update", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Orders.Update(ctx, \"\", components.OrderUpdate{\n BillingAddress: &components.AddressInput{\n Country: components.CountryAlpha2InputUs,\n },\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.Order != nil {\n switch res.Order.Discount.Type {\n case components.OrderDiscountTypeDiscountFixedOnceForeverDurationBase:\n // res.Order.Discount.DiscountFixedOnceForeverDurationBase is populated\n case components.OrderDiscountTypeDiscountFixedRepeatDurationBase:\n // res.Order.Discount.DiscountFixedRepeatDurationBase is populated\n case components.OrderDiscountTypeDiscountPercentageOnceForeverDurationBase:\n // res.Order.Discount.DiscountPercentageOnceForeverDurationBase is populated\n case components.OrderDiscountTypeDiscountPercentageRepeatDurationBase:\n // res.Order.Discount.DiscountPercentageRepeatDurationBase is populated\n }\n\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "import polar_sdk\nfrom polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.orders.update(id=\"\", order_update={\n \"billing_address\": {\n \"country\": polar_sdk.CountryAlpha2Input.US,\n },\n })\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.orders.update({\n id: \"\",\n orderUpdate: {\n billingAddress: {\n country: \"US\",\n },\n },\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Components;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n$orderUpdate = new Components\\OrderUpdate(\n billingAddress: new Components\\AddressInput(\n country: Components\\CountryAlpha2Input::Us,\n ),\n);\n\n$response = $sdk->orders->update(\n id: '',\n orderUpdate: $orderUpdate\n\n);\n\nif ($response->order !== null) {\n // handle response\n}" } ] } }, "/v1/orders/{id}/invoice": { "post": { "tags": [ "orders", "public", "mcp" ], "summary": "Generate Order Invoice", "description": "Trigger generation of an order's invoice.\n\n**Scopes**: `orders:read`", "operationId": "orders:generate_invoice", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid4", "description": "The order ID.", "title": "Id" }, "description": "The order ID." } ], "responses": { "202": { "description": "Successful Response", "content": { "application/json": { "schema": {} } } }, "422": { "description": "Order is not paid or is missing billing name or address.", "content": { "application/json": { "schema": { "anyOf": [ { "$ref": "#/components/schemas/MissingInvoiceBillingDetails" }, { "$ref": "#/components/schemas/NotPaidOrder" } ], "title": "Response 422 Orders:Generate Invoice" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-mcp": { "disabled": false, "scopes": [ "write", "orders" ] }, "x-speakeasy-group": "orders", "x-speakeasy-name-override": "generate_invoice", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Orders.GenerateInvoice(ctx, \"\")\n if err != nil {\n log.Fatal(err)\n }\n if res.Any != nil {\n // handle response\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.orders.generate_invoice(id=\"\")\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.orders.generateInvoice({\n id: \"\",\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n\n\n$response = $sdk->orders->generateInvoice(\n id: ''\n);\n\nif ($response->any !== null) {\n // handle response\n}" } ] }, "get": { "tags": [ "orders", "public", "mcp" ], "summary": "Get Order Invoice", "description": "Get an order's invoice data.\n\n**Scopes**: `orders:read`", "operationId": "orders:invoice", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid4", "description": "The order ID.", "title": "Id" }, "description": "The order ID." } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/OrderInvoice" } } } }, "404": { "description": "Order not found.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ResourceNotFound" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-mcp": { "disabled": false, "scopes": [ "read", "orders" ] }, "x-speakeasy-group": "orders", "x-speakeasy-name-override": "invoice", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Orders.Invoice(ctx, \"\")\n if err != nil {\n log.Fatal(err)\n }\n if res.OrderInvoice != nil {\n // handle response\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.orders.invoice(id=\"\")\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.orders.invoice({\n id: \"\",\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n\n\n$response = $sdk->orders->invoice(\n id: ''\n);\n\nif ($response->orderInvoice !== null) {\n // handle response\n}" } ] } }, "/v1/refunds/": { "get": { "tags": [ "refunds", "public" ], "summary": "List Refunds", "description": "List refunds.\n\n**Scopes**: `refunds:read` `refunds:write`", "operationId": "refunds:list", "parameters": [ { "name": "id", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string", "format": "uuid4", "description": "The refund ID." }, { "type": "array", "items": { "type": "string", "format": "uuid4", "description": "The refund ID." } }, { "type": "null" } ], "title": "RefundID Filter", "description": "Filter by refund ID." }, "description": "Filter by refund ID." }, { "name": "organization_id", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string", "format": "uuid4", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "description": "The organization ID.", "x-polar-selector-widget": { "resourceRoot": "/v1/organizations", "resourceName": "Organization", "displayProperty": "name" } }, { "type": "array", "items": { "type": "string", "format": "uuid4", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "description": "The organization ID.", "x-polar-selector-widget": { "resourceRoot": "/v1/organizations", "resourceName": "Organization", "displayProperty": "name" } } }, { "type": "null" } ], "title": "OrganizationID Filter", "description": "Filter by organization ID." }, "description": "Filter by organization ID." }, { "name": "order_id", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string", "format": "uuid4", "description": "The order ID." }, { "type": "array", "items": { "type": "string", "format": "uuid4", "description": "The order ID." } }, { "type": "null" } ], "title": "OrderID Filter", "description": "Filter by order ID." }, "description": "Filter by order ID." }, { "name": "subscription_id", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string", "format": "uuid4", "description": "The subscription ID." }, { "type": "array", "items": { "type": "string", "format": "uuid4", "description": "The subscription ID." } }, { "type": "null" } ], "title": "SubscriptionID Filter", "description": "Filter by subscription ID." }, "description": "Filter by subscription ID." }, { "name": "customer_id", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string", "format": "uuid4", "description": "The customer ID." }, { "type": "array", "items": { "type": "string", "format": "uuid4", "description": "The customer ID." } }, { "type": "null" } ], "title": "CustomerID Filter", "description": "Filter by customer ID." }, "description": "Filter by customer ID." }, { "name": "external_customer_id", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string", "description": "The customer external ID." }, { "type": "array", "items": { "type": "string", "description": "The customer external ID." } }, { "type": "null" } ], "title": "ExternalCustomerID Filter", "description": "Filter by customer external ID." }, "description": "Filter by customer external ID." }, { "name": "succeeded", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "title": "RefundStatus Filter", "description": "Filter by `succeeded`." }, "description": "Filter by `succeeded`." }, { "name": "page", "in": "query", "required": false, "schema": { "type": "integer", "exclusiveMinimum": 0, "description": "Page number, defaults to 1.", "default": 1, "title": "Page" }, "description": "Page number, defaults to 1." }, { "name": "limit", "in": "query", "required": false, "schema": { "type": "integer", "exclusiveMinimum": 0, "description": "Size of a page, defaults to 10. Maximum is 100.", "default": 10, "title": "Limit" }, "description": "Size of a page, defaults to 10. Maximum is 100." }, { "name": "sorting", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "array", "items": { "$ref": "#/components/schemas/RefundSortProperty" } }, { "type": "null" } ], "description": "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.", "default": [ "-created_at" ], "title": "Sorting" }, "description": "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." } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ListResource_Refund_" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-pagination": { "type": "offsetLimit", "inputs": [ { "name": "page", "in": "parameters", "type": "page" }, { "name": "limit", "in": "parameters", "type": "limit" } ], "outputs": { "results": "$.items", "numPages": "$.pagination.max_page" } }, "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "refunds", "x-speakeasy-name-override": "list", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Refunds.List(ctx, operations.RefundsListRequest{\n OrganizationID: polargo.Pointer(operations.CreateRefundsListQueryParamOrganizationIDFilterStr(\n \"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n )),\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.ListResourceRefund != nil {\n for {\n // handle items\n\n res, err = res.Next()\n\n if err != nil {\n // handle error\n }\n\n if res == nil {\n break\n }\n }\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.refunds.list(organization_id=\"1dbfc517-0bbf-4301-9ba8-555ca42b9737\", page=1, limit=10)\n\n while res is not None:\n # Handle items\n\n res = res.next()" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.refunds.list({\n organizationId: \"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n });\n\n for await (const page of result) {\n console.log(page);\n }\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Operations;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n$request = new Operations\\RefundsListRequest(\n organizationId: '1dbfc517-0bbf-4301-9ba8-555ca42b9737',\n);\n\n$responses = $sdk->refunds->list(\n request: $request\n);\n\n\nforeach ($responses as $response) {\n if ($response->statusCode === 200) {\n // handle response\n }\n}" } ] }, "post": { "tags": [ "refunds", "public" ], "summary": "Create Refund", "description": "Create a refund.\n\n**Scopes**: `refunds:write`", "operationId": "refunds:create", "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/RefundCreate" } } } }, "responses": { "201": { "description": "Refund created.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Refund" } } } }, "403": { "description": "Order is already fully refunded.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/RefundedAlready" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "refunds", "x-speakeasy-name-override": "create", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Refunds.Create(ctx, components.RefundCreate{\n OrderID: \"\",\n Reason: components.RefundReasonCustomerRequest,\n Amount: 90,\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.Refund != nil {\n // handle response\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "import polar_sdk\nfrom polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.refunds.create(request={\n \"order_id\": \"\",\n \"reason\": polar_sdk.RefundReason.SERVICE_DISRUPTION,\n \"amount\": 90,\n })\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.refunds.create({\n orderId: \"\",\n reason: \"customer_request\",\n amount: 90,\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Components;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n$request = new Components\\RefundCreate(\n orderId: '',\n reason: Components\\RefundReason::CustomerRequest,\n amount: 90,\n);\n\n$response = $sdk->refunds->create(\n request: $request\n);\n\nif ($response->refund !== null) {\n // handle response\n}" } ] } }, "/v1/disputes/": { "get": { "tags": [ "disputes", "public" ], "summary": "List Disputes", "description": "List disputes.\n\n**Scopes**: `disputes:read`", "operationId": "disputes:list", "parameters": [ { "name": "organization_id", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string", "format": "uuid4", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "description": "The organization ID.", "x-polar-selector-widget": { "resourceRoot": "/v1/organizations", "resourceName": "Organization", "displayProperty": "name" } }, { "type": "array", "items": { "type": "string", "format": "uuid4", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "description": "The organization ID.", "x-polar-selector-widget": { "resourceRoot": "/v1/organizations", "resourceName": "Organization", "displayProperty": "name" } } }, { "type": "null" } ], "title": "OrganizationID Filter", "description": "Filter by organization ID." }, "description": "Filter by organization ID." }, { "name": "order_id", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string", "format": "uuid4", "description": "The order ID." }, { "type": "array", "items": { "type": "string", "format": "uuid4", "description": "The order ID." } }, { "type": "null" } ], "title": "OrderID Filter", "description": "Filter by order ID." }, "description": "Filter by order ID." }, { "name": "status", "in": "query", "required": false, "schema": { "anyOf": [ { "$ref": "#/components/schemas/DisputeStatus" }, { "type": "array", "items": { "$ref": "#/components/schemas/DisputeStatus" } }, { "type": "null" } ], "title": "Status Filter", "description": "Filter by dispute status." }, "description": "Filter by dispute status." }, { "name": "page", "in": "query", "required": false, "schema": { "type": "integer", "exclusiveMinimum": 0, "description": "Page number, defaults to 1.", "default": 1, "title": "Page" }, "description": "Page number, defaults to 1." }, { "name": "limit", "in": "query", "required": false, "schema": { "type": "integer", "exclusiveMinimum": 0, "description": "Size of a page, defaults to 10. Maximum is 100.", "default": 10, "title": "Limit" }, "description": "Size of a page, defaults to 10. Maximum is 100." }, { "name": "sorting", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "array", "items": { "$ref": "#/components/schemas/DisputeSortProperty" } }, { "type": "null" } ], "description": "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.", "default": [ "-created_at" ], "title": "Sorting" }, "description": "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." } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ListResource_Dispute_" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-pagination": { "type": "offsetLimit", "inputs": [ { "name": "page", "in": "parameters", "type": "page" }, { "name": "limit", "in": "parameters", "type": "limit" } ], "outputs": { "results": "$.items", "numPages": "$.pagination.max_page" } }, "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "disputes", "x-speakeasy-name-override": "list", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Disputes.List(ctx, operations.DisputesListRequest{\n OrganizationID: polargo.Pointer(operations.CreateDisputesListQueryParamOrganizationIDFilterStr(\n \"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n )),\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.ListResourceDispute != nil {\n for {\n // handle items\n\n res, err = res.Next()\n\n if err != nil {\n // handle error\n }\n\n if res == nil {\n break\n }\n }\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.disputes.list(organization_id=\"1dbfc517-0bbf-4301-9ba8-555ca42b9737\", page=1, limit=10)\n\n while res is not None:\n # Handle items\n\n res = res.next()" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.disputes.list({\n organizationId: \"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n });\n\n for await (const page of result) {\n console.log(page);\n }\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Operations;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n$request = new Operations\\DisputesListRequest(\n organizationId: '1dbfc517-0bbf-4301-9ba8-555ca42b9737',\n);\n\n$responses = $sdk->disputes->list(\n request: $request\n);\n\n\nforeach ($responses as $response) {\n if ($response->statusCode === 200) {\n // handle response\n }\n}" } ] } }, "/v1/disputes/{id}": { "get": { "tags": [ "disputes", "public" ], "summary": "Get Dispute", "description": "Get a dispute by ID.\n\n**Scopes**: `disputes:read`", "operationId": "disputes:get", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid4", "description": "The dispute ID.", "title": "Id" }, "description": "The dispute ID." } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Dispute" } } } }, "404": { "description": "Dispute not found.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ResourceNotFound" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "disputes", "x-speakeasy-name-override": "get", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Disputes.Get(ctx, \"\")\n if err != nil {\n log.Fatal(err)\n }\n if res.Dispute != nil {\n // handle response\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.disputes.get(id=\"\")\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.disputes.get({\n id: \"\",\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n\n\n$response = $sdk->disputes->get(\n id: ''\n);\n\nif ($response->dispute !== null) {\n // handle response\n}" } ] } }, "/v1/checkouts/": { "get": { "tags": [ "checkouts", "public" ], "summary": "List Checkout Sessions", "description": "List checkout sessions.\n\n**Scopes**: `checkouts:read` `checkouts:write`", "operationId": "checkouts:list", "parameters": [ { "name": "organization_id", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string", "format": "uuid4", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "description": "The organization ID.", "x-polar-selector-widget": { "resourceRoot": "/v1/organizations", "resourceName": "Organization", "displayProperty": "name" } }, { "type": "array", "items": { "type": "string", "format": "uuid4", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "description": "The organization ID.", "x-polar-selector-widget": { "resourceRoot": "/v1/organizations", "resourceName": "Organization", "displayProperty": "name" } } }, { "type": "null" } ], "title": "OrganizationID Filter", "description": "Filter by organization ID." }, "description": "Filter by organization ID." }, { "name": "product_id", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string", "format": "uuid4", "description": "The product ID.", "x-polar-selector-widget": { "resourceRoot": "/v1/products", "resourceName": "Product", "displayProperty": "name" } }, { "type": "array", "items": { "type": "string", "format": "uuid4", "description": "The product ID.", "x-polar-selector-widget": { "resourceRoot": "/v1/products", "resourceName": "Product", "displayProperty": "name" } } }, { "type": "null" } ], "title": "ProductID Filter", "description": "Filter by product ID." }, "description": "Filter by product ID." }, { "name": "customer_id", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string", "format": "uuid4", "description": "The customer ID." }, { "type": "array", "items": { "type": "string", "format": "uuid4", "description": "The customer ID." } }, { "type": "null" } ], "title": "CustomerID Filter", "description": "Filter by customer ID." }, "description": "Filter by customer ID." }, { "name": "external_customer_id", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string", "description": "The customer external ID." }, { "type": "array", "items": { "type": "string", "description": "The customer external ID." } }, { "type": "null" } ], "title": "ExternalCustomerID Filter", "description": "Filter by customer external ID." }, "description": "Filter by customer external ID." }, { "name": "status", "in": "query", "required": false, "schema": { "anyOf": [ { "$ref": "#/components/schemas/CheckoutStatus" }, { "type": "array", "items": { "$ref": "#/components/schemas/CheckoutStatus" } }, { "type": "null" } ], "title": "Status Filter", "description": "Filter by checkout session status." }, "description": "Filter by checkout session status." }, { "name": "query", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "description": "Filter by customer email.", "title": "Query" }, "description": "Filter by customer email." }, { "name": "page", "in": "query", "required": false, "schema": { "type": "integer", "exclusiveMinimum": 0, "description": "Page number, defaults to 1.", "default": 1, "title": "Page" }, "description": "Page number, defaults to 1." }, { "name": "limit", "in": "query", "required": false, "schema": { "type": "integer", "exclusiveMinimum": 0, "description": "Size of a page, defaults to 10. Maximum is 100.", "default": 10, "title": "Limit" }, "description": "Size of a page, defaults to 10. Maximum is 100." }, { "name": "sorting", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "array", "items": { "$ref": "#/components/schemas/CheckoutSortProperty" } }, { "type": "null" } ], "description": "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.", "default": [ "-created_at" ], "title": "Sorting" }, "description": "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." } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ListResource_Checkout_" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-pagination": { "type": "offsetLimit", "inputs": [ { "name": "page", "in": "parameters", "type": "page" }, { "name": "limit", "in": "parameters", "type": "limit" } ], "outputs": { "results": "$.items", "numPages": "$.pagination.max_page" } }, "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "checkouts", "x-speakeasy-name-override": "list", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Checkouts.List(ctx, operations.CheckoutsListRequest{\n OrganizationID: polargo.Pointer(operations.CreateCheckoutsListQueryParamOrganizationIDFilterStr(\n \"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n )),\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.ListResourceCheckout != nil {\n for {\n // handle items\n\n res, err = res.Next()\n\n if err != nil {\n // handle error\n }\n\n if res == nil {\n break\n }\n }\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.checkouts.list(organization_id=\"1dbfc517-0bbf-4301-9ba8-555ca42b9737\", page=1, limit=10)\n\n while res is not None:\n # Handle items\n\n res = res.next()" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.checkouts.list({\n organizationId: \"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n });\n\n for await (const page of result) {\n console.log(page);\n }\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Operations;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n$request = new Operations\\CheckoutsListRequest(\n organizationId: '1dbfc517-0bbf-4301-9ba8-555ca42b9737',\n);\n\n$responses = $sdk->checkouts->list(\n request: $request\n);\n\n\nforeach ($responses as $response) {\n if ($response->statusCode === 200) {\n // handle response\n }\n}" } ] }, "post": { "tags": [ "checkouts", "public" ], "summary": "Create Checkout Session", "description": "Create a checkout session.\n\n**Scopes**: `checkouts:write`", "operationId": "checkouts:create", "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CheckoutCreate" } } } }, "responses": { "201": { "description": "Checkout session created.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Checkout" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "checkouts", "x-speakeasy-name-override": "create", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Checkouts.Create(ctx, components.CheckoutCreate{\n CustomerName: polargo.Pointer(\"John Doe\"),\n CustomerBillingAddress: &components.AddressInput{\n Country: components.CountryAlpha2InputUs,\n },\n Locale: polargo.Pointer(\"en\"),\n Products: []string{\n \"\",\n \"\",\n \"\",\n },\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.Checkout != nil {\n switch res.Checkout.Discount.Type {\n case components.CheckoutDiscountTypeCheckoutDiscountFixedOnceForeverDuration:\n // res.Checkout.Discount.CheckoutDiscountFixedOnceForeverDuration is populated\n case components.CheckoutDiscountTypeCheckoutDiscountFixedRepeatDuration:\n // res.Checkout.Discount.CheckoutDiscountFixedRepeatDuration is populated\n case components.CheckoutDiscountTypeCheckoutDiscountPercentageOnceForeverDuration:\n // res.Checkout.Discount.CheckoutDiscountPercentageOnceForeverDuration is populated\n case components.CheckoutDiscountTypeCheckoutDiscountPercentageRepeatDuration:\n // res.Checkout.Discount.CheckoutDiscountPercentageRepeatDuration is populated\n }\n\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "import polar_sdk\nfrom polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.checkouts.create(request={\n \"customer_name\": \"John Doe\",\n \"customer_billing_address\": {\n \"country\": polar_sdk.CountryAlpha2Input.US,\n },\n \"locale\": \"en\",\n \"products\": [\n \"\",\n \"\",\n \"\",\n ],\n })\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.checkouts.create({\n customerName: \"John Doe\",\n customerBillingAddress: {\n country: \"US\",\n },\n locale: \"en\",\n products: [\n \"\",\n \"\",\n \"\",\n ],\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Components;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n$request = new Components\\CheckoutCreate(\n customerName: 'John Doe',\n customerBillingAddress: new Components\\AddressInput(\n country: Components\\CountryAlpha2Input::Us,\n ),\n locale: 'en',\n products: [\n '',\n '',\n '',\n ],\n);\n\n$response = $sdk->checkouts->create(\n request: $request\n);\n\nif ($response->checkout !== null) {\n // handle response\n}" } ] } }, "/v1/checkouts/{id}": { "get": { "tags": [ "checkouts", "public" ], "summary": "Get Checkout Session", "description": "Get a checkout session by ID.\n\n**Scopes**: `checkouts:read` `checkouts:write`", "operationId": "checkouts:get", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid4", "description": "The checkout session ID.", "title": "Id" }, "description": "The checkout session ID." } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Checkout" } } } }, "404": { "description": "Checkout session not found.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ResourceNotFound" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "checkouts", "x-speakeasy-name-override": "get", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"log\"\n\t\"github.com/polarsource/polar-go/models/components\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Checkouts.Get(ctx, \"\")\n if err != nil {\n log.Fatal(err)\n }\n if res.Checkout != nil {\n switch res.Checkout.Discount.Type {\n case components.CheckoutDiscountTypeCheckoutDiscountFixedOnceForeverDuration:\n // res.Checkout.Discount.CheckoutDiscountFixedOnceForeverDuration is populated\n case components.CheckoutDiscountTypeCheckoutDiscountFixedRepeatDuration:\n // res.Checkout.Discount.CheckoutDiscountFixedRepeatDuration is populated\n case components.CheckoutDiscountTypeCheckoutDiscountPercentageOnceForeverDuration:\n // res.Checkout.Discount.CheckoutDiscountPercentageOnceForeverDuration is populated\n case components.CheckoutDiscountTypeCheckoutDiscountPercentageRepeatDuration:\n // res.Checkout.Discount.CheckoutDiscountPercentageRepeatDuration is populated\n }\n\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.checkouts.get(id=\"\")\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.checkouts.get({\n id: \"\",\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n\n\n$response = $sdk->checkouts->get(\n id: ''\n);\n\nif ($response->checkout !== null) {\n // handle response\n}" } ] }, "patch": { "tags": [ "checkouts", "public" ], "summary": "Update Checkout Session", "description": "Update a checkout session.\n\n**Scopes**: `checkouts:write`", "operationId": "checkouts:update", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid4", "description": "The checkout session ID.", "title": "Id" }, "description": "The checkout session ID." } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CheckoutUpdate" } } } }, "responses": { "200": { "description": "Checkout session updated.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Checkout" } } } }, "404": { "description": "Checkout session not found.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ResourceNotFound" } } } }, "403": { "description": "The checkout is expired, the customer already has an active subscription, or the organization is not ready to accept payments.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CheckoutForbiddenError" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "checkouts", "x-speakeasy-name-override": "update", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Checkouts.Update(ctx, \"\", components.CheckoutUpdate{\n CustomerName: polargo.Pointer(\"John Doe\"),\n CustomerBillingAddress: &components.AddressInput{\n Country: components.CountryAlpha2InputUs,\n },\n Locale: polargo.Pointer(\"en\"),\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.Checkout != nil {\n switch res.Checkout.Discount.Type {\n case components.CheckoutDiscountTypeCheckoutDiscountFixedOnceForeverDuration:\n // res.Checkout.Discount.CheckoutDiscountFixedOnceForeverDuration is populated\n case components.CheckoutDiscountTypeCheckoutDiscountFixedRepeatDuration:\n // res.Checkout.Discount.CheckoutDiscountFixedRepeatDuration is populated\n case components.CheckoutDiscountTypeCheckoutDiscountPercentageOnceForeverDuration:\n // res.Checkout.Discount.CheckoutDiscountPercentageOnceForeverDuration is populated\n case components.CheckoutDiscountTypeCheckoutDiscountPercentageRepeatDuration:\n // res.Checkout.Discount.CheckoutDiscountPercentageRepeatDuration is populated\n }\n\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "import polar_sdk\nfrom polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.checkouts.update(id=\"\", checkout_update={\n \"customer_name\": \"John Doe\",\n \"customer_billing_address\": {\n \"country\": polar_sdk.CountryAlpha2Input.US,\n },\n \"locale\": \"en\",\n })\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.checkouts.update({\n id: \"\",\n checkoutUpdate: {\n customerName: \"John Doe\",\n customerBillingAddress: {\n country: \"US\",\n },\n locale: \"en\",\n },\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Components;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n$checkoutUpdate = new Components\\CheckoutUpdate(\n customerName: 'John Doe',\n customerBillingAddress: new Components\\AddressInput(\n country: Components\\CountryAlpha2Input::Us,\n ),\n locale: 'en',\n);\n\n$response = $sdk->checkouts->update(\n id: '',\n checkoutUpdate: $checkoutUpdate\n\n);\n\nif ($response->checkout !== null) {\n // handle response\n}" } ] } }, "/v1/checkouts/client/{client_secret}": { "get": { "tags": [ "checkouts", "public" ], "summary": "Get Checkout Session from Client", "description": "Get a checkout session by client secret.", "operationId": "checkouts:client_get", "parameters": [ { "name": "client_secret", "in": "path", "required": true, "schema": { "type": "string", "description": "The checkout session client secret.", "title": "Client Secret" }, "description": "The checkout session client secret." } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CheckoutPublic" } } } }, "404": { "description": "Checkout session not found.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ResourceNotFound" } } } }, "410": { "description": "The checkout session is expired.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ExpiredCheckoutError" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "checkouts", "x-speakeasy-name-override": "client_get", "security": [ {} ], "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"log\"\n\t\"github.com/polarsource/polar-go/models/components\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New()\n\n res, err := s.Checkouts.ClientGet(ctx, \"\")\n if err != nil {\n log.Fatal(err)\n }\n if res.CheckoutPublic != nil {\n switch res.CheckoutPublic.Discount.Type {\n case components.CheckoutPublicDiscountTypeCheckoutDiscountFixedOnceForeverDuration:\n // res.CheckoutPublic.Discount.CheckoutDiscountFixedOnceForeverDuration is populated\n case components.CheckoutPublicDiscountTypeCheckoutDiscountFixedRepeatDuration:\n // res.CheckoutPublic.Discount.CheckoutDiscountFixedRepeatDuration is populated\n case components.CheckoutPublicDiscountTypeCheckoutDiscountPercentageOnceForeverDuration:\n // res.CheckoutPublic.Discount.CheckoutDiscountPercentageOnceForeverDuration is populated\n case components.CheckoutPublicDiscountTypeCheckoutDiscountPercentageRepeatDuration:\n // res.CheckoutPublic.Discount.CheckoutDiscountPercentageRepeatDuration is populated\n }\n\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar() as polar:\n\n res = polar.checkouts.client_get(client_secret=\"\")\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar();\n\nasync function run() {\n const result = await polar.checkouts.clientGet({\n clientSecret: \"\",\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\n\n$sdk = Polar\\Polar::builder()->build();\n\n\n\n$response = $sdk->checkouts->clientGet(\n clientSecret: ''\n);\n\nif ($response->checkoutPublic !== null) {\n // handle response\n}" } ] }, "patch": { "tags": [ "checkouts", "public" ], "summary": "Update Checkout Session from Client", "description": "Update a checkout session by client secret.", "operationId": "checkouts:client_update", "parameters": [ { "name": "client_secret", "in": "path", "required": true, "schema": { "type": "string", "description": "The checkout session client secret.", "title": "Client Secret" }, "description": "The checkout session client secret." } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CheckoutUpdatePublic" } } } }, "responses": { "200": { "description": "Checkout session updated.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CheckoutPublic" } } } }, "404": { "description": "Checkout session not found.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ResourceNotFound" } } } }, "403": { "description": "The checkout is expired, the customer already has an active subscription, or the organization is not ready to accept payments.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CheckoutForbiddenError" } } } }, "410": { "description": "The checkout session is expired.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ExpiredCheckoutError" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "checkouts", "x-speakeasy-name-override": "client_update", "security": [ {} ], "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New()\n\n res, err := s.Checkouts.ClientUpdate(ctx, \"\", components.CheckoutUpdatePublic{\n CustomerName: polargo.Pointer(\"John Doe\"),\n CustomerBillingAddress: &components.AddressInput{\n Country: components.CountryAlpha2InputUs,\n },\n Locale: polargo.Pointer(\"en\"),\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.CheckoutPublic != nil {\n switch res.CheckoutPublic.Discount.Type {\n case components.CheckoutPublicDiscountTypeCheckoutDiscountFixedOnceForeverDuration:\n // res.CheckoutPublic.Discount.CheckoutDiscountFixedOnceForeverDuration is populated\n case components.CheckoutPublicDiscountTypeCheckoutDiscountFixedRepeatDuration:\n // res.CheckoutPublic.Discount.CheckoutDiscountFixedRepeatDuration is populated\n case components.CheckoutPublicDiscountTypeCheckoutDiscountPercentageOnceForeverDuration:\n // res.CheckoutPublic.Discount.CheckoutDiscountPercentageOnceForeverDuration is populated\n case components.CheckoutPublicDiscountTypeCheckoutDiscountPercentageRepeatDuration:\n // res.CheckoutPublic.Discount.CheckoutDiscountPercentageRepeatDuration is populated\n }\n\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar() as polar:\n\n res = polar.checkouts.client_update(client_secret=\"\", checkout_update_public={\n \"customer_name\": \"John Doe\",\n \"customer_billing_address\": None,\n \"locale\": \"en\",\n \"allow_trial\": False,\n })\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar();\n\nasync function run() {\n const result = await polar.checkouts.clientUpdate({\n clientSecret: \"\",\n checkoutUpdatePublic: {\n customerName: \"John Doe\",\n customerBillingAddress: {\n country: \"US\",\n },\n locale: \"en\",\n },\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Components;\n\n$sdk = Polar\\Polar::builder()->build();\n\n$checkoutUpdatePublic = new Components\\CheckoutUpdatePublic(\n customerName: 'John Doe',\n customerBillingAddress: null,\n locale: 'en',\n);\n\n$response = $sdk->checkouts->clientUpdate(\n clientSecret: '',\n checkoutUpdatePublic: $checkoutUpdatePublic\n\n);\n\nif ($response->checkoutPublic !== null) {\n // handle response\n}" } ] } }, "/v1/checkouts/client/{client_secret}/confirm": { "post": { "tags": [ "checkouts", "public" ], "summary": "Confirm Checkout Session from Client", "description": "Confirm a checkout session by client secret.\n\nOrders and subscriptions will be processed.", "operationId": "checkouts:client_confirm", "parameters": [ { "name": "client_secret", "in": "path", "required": true, "schema": { "type": "string", "description": "The checkout session client secret.", "title": "Client Secret" }, "description": "The checkout session client secret." } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CheckoutConfirmStripe" } } } }, "responses": { "200": { "description": "Checkout session confirmed.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CheckoutPublicConfirmed" } } } }, "400": { "description": "The payment failed.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PaymentError" } } } }, "404": { "description": "Checkout session not found.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ResourceNotFound" } } } }, "403": { "description": "The checkout is expired, the customer already has an active subscription, or the organization is not ready to accept payments.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CheckoutForbiddenError" } } } }, "410": { "description": "The checkout session is expired.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ExpiredCheckoutError" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Anonymous", "User" ], "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "checkouts", "x-speakeasy-name-override": "client_confirm", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Checkouts.ClientConfirm(ctx, \"\", components.CheckoutConfirmStripe{\n CustomerName: polargo.Pointer(\"John Doe\"),\n CustomerBillingAddress: &components.AddressInput{\n Country: components.CountryAlpha2InputUs,\n },\n Locale: polargo.Pointer(\"en\"),\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.CheckoutPublicConfirmed != nil {\n switch res.CheckoutPublicConfirmed.Discount.Type {\n case components.CheckoutPublicConfirmedDiscountTypeCheckoutDiscountFixedOnceForeverDuration:\n // res.CheckoutPublicConfirmed.Discount.CheckoutDiscountFixedOnceForeverDuration is populated\n case components.CheckoutPublicConfirmedDiscountTypeCheckoutDiscountFixedRepeatDuration:\n // res.CheckoutPublicConfirmed.Discount.CheckoutDiscountFixedRepeatDuration is populated\n case components.CheckoutPublicConfirmedDiscountTypeCheckoutDiscountPercentageOnceForeverDuration:\n // res.CheckoutPublicConfirmed.Discount.CheckoutDiscountPercentageOnceForeverDuration is populated\n case components.CheckoutPublicConfirmedDiscountTypeCheckoutDiscountPercentageRepeatDuration:\n // res.CheckoutPublicConfirmed.Discount.CheckoutDiscountPercentageRepeatDuration is populated\n }\n\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "import polar_sdk\nfrom polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.checkouts.client_confirm(client_secret=\"\", checkout_confirm_stripe={\n \"customer_name\": \"John Doe\",\n \"customer_billing_address\": {\n \"country\": polar_sdk.CountryAlpha2Input.US,\n },\n \"locale\": \"en\",\n \"allow_trial\": False,\n })\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.checkouts.clientConfirm({\n clientSecret: \"\",\n checkoutConfirmStripe: {\n customerName: \"John Doe\",\n customerBillingAddress: {\n country: \"US\",\n },\n locale: \"en\",\n },\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Components;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n$checkoutConfirmStripe = new Components\\CheckoutConfirmStripe(\n customerName: 'John Doe',\n customerBillingAddress: new Components\\AddressInput(\n country: Components\\CountryAlpha2Input::Us,\n ),\n locale: 'en',\n);\n\n$response = $sdk->checkouts->clientConfirm(\n clientSecret: '',\n checkoutConfirmStripe: $checkoutConfirmStripe\n\n);\n\nif ($response->checkoutPublicConfirmed !== null) {\n // handle response\n}" } ] } }, "/v1/files/": { "get": { "tags": [ "files", "public" ], "summary": "List Files", "description": "List files.\n\n**Scopes**: `files:read` `files:write`", "operationId": "files:list", "parameters": [ { "name": "organization_id", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string", "format": "uuid4", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "description": "The organization ID.", "x-polar-selector-widget": { "resourceRoot": "/v1/organizations", "resourceName": "Organization", "displayProperty": "name" } }, { "type": "array", "items": { "type": "string", "format": "uuid4", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "description": "The organization ID.", "x-polar-selector-widget": { "resourceRoot": "/v1/organizations", "resourceName": "Organization", "displayProperty": "name" } } }, { "type": "null" } ], "title": "OrganizationID Filter", "description": "Filter by organization ID." }, "description": "Filter by organization ID." }, { "name": "ids", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "array", "items": { "type": "string", "format": "uuid4" } }, { "type": "null" } ], "title": "FileID Filter", "description": "Filter by file ID." }, "description": "Filter by file ID." }, { "name": "page", "in": "query", "required": false, "schema": { "type": "integer", "exclusiveMinimum": 0, "description": "Page number, defaults to 1.", "default": 1, "title": "Page" }, "description": "Page number, defaults to 1." }, { "name": "limit", "in": "query", "required": false, "schema": { "type": "integer", "exclusiveMinimum": 0, "description": "Size of a page, defaults to 10. Maximum is 100.", "default": 10, "title": "Limit" }, "description": "Size of a page, defaults to 10. Maximum is 100." } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ListResource_FileRead_" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-pagination": { "type": "offsetLimit", "inputs": [ { "name": "page", "in": "parameters", "type": "page" }, { "name": "limit", "in": "parameters", "type": "limit" } ], "outputs": { "results": "$.items", "numPages": "$.pagination.max_page" } }, "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "files", "x-speakeasy-name-override": "list", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Files.List(ctx, polargo.Pointer(operations.CreateFilesListQueryParamOrganizationIDFilterStr(\n \"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n )), nil, polargo.Pointer[int64](1), polargo.Pointer[int64](10))\n if err != nil {\n log.Fatal(err)\n }\n if res.ListResourceFileRead != nil {\n for {\n // handle items\n\n res, err = res.Next()\n\n if err != nil {\n // handle error\n }\n\n if res == nil {\n break\n }\n }\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.files.list(organization_id=\"1dbfc517-0bbf-4301-9ba8-555ca42b9737\", page=1, limit=10)\n\n while res is not None:\n # Handle items\n\n res = res.next()" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.files.list({\n organizationId: \"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n });\n\n for await (const page of result) {\n console.log(page);\n }\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n\n\n$responses = $sdk->files->list(\n organizationId: '1dbfc517-0bbf-4301-9ba8-555ca42b9737',\n page: 1,\n limit: 10\n\n);\n\n\nforeach ($responses as $response) {\n if ($response->statusCode === 200) {\n // handle response\n }\n}" } ] }, "post": { "tags": [ "files", "public" ], "summary": "Create File", "description": "Create a file.\n\n**Scopes**: `files:write`", "operationId": "files:create", "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/FileCreate" } } } }, "responses": { "201": { "description": "File created.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/FileUpload" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "files", "x-speakeasy-name-override": "create", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Files.Create(ctx, components.CreateFileCreateDownloadable(\n components.DownloadableFileCreate{\n OrganizationID: polargo.Pointer(\"1dbfc517-0bbf-4301-9ba8-555ca42b9737\"),\n Name: \"\",\n MimeType: \"\",\n Size: 612128,\n Upload: components.S3FileCreateMultipart{\n Parts: []components.S3FileCreatePart{},\n },\n },\n ))\n if err != nil {\n log.Fatal(err)\n }\n if res.FileUpload != nil {\n // handle response\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.files.create(request={\n \"name\": \"\",\n \"mime_type\": \"\",\n \"size\": 612128,\n \"upload\": {\n \"parts\": [],\n },\n \"service\": \"downloadable\",\n })\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.files.create({\n organizationId: \"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n name: \"\",\n mimeType: \"\",\n size: 612128,\n upload: {\n parts: [],\n },\n service: \"downloadable\",\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Components;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n$request = new Components\\DownloadableFileCreate(\n organizationId: '1dbfc517-0bbf-4301-9ba8-555ca42b9737',\n name: '',\n mimeType: '',\n size: 612128,\n upload: new Components\\S3FileCreateMultipart(\n parts: [],\n ),\n);\n\n$response = $sdk->files->create(\n request: $request\n);\n\nif ($response->fileUpload !== null) {\n // handle response\n}" } ] } }, "/v1/files/{id}/uploaded": { "post": { "tags": [ "files", "public" ], "summary": "Complete File Upload", "description": "Complete a file upload.\n\n**Scopes**: `files:write`", "operationId": "files:uploaded", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid4", "description": "The file ID.", "title": "Id" }, "description": "The file ID." } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/FileUploadCompleted" } } } }, "responses": { "200": { "description": "File upload completed.", "content": { "application/json": { "schema": { "oneOf": [ { "$ref": "#/components/schemas/DownloadableFileRead" }, { "$ref": "#/components/schemas/ProductMediaFileRead" }, { "$ref": "#/components/schemas/OrganizationAvatarFileRead" } ], "discriminator": { "propertyName": "service", "mapping": { "downloadable": "#/components/schemas/DownloadableFileRead", "product_media": "#/components/schemas/ProductMediaFileRead", "organization_avatar": "#/components/schemas/OrganizationAvatarFileRead" } }, "title": "Response Files:Uploaded" } } } }, "403": { "description": "You don't have the permission to update this file.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/NotPermitted" } } } }, "404": { "description": "File not found.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ResourceNotFound" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "files", "x-speakeasy-name-override": "uploaded", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"log\"\n\t\"github.com/polarsource/polar-go/models/operations\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Files.Uploaded(ctx, \"\", components.FileUploadCompleted{\n ID: \"\",\n Path: \"/boot\",\n Parts: []components.S3FileUploadCompletedPart{\n components.S3FileUploadCompletedPart{\n Number: 979613,\n ChecksumEtag: \"\",\n ChecksumSha256Base64: polargo.Pointer(\"\"),\n },\n components.S3FileUploadCompletedPart{\n Number: 979613,\n ChecksumEtag: \"\",\n ChecksumSha256Base64: polargo.Pointer(\"\"),\n },\n components.S3FileUploadCompletedPart{\n Number: 979613,\n ChecksumEtag: \"\",\n ChecksumSha256Base64: polargo.Pointer(\"\"),\n },\n },\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.ResponseFilesUploaded != nil {\n switch res.ResponseFilesUploaded.Type {\n case operations.FilesUploadedResponseFilesUploadedTypeDownloadable:\n // res.ResponseFilesUploaded.DownloadableFileRead is populated\n case operations.FilesUploadedResponseFilesUploadedTypeProductMedia:\n // res.ResponseFilesUploaded.ProductMediaFileRead is populated\n case operations.FilesUploadedResponseFilesUploadedTypeOrganizationAvatar:\n // res.ResponseFilesUploaded.OrganizationAvatarFileRead is populated\n }\n\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.files.uploaded(id=\"\", file_upload_completed={\n \"id\": \"\",\n \"path\": \"/boot\",\n \"parts\": [\n {\n \"number\": 979613,\n \"checksum_etag\": \"\",\n \"checksum_sha256_base64\": \"\",\n },\n ],\n })\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.files.uploaded({\n id: \"\",\n fileUploadCompleted: {\n id: \"\",\n path: \"/boot\",\n parts: [\n {\n number: 979613,\n checksumEtag: \"\",\n checksumSha256Base64: \"\",\n },\n {\n number: 979613,\n checksumEtag: \"\",\n checksumSha256Base64: \"\",\n },\n {\n number: 979613,\n checksumEtag: \"\",\n checksumSha256Base64: \"\",\n },\n ],\n },\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Components;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n$fileUploadCompleted = new Components\\FileUploadCompleted(\n id: '',\n path: '/boot',\n parts: [\n new Components\\S3FileUploadCompletedPart(\n number: 979613,\n checksumEtag: '',\n checksumSha256Base64: '',\n ),\n new Components\\S3FileUploadCompletedPart(\n number: 979613,\n checksumEtag: '',\n checksumSha256Base64: '',\n ),\n new Components\\S3FileUploadCompletedPart(\n number: 979613,\n checksumEtag: '',\n checksumSha256Base64: '',\n ),\n ],\n);\n\n$response = $sdk->files->uploaded(\n id: '',\n fileUploadCompleted: $fileUploadCompleted\n\n);\n\nif ($response->responseFilesUploaded !== null) {\n // handle response\n}" } ] } }, "/v1/files/{id}": { "patch": { "tags": [ "files", "public" ], "summary": "Update File", "description": "Update a file.\n\n**Scopes**: `files:write`", "operationId": "files:update", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid4", "description": "The file ID.", "title": "Id" }, "description": "The file ID." } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/FilePatch" } } } }, "responses": { "200": { "description": "File updated.", "content": { "application/json": { "schema": { "oneOf": [ { "$ref": "#/components/schemas/DownloadableFileRead" }, { "$ref": "#/components/schemas/ProductMediaFileRead" }, { "$ref": "#/components/schemas/OrganizationAvatarFileRead" } ], "discriminator": { "propertyName": "service", "mapping": { "downloadable": "#/components/schemas/DownloadableFileRead", "product_media": "#/components/schemas/ProductMediaFileRead", "organization_avatar": "#/components/schemas/OrganizationAvatarFileRead" } }, "title": "Response Files:Update" } } } }, "403": { "description": "You don't have the permission to update this file.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/NotPermitted" } } } }, "404": { "description": "File not found.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ResourceNotFound" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "files", "x-speakeasy-name-override": "update", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"log\"\n\t\"github.com/polarsource/polar-go/models/operations\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Files.Update(ctx, \"\", components.FilePatch{})\n if err != nil {\n log.Fatal(err)\n }\n if res.ResponseFilesUpdate != nil {\n switch res.ResponseFilesUpdate.Type {\n case operations.FilesUpdateResponseFilesUpdateTypeDownloadable:\n // res.ResponseFilesUpdate.DownloadableFileRead is populated\n case operations.FilesUpdateResponseFilesUpdateTypeProductMedia:\n // res.ResponseFilesUpdate.ProductMediaFileRead is populated\n case operations.FilesUpdateResponseFilesUpdateTypeOrganizationAvatar:\n // res.ResponseFilesUpdate.OrganizationAvatarFileRead is populated\n }\n\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.files.update(id=\"\", file_patch={})\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.files.update({\n id: \"\",\n filePatch: {},\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Components;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n$filePatch = new Components\\FilePatch();\n\n$response = $sdk->files->update(\n id: '',\n filePatch: $filePatch\n\n);\n\nif ($response->responseFilesUpdate !== null) {\n // handle response\n}" } ] }, "delete": { "tags": [ "files", "public" ], "summary": "Delete File", "description": "Delete a file.\n\n**Scopes**: `files:write`", "operationId": "files:delete", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid4", "title": "Id" } } ], "responses": { "204": { "description": "File deleted." }, "403": { "description": "You don't have the permission to delete this file.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/NotPermitted" } } } }, "404": { "description": "File not found.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ResourceNotFound" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "files", "x-speakeasy-name-override": "delete", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Files.Delete(ctx, \"\")\n if err != nil {\n log.Fatal(err)\n }\n if res != nil {\n // handle response\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n polar.files.delete(id=\"\")\n\n # Use the SDK ..." }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n await polar.files.delete({\n id: \"\",\n });\n\n\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n\n\n$response = $sdk->files->delete(\n id: ''\n);\n\nif ($response->statusCode === 200) {\n // handle response\n}" } ] } }, "/v1/metrics/": { "get": { "tags": [ "metrics", "public", "mcp" ], "summary": "Get Metrics", "description": "Get metrics about your orders and subscriptions.\n\nCurrency values are output in cents.\n\n**Scopes**: `metrics:read`", "operationId": "metrics:get", "parameters": [ { "name": "start_date", "in": "query", "required": true, "schema": { "type": "string", "format": "date", "description": "Start date.", "title": "Start Date" }, "description": "Start date." }, { "name": "end_date", "in": "query", "required": true, "schema": { "type": "string", "format": "date", "description": "End date.", "title": "End Date" }, "description": "End date." }, { "name": "timezone", "in": "query", "required": false, "schema": { "type": "string", "minLength": 1, "description": "Timezone to use for the timestamps. Default is UTC.", "default": "UTC", "title": "Timezone" }, "description": "Timezone to use for the timestamps. Default is UTC." }, { "name": "interval", "in": "query", "required": true, "schema": { "$ref": "#/components/schemas/TimeInterval", "description": "Interval between two timestamps." }, "description": "Interval between two timestamps." }, { "name": "organization_id", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string", "format": "uuid4", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "description": "The organization ID.", "x-polar-selector-widget": { "resourceRoot": "/v1/organizations", "resourceName": "Organization", "displayProperty": "name" } }, { "type": "array", "items": { "type": "string", "format": "uuid4", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "description": "The organization ID.", "x-polar-selector-widget": { "resourceRoot": "/v1/organizations", "resourceName": "Organization", "displayProperty": "name" } } }, { "type": "null" } ], "title": "OrganizationID Filter", "description": "Filter by organization ID." }, "description": "Filter by organization ID." }, { "name": "product_id", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string", "format": "uuid4", "description": "The product ID.", "x-polar-selector-widget": { "resourceRoot": "/v1/products", "resourceName": "Product", "displayProperty": "name" } }, { "type": "array", "items": { "type": "string", "format": "uuid4", "description": "The product ID.", "x-polar-selector-widget": { "resourceRoot": "/v1/products", "resourceName": "Product", "displayProperty": "name" } } }, { "type": "null" } ], "title": "ProductID Filter", "description": "Filter by product ID." }, "description": "Filter by product ID." }, { "name": "billing_type", "in": "query", "required": false, "schema": { "anyOf": [ { "$ref": "#/components/schemas/ProductBillingType" }, { "type": "array", "items": { "$ref": "#/components/schemas/ProductBillingType" } }, { "type": "null" } ], "title": "ProductBillingType Filter", "description": "Filter by billing type. `recurring` will filter data corresponding to subscriptions creations or renewals. `one_time` will filter data corresponding to one-time purchases." }, "description": "Filter by billing type. `recurring` will filter data corresponding to subscriptions creations or renewals. `one_time` will filter data corresponding to one-time purchases." }, { "name": "customer_id", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string", "format": "uuid4", "description": "The customer ID." }, { "type": "array", "items": { "type": "string", "format": "uuid4", "description": "The customer ID." } }, { "type": "null" } ], "title": "CustomerID Filter", "description": "Filter by customer ID." }, "description": "Filter by customer ID." }, { "name": "metrics", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "array", "items": { "type": "string" } }, { "type": "null" } ], "title": "Metrics", "description": "List of metric slugs to focus on. When provided, only the queries needed for these metrics will be executed, improving performance. If not provided, all metrics are returned." }, "description": "List of metric slugs to focus on. When provided, only the queries needed for these metrics will be executed, improving performance. If not provided, all metrics are returned." } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/MetricsResponse" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-mcp": { "disabled": false, "scopes": [ "read", "metrics" ] }, "x-speakeasy-group": "metrics", "x-speakeasy-name-override": "get", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/types\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"github.com/polarsource/polar-go/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Metrics.Get(ctx, operations.MetricsGetRequest{\n StartDate: types.MustDateFromString(\"2025-03-14\"),\n EndDate: types.MustDateFromString(\"2025-03-18\"),\n Interval: components.TimeIntervalHour,\n OrganizationID: polargo.Pointer(operations.CreateMetricsGetQueryParamOrganizationIDFilterStr(\n \"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n )),\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.MetricsResponse != nil {\n // handle response\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from datetime import date\nimport polar_sdk\nfrom polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.metrics.get(start_date=date.fromisoformat(\"2026-03-14\"), end_date=date.fromisoformat(\"2026-03-18\"), interval=polar_sdk.TimeInterval.HOUR, timezone=\"UTC\", organization_id=None)\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\nimport { RFCDate } from \"@polar-sh/sdk/types/rfcdate.js\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.metrics.get({\n startDate: new RFCDate(\"2025-03-14\"),\n endDate: new RFCDate(\"2025-03-18\"),\n interval: \"hour\",\n organizationId: \"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Brick\\DateTime\\LocalDate;\nuse Polar;\nuse Polar\\Models\\Components;\nuse Polar\\Models\\Operations;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n$request = new Operations\\MetricsGetRequest(\n startDate: LocalDate::parse('2025-03-14'),\n endDate: LocalDate::parse('2025-03-18'),\n interval: Components\\TimeInterval::Hour,\n organizationId: '1dbfc517-0bbf-4301-9ba8-555ca42b9737',\n);\n\n$response = $sdk->metrics->get(\n request: $request\n);\n\nif ($response->metricsResponse !== null) {\n // handle response\n}" } ] } }, "/v1/metrics/limits": { "get": { "tags": [ "metrics", "public", "mcp" ], "summary": "Get Metrics Limits", "description": "Get the interval limits for the metrics endpoint.\n\n**Scopes**: `metrics:read`", "operationId": "metrics:limits", "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/MetricsLimits" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-mcp": { "disabled": false, "scopes": [ "read", "metrics" ] }, "x-speakeasy-group": "metrics", "x-speakeasy-name-override": "limits", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Metrics.Limits(ctx)\n if err != nil {\n log.Fatal(err)\n }\n if res.MetricsLimits != nil {\n // handle response\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.metrics.limits()\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.metrics.limits();\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n\n\n$response = $sdk->metrics->limits(\n\n);\n\nif ($response->metricsLimits !== null) {\n // handle response\n}" } ] } }, "/v1/license-keys/": { "get": { "tags": [ "license_keys", "public" ], "summary": "List License Keys", "description": "Get license keys connected to the given organization & filters.\n\n**Scopes**: `license_keys:read` `license_keys:write`", "operationId": "license_keys:list", "parameters": [ { "name": "organization_id", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string", "format": "uuid4", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "description": "The organization ID.", "x-polar-selector-widget": { "resourceRoot": "/v1/organizations", "resourceName": "Organization", "displayProperty": "name" } }, { "type": "array", "items": { "type": "string", "format": "uuid4", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "description": "The organization ID.", "x-polar-selector-widget": { "resourceRoot": "/v1/organizations", "resourceName": "Organization", "displayProperty": "name" } } }, { "type": "null" } ], "title": "OrganizationID Filter", "description": "Filter by organization ID." }, "description": "Filter by organization ID." }, { "name": "benefit_id", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string", "format": "uuid4", "description": "The benefit ID.", "x-polar-selector-widget": { "resourceRoot": "/v1/benefits", "resourceName": "Benefit", "displayProperty": "description" } }, { "type": "array", "items": { "type": "string", "format": "uuid4", "description": "The benefit ID.", "x-polar-selector-widget": { "resourceRoot": "/v1/benefits", "resourceName": "Benefit", "displayProperty": "description" } } }, { "type": "null" } ], "title": "BenefitID Filter", "description": "Filter by benefit ID." }, "description": "Filter by benefit ID." }, { "name": "page", "in": "query", "required": false, "schema": { "type": "integer", "exclusiveMinimum": 0, "description": "Page number, defaults to 1.", "default": 1, "title": "Page" }, "description": "Page number, defaults to 1." }, { "name": "limit", "in": "query", "required": false, "schema": { "type": "integer", "exclusiveMinimum": 0, "description": "Size of a page, defaults to 10. Maximum is 100.", "default": 10, "title": "Limit" }, "description": "Size of a page, defaults to 10. Maximum is 100." } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ListResource_LicenseKeyRead_" } } } }, "401": { "description": "Not authorized to manage license key.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Unauthorized" } } } }, "404": { "description": "License key not found.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ResourceNotFound" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-pagination": { "type": "offsetLimit", "inputs": [ { "name": "page", "in": "parameters", "type": "page" }, { "name": "limit", "in": "parameters", "type": "limit" } ], "outputs": { "results": "$.items", "numPages": "$.pagination.max_page" } }, "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "license_keys", "x-speakeasy-name-override": "list", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.LicenseKeys.List(ctx, polargo.Pointer(operations.CreateLicenseKeysListQueryParamOrganizationIDFilterStr(\n \"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n )), nil, polargo.Pointer[int64](1), polargo.Pointer[int64](10))\n if err != nil {\n log.Fatal(err)\n }\n if res.ListResourceLicenseKeyRead != nil {\n for {\n // handle items\n\n res, err = res.Next()\n\n if err != nil {\n // handle error\n }\n\n if res == nil {\n break\n }\n }\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.license_keys.list(organization_id=\"1dbfc517-0bbf-4301-9ba8-555ca42b9737\", page=1, limit=10)\n\n while res is not None:\n # Handle items\n\n res = res.next()" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.licenseKeys.list({\n organizationId: \"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n });\n\n for await (const page of result) {\n console.log(page);\n }\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n\n\n$responses = $sdk->licenseKeys->list(\n organizationId: '1dbfc517-0bbf-4301-9ba8-555ca42b9737',\n page: 1,\n limit: 10\n\n);\n\n\nforeach ($responses as $response) {\n if ($response->statusCode === 200) {\n // handle response\n }\n}" } ] } }, "/v1/license-keys/{id}": { "get": { "tags": [ "license_keys", "public" ], "summary": "Get License Key", "description": "Get a license key.\n\n**Scopes**: `license_keys:read` `license_keys:write`", "operationId": "license_keys:get", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid4", "title": "Id" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/LicenseKeyWithActivations" } } } }, "401": { "description": "Not authorized to manage license key.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Unauthorized" } } } }, "404": { "description": "License key not found.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ResourceNotFound" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "license_keys", "x-speakeasy-name-override": "get", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.LicenseKeys.Get(ctx, \"\")\n if err != nil {\n log.Fatal(err)\n }\n if res.LicenseKeyWithActivations != nil {\n // handle response\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.license_keys.get(id=\"\")\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.licenseKeys.get({\n id: \"\",\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n\n\n$response = $sdk->licenseKeys->get(\n id: ''\n);\n\nif ($response->licenseKeyWithActivations !== null) {\n // handle response\n}" } ] }, "patch": { "tags": [ "license_keys", "public" ], "summary": "Update License Key", "description": "Update a license key.\n\n**Scopes**: `license_keys:write`", "operationId": "license_keys:update", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid4", "title": "Id" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/LicenseKeyUpdate" } } } }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/LicenseKeyRead" } } } }, "401": { "description": "Not authorized to manage license key.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Unauthorized" } } } }, "404": { "description": "License key not found.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ResourceNotFound" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "license_keys", "x-speakeasy-name-override": "update", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.LicenseKeys.Update(ctx, \"\", components.LicenseKeyUpdate{})\n if err != nil {\n log.Fatal(err)\n }\n if res.LicenseKeyRead != nil {\n // handle response\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.license_keys.update(id=\"\", license_key_update={})\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.licenseKeys.update({\n id: \"\",\n licenseKeyUpdate: {},\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Components;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n$licenseKeyUpdate = new Components\\LicenseKeyUpdate();\n\n$response = $sdk->licenseKeys->update(\n id: '',\n licenseKeyUpdate: $licenseKeyUpdate\n\n);\n\nif ($response->licenseKeyRead !== null) {\n // handle response\n}" } ] } }, "/v1/license-keys/{id}/activations/{activation_id}": { "get": { "tags": [ "license_keys", "public" ], "summary": "Get Activation", "description": "Get a license key activation.\n\n**Scopes**: `license_keys:read` `license_keys:write`", "operationId": "license_keys:get_activation", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid4", "title": "Id" } }, { "name": "activation_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid4", "title": "Activation Id" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/LicenseKeyActivationRead" } } } }, "401": { "description": "Not authorized to manage license key.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Unauthorized" } } } }, "404": { "description": "License key not found.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ResourceNotFound" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "license_keys", "x-speakeasy-name-override": "get_activation", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.LicenseKeys.GetActivation(ctx, \"\", \"\")\n if err != nil {\n log.Fatal(err)\n }\n if res.LicenseKeyActivationRead != nil {\n // handle response\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.license_keys.get_activation(id=\"\", activation_id=\"\")\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.licenseKeys.getActivation({\n id: \"\",\n activationId: \"\",\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n\n\n$response = $sdk->licenseKeys->getActivation(\n id: '',\n activationId: ''\n\n);\n\nif ($response->licenseKeyActivationRead !== null) {\n // handle response\n}" } ] } }, "/v1/license-keys/validate": { "post": { "tags": [ "license_keys", "public" ], "summary": "Validate License Key", "description": "Validate a license key.\n\n**Scopes**: `license_keys:write`", "operationId": "license_keys:validate", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/LicenseKeyValidate" } } }, "required": true }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ValidatedLicenseKey" } } } }, "404": { "description": "License key not found.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ResourceNotFound" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "license_keys", "x-speakeasy-name-override": "validate", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.LicenseKeys.Validate(ctx, components.LicenseKeyValidate{\n Key: \"\",\n OrganizationID: \"\",\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.ValidatedLicenseKey != nil {\n // handle response\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.license_keys.validate(request={\n \"key\": \"\",\n \"organization_id\": \"\",\n })\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.licenseKeys.validate({\n key: \"\",\n organizationId: \"\",\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Components;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n$request = new Components\\LicenseKeyValidate(\n key: '',\n organizationId: '',\n);\n\n$response = $sdk->licenseKeys->validate(\n request: $request\n);\n\nif ($response->validatedLicenseKey !== null) {\n // handle response\n}" } ] } }, "/v1/license-keys/activate": { "post": { "tags": [ "license_keys", "public" ], "summary": "Activate License Key", "description": "Activate a license key instance.\n\n**Scopes**: `license_keys:write`", "operationId": "license_keys:activate", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/LicenseKeyActivate" } } }, "required": true }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/LicenseKeyActivationRead" } } } }, "403": { "description": "License key activation not supported or limit reached. Use /validate endpoint for licenses without activations.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/NotPermitted" } } } }, "404": { "description": "License key not found.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ResourceNotFound" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "license_keys", "x-speakeasy-name-override": "activate", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.LicenseKeys.Activate(ctx, components.LicenseKeyActivate{\n Key: \"\",\n OrganizationID: \"\",\n Label: \"\",\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.LicenseKeyActivationRead != nil {\n // handle response\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.license_keys.activate(request={\n \"key\": \"\",\n \"organization_id\": \"\",\n \"label\": \"\",\n })\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.licenseKeys.activate({\n key: \"\",\n organizationId: \"\",\n label: \"\",\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Components;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n$request = new Components\\LicenseKeyActivate(\n key: '',\n organizationId: '',\n label: '',\n);\n\n$response = $sdk->licenseKeys->activate(\n request: $request\n);\n\nif ($response->licenseKeyActivationRead !== null) {\n // handle response\n}" } ] } }, "/v1/license-keys/deactivate": { "post": { "tags": [ "license_keys", "public" ], "summary": "Deactivate License Key", "description": "Deactivate a license key instance.\n\n**Scopes**: `license_keys:write`", "operationId": "license_keys:deactivate", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/LicenseKeyDeactivate" } } }, "required": true }, "responses": { "204": { "description": "License key activation deactivated." }, "404": { "description": "License key not found.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ResourceNotFound" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "license_keys", "x-speakeasy-name-override": "deactivate", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.LicenseKeys.Deactivate(ctx, components.LicenseKeyDeactivate{\n Key: \"\",\n OrganizationID: \"\",\n ActivationID: \"\",\n })\n if err != nil {\n log.Fatal(err)\n }\n if res != nil {\n // handle response\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n polar.license_keys.deactivate(request={\n \"key\": \"\",\n \"organization_id\": \"\",\n \"activation_id\": \"\",\n })\n\n # Use the SDK ..." }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n await polar.licenseKeys.deactivate({\n key: \"\",\n organizationId: \"\",\n activationId: \"\",\n });\n\n\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Components;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n$request = new Components\\LicenseKeyDeactivate(\n key: '',\n organizationId: '',\n activationId: '',\n);\n\n$response = $sdk->licenseKeys->deactivate(\n request: $request\n);\n\nif ($response->statusCode === 200) {\n // handle response\n}" } ] } }, "/v1/checkout-links/": { "get": { "tags": [ "checkout-links", "public" ], "summary": "List Checkout Links", "description": "List checkout links.\n\n**Scopes**: `checkout_links:read` `checkout_links:write`", "operationId": "checkout-links:list", "parameters": [ { "name": "organization_id", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string", "format": "uuid4", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "description": "The organization ID.", "x-polar-selector-widget": { "resourceRoot": "/v1/organizations", "resourceName": "Organization", "displayProperty": "name" } }, { "type": "array", "items": { "type": "string", "format": "uuid4", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "description": "The organization ID.", "x-polar-selector-widget": { "resourceRoot": "/v1/organizations", "resourceName": "Organization", "displayProperty": "name" } } }, { "type": "null" } ], "title": "OrganizationID Filter", "description": "Filter by organization ID." }, "description": "Filter by organization ID." }, { "name": "product_id", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string", "format": "uuid4", "description": "The product ID.", "x-polar-selector-widget": { "resourceRoot": "/v1/products", "resourceName": "Product", "displayProperty": "name" } }, { "type": "array", "items": { "type": "string", "format": "uuid4", "description": "The product ID.", "x-polar-selector-widget": { "resourceRoot": "/v1/products", "resourceName": "Product", "displayProperty": "name" } } }, { "type": "null" } ], "title": "ProductID Filter", "description": "Filter by product ID." }, "description": "Filter by product ID." }, { "name": "page", "in": "query", "required": false, "schema": { "type": "integer", "exclusiveMinimum": 0, "description": "Page number, defaults to 1.", "default": 1, "title": "Page" }, "description": "Page number, defaults to 1." }, { "name": "limit", "in": "query", "required": false, "schema": { "type": "integer", "exclusiveMinimum": 0, "description": "Size of a page, defaults to 10. Maximum is 100.", "default": 10, "title": "Limit" }, "description": "Size of a page, defaults to 10. Maximum is 100." }, { "name": "sorting", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "array", "items": { "$ref": "#/components/schemas/CheckoutLinkSortProperty" } }, { "type": "null" } ], "description": "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.", "default": [ "created_at" ], "title": "Sorting" }, "description": "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." } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ListResource_CheckoutLink_" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-pagination": { "type": "offsetLimit", "inputs": [ { "name": "page", "in": "parameters", "type": "page" }, { "name": "limit", "in": "parameters", "type": "limit" } ], "outputs": { "results": "$.items", "numPages": "$.pagination.max_page" } }, "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "checkout-links", "x-speakeasy-name-override": "list", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.CheckoutLinks.List(ctx, operations.CheckoutLinksListRequest{\n OrganizationID: polargo.Pointer(operations.CreateCheckoutLinksListQueryParamOrganizationIDFilterStr(\n \"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n )),\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.ListResourceCheckoutLink != nil {\n for {\n // handle items\n\n res, err = res.Next()\n\n if err != nil {\n // handle error\n }\n\n if res == nil {\n break\n }\n }\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.checkout_links.list(organization_id=\"1dbfc517-0bbf-4301-9ba8-555ca42b9737\", page=1, limit=10)\n\n while res is not None:\n # Handle items\n\n res = res.next()" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.checkoutLinks.list({\n organizationId: \"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n });\n\n for await (const page of result) {\n console.log(page);\n }\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Operations;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n$request = new Operations\\CheckoutLinksListRequest(\n organizationId: '1dbfc517-0bbf-4301-9ba8-555ca42b9737',\n);\n\n$responses = $sdk->checkoutLinks->list(\n request: $request\n);\n\n\nforeach ($responses as $response) {\n if ($response->statusCode === 200) {\n // handle response\n }\n}" } ] }, "post": { "tags": [ "checkout-links", "public" ], "summary": "Create Checkout Link", "description": "Create a checkout link.\n\n**Scopes**: `checkout_links:write`", "operationId": "checkout-links:create", "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CheckoutLinkCreate" } } } }, "responses": { "201": { "description": "Checkout link created.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CheckoutLink" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "checkout-links", "x-speakeasy-name-override": "create", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.CheckoutLinks.Create(ctx, components.CreateCheckoutLinkCreateCheckoutLinkCreateProductPrice(\n components.CheckoutLinkCreateProductPrice{\n ProductPriceID: \"\",\n },\n ))\n if err != nil {\n log.Fatal(err)\n }\n if res.CheckoutLink != nil {\n switch res.CheckoutLink.Discount.Type {\n case components.CheckoutLinkDiscountTypeDiscountFixedOnceForeverDurationBase:\n // res.CheckoutLink.Discount.DiscountFixedOnceForeverDurationBase is populated\n case components.CheckoutLinkDiscountTypeDiscountFixedRepeatDurationBase:\n // res.CheckoutLink.Discount.DiscountFixedRepeatDurationBase is populated\n case components.CheckoutLinkDiscountTypeDiscountPercentageOnceForeverDurationBase:\n // res.CheckoutLink.Discount.DiscountPercentageOnceForeverDurationBase is populated\n case components.CheckoutLinkDiscountTypeDiscountPercentageRepeatDurationBase:\n // res.CheckoutLink.Discount.DiscountPercentageRepeatDurationBase is populated\n }\n\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.checkout_links.create(request={\n \"payment_processor\": \"stripe\",\n \"allow_discount_codes\": True,\n \"require_billing_address\": False,\n \"product_price_id\": \"\",\n })\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.checkoutLinks.create({\n paymentProcessor: \"stripe\",\n allowDiscountCodes: true,\n requireBillingAddress: false,\n productPriceId: \"\",\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Components;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n$request = new Components\\CheckoutLinkCreateProductPrice(\n productPriceId: '',\n);\n\n$response = $sdk->checkoutLinks->create(\n request: $request\n);\n\nif ($response->checkoutLink !== null) {\n // handle response\n}" } ] } }, "/v1/checkout-links/{id}": { "get": { "tags": [ "checkout-links", "public" ], "summary": "Get Checkout Link", "description": "Get a checkout link by ID.\n\n**Scopes**: `checkout_links:read` `checkout_links:write`", "operationId": "checkout-links:get", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid4", "description": "The checkout link ID.", "title": "Id" }, "description": "The checkout link ID." } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CheckoutLink" } } } }, "404": { "description": "Checkout link not found.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ResourceNotFound" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "checkout-links", "x-speakeasy-name-override": "get", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"log\"\n\t\"github.com/polarsource/polar-go/models/components\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.CheckoutLinks.Get(ctx, \"\")\n if err != nil {\n log.Fatal(err)\n }\n if res.CheckoutLink != nil {\n switch res.CheckoutLink.Discount.Type {\n case components.CheckoutLinkDiscountTypeDiscountFixedOnceForeverDurationBase:\n // res.CheckoutLink.Discount.DiscountFixedOnceForeverDurationBase is populated\n case components.CheckoutLinkDiscountTypeDiscountFixedRepeatDurationBase:\n // res.CheckoutLink.Discount.DiscountFixedRepeatDurationBase is populated\n case components.CheckoutLinkDiscountTypeDiscountPercentageOnceForeverDurationBase:\n // res.CheckoutLink.Discount.DiscountPercentageOnceForeverDurationBase is populated\n case components.CheckoutLinkDiscountTypeDiscountPercentageRepeatDurationBase:\n // res.CheckoutLink.Discount.DiscountPercentageRepeatDurationBase is populated\n }\n\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.checkout_links.get(id=\"\")\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.checkoutLinks.get({\n id: \"\",\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n\n\n$response = $sdk->checkoutLinks->get(\n id: ''\n);\n\nif ($response->checkoutLink !== null) {\n // handle response\n}" } ] }, "patch": { "tags": [ "checkout-links", "public" ], "summary": "Update Checkout Link", "description": "Update a checkout link.\n\n**Scopes**: `checkout_links:write`", "operationId": "checkout-links:update", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid4", "description": "The checkout link ID.", "title": "Id" }, "description": "The checkout link ID." } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CheckoutLinkUpdate" } } } }, "responses": { "200": { "description": "Checkout link updated.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CheckoutLink" } } } }, "404": { "description": "Checkout link not found.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ResourceNotFound" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "checkout-links", "x-speakeasy-name-override": "update", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.CheckoutLinks.Update(ctx, \"\", components.CheckoutLinkUpdate{})\n if err != nil {\n log.Fatal(err)\n }\n if res.CheckoutLink != nil {\n switch res.CheckoutLink.Discount.Type {\n case components.CheckoutLinkDiscountTypeDiscountFixedOnceForeverDurationBase:\n // res.CheckoutLink.Discount.DiscountFixedOnceForeverDurationBase is populated\n case components.CheckoutLinkDiscountTypeDiscountFixedRepeatDurationBase:\n // res.CheckoutLink.Discount.DiscountFixedRepeatDurationBase is populated\n case components.CheckoutLinkDiscountTypeDiscountPercentageOnceForeverDurationBase:\n // res.CheckoutLink.Discount.DiscountPercentageOnceForeverDurationBase is populated\n case components.CheckoutLinkDiscountTypeDiscountPercentageRepeatDurationBase:\n // res.CheckoutLink.Discount.DiscountPercentageRepeatDurationBase is populated\n }\n\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.checkout_links.update(id=\"\", checkout_link_update={})\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.checkoutLinks.update({\n id: \"\",\n checkoutLinkUpdate: {},\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Components;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n$checkoutLinkUpdate = new Components\\CheckoutLinkUpdate();\n\n$response = $sdk->checkoutLinks->update(\n id: '',\n checkoutLinkUpdate: $checkoutLinkUpdate\n\n);\n\nif ($response->checkoutLink !== null) {\n // handle response\n}" } ] }, "delete": { "tags": [ "checkout-links", "public" ], "summary": "Delete Checkout Link", "description": "Delete a checkout link.\n\n**Scopes**: `checkout_links:write`", "operationId": "checkout-links:delete", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid4", "description": "The checkout link ID.", "title": "Id" }, "description": "The checkout link ID." } ], "responses": { "204": { "description": "Checkout link deleted." }, "404": { "description": "Checkout link not found.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ResourceNotFound" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "checkout-links", "x-speakeasy-name-override": "delete", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.CheckoutLinks.Delete(ctx, \"\")\n if err != nil {\n log.Fatal(err)\n }\n if res != nil {\n // handle response\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n polar.checkout_links.delete(id=\"\")\n\n # Use the SDK ..." }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n await polar.checkoutLinks.delete({\n id: \"\",\n });\n\n\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n\n\n$response = $sdk->checkoutLinks->delete(\n id: ''\n);\n\nif ($response->statusCode === 200) {\n // handle response\n}" } ] } }, "/v1/custom-fields/": { "get": { "tags": [ "custom-fields", "public" ], "summary": "List Custom Fields", "description": "List custom fields.\n\n**Scopes**: `custom_fields:read` `custom_fields:write`", "operationId": "custom-fields:list", "parameters": [ { "name": "organization_id", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string", "format": "uuid4", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "description": "The organization ID.", "x-polar-selector-widget": { "resourceRoot": "/v1/organizations", "resourceName": "Organization", "displayProperty": "name" } }, { "type": "array", "items": { "type": "string", "format": "uuid4", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "description": "The organization ID.", "x-polar-selector-widget": { "resourceRoot": "/v1/organizations", "resourceName": "Organization", "displayProperty": "name" } } }, { "type": "null" } ], "title": "OrganizationID Filter", "description": "Filter by organization ID." }, "description": "Filter by organization ID." }, { "name": "query", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "description": "Filter by custom field name or slug.", "title": "Query" }, "description": "Filter by custom field name or slug." }, { "name": "type", "in": "query", "required": false, "schema": { "anyOf": [ { "$ref": "#/components/schemas/CustomFieldType" }, { "type": "array", "items": { "$ref": "#/components/schemas/CustomFieldType" } }, { "type": "null" } ], "title": "CustomFieldType Filter", "description": "Filter by custom field type." }, "description": "Filter by custom field type.", "x-speakeasy-name-override": "type_filter" }, { "name": "page", "in": "query", "required": false, "schema": { "type": "integer", "exclusiveMinimum": 0, "description": "Page number, defaults to 1.", "default": 1, "title": "Page" }, "description": "Page number, defaults to 1." }, { "name": "limit", "in": "query", "required": false, "schema": { "type": "integer", "exclusiveMinimum": 0, "description": "Size of a page, defaults to 10. Maximum is 100.", "default": 10, "title": "Limit" }, "description": "Size of a page, defaults to 10. Maximum is 100." }, { "name": "sorting", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "array", "items": { "$ref": "#/components/schemas/CustomFieldSortProperty" } }, { "type": "null" } ], "description": "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.", "default": [ "slug" ], "title": "Sorting" }, "description": "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." } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ListResource_CustomField_" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-pagination": { "type": "offsetLimit", "inputs": [ { "name": "page", "in": "parameters", "type": "page" }, { "name": "limit", "in": "parameters", "type": "limit" } ], "outputs": { "results": "$.items", "numPages": "$.pagination.max_page" } }, "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "custom-fields", "x-speakeasy-name-override": "list", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.CustomFields.List(ctx, operations.CustomFieldsListRequest{\n OrganizationID: polargo.Pointer(operations.CreateCustomFieldsListQueryParamOrganizationIDFilterStr(\n \"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n )),\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.ListResourceCustomField != nil {\n for {\n // handle items\n\n res, err = res.Next()\n\n if err != nil {\n // handle error\n }\n\n if res == nil {\n break\n }\n }\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.custom_fields.list(organization_id=\"1dbfc517-0bbf-4301-9ba8-555ca42b9737\", page=1, limit=10)\n\n while res is not None:\n # Handle items\n\n res = res.next()" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.customFields.list({\n organizationId: \"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n });\n\n for await (const page of result) {\n console.log(page);\n }\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Operations;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n$request = new Operations\\CustomFieldsListRequest(\n organizationId: '1dbfc517-0bbf-4301-9ba8-555ca42b9737',\n);\n\n$responses = $sdk->customFields->list(\n request: $request\n);\n\n\nforeach ($responses as $response) {\n if ($response->statusCode === 200) {\n // handle response\n }\n}" } ] }, "post": { "tags": [ "custom-fields", "public" ], "summary": "Create Custom Field", "description": "Create a custom field.\n\n**Scopes**: `custom_fields:write`", "operationId": "custom-fields:create", "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CustomFieldCreate" } } } }, "responses": { "201": { "description": "Custom field created.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CustomField", "title": "CustomField" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "custom-fields", "x-speakeasy-name-override": "create", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.CustomFields.Create(ctx, components.CreateCustomFieldCreateSelect(\n components.CustomFieldCreateSelect{\n Slug: \"\",\n Name: \"\",\n OrganizationID: polargo.Pointer(\"1dbfc517-0bbf-4301-9ba8-555ca42b9737\"),\n Properties: components.CustomFieldSelectProperties{\n Options: []components.CustomFieldSelectOption{},\n },\n },\n ))\n if err != nil {\n log.Fatal(err)\n }\n if res.CustomField != nil {\n switch res.CustomField.Type {\n case components.CustomFieldUnionTypeCheckbox:\n // res.CustomField.CustomFieldCheckbox is populated\n case components.CustomFieldUnionTypeDate:\n // res.CustomField.CustomFieldDate is populated\n case components.CustomFieldUnionTypeNumber:\n // res.CustomField.CustomFieldNumber is populated\n case components.CustomFieldUnionTypeSelect:\n // res.CustomField.CustomFieldSelect is populated\n case components.CustomFieldUnionTypeText:\n // res.CustomField.CustomFieldText is populated\n }\n\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.custom_fields.create(request={\n \"type\": \"select\",\n \"slug\": \"\",\n \"name\": \"\",\n \"properties\": {\n \"options\": [],\n },\n })\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.customFields.create({\n type: \"select\",\n slug: \"\",\n name: \"\",\n organizationId: \"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n properties: {\n options: [],\n },\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Components;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n$request = new Components\\CustomFieldCreateSelect(\n slug: '',\n name: '',\n organizationId: '1dbfc517-0bbf-4301-9ba8-555ca42b9737',\n properties: new Components\\CustomFieldSelectProperties(\n options: [],\n ),\n);\n\n$response = $sdk->customFields->create(\n request: $request\n);\n\nif ($response->customField !== null) {\n // handle response\n}" } ] } }, "/v1/custom-fields/{id}": { "get": { "tags": [ "custom-fields", "public" ], "summary": "Get Custom Field", "description": "Get a custom field by ID.\n\n**Scopes**: `custom_fields:read` `custom_fields:write`", "operationId": "custom-fields:get", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid4", "description": "The custom field ID.", "title": "Id" }, "description": "The custom field ID." } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CustomField", "title": "CustomField" } } } }, "404": { "description": "Custom field not found.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ResourceNotFound" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "custom-fields", "x-speakeasy-name-override": "get", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"log\"\n\t\"github.com/polarsource/polar-go/models/components\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.CustomFields.Get(ctx, \"\")\n if err != nil {\n log.Fatal(err)\n }\n if res.CustomField != nil {\n switch res.CustomField.Type {\n case components.CustomFieldUnionTypeCheckbox:\n // res.CustomField.CustomFieldCheckbox is populated\n case components.CustomFieldUnionTypeDate:\n // res.CustomField.CustomFieldDate is populated\n case components.CustomFieldUnionTypeNumber:\n // res.CustomField.CustomFieldNumber is populated\n case components.CustomFieldUnionTypeSelect:\n // res.CustomField.CustomFieldSelect is populated\n case components.CustomFieldUnionTypeText:\n // res.CustomField.CustomFieldText is populated\n }\n\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.custom_fields.get(id=\"\")\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.customFields.get({\n id: \"\",\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n\n\n$response = $sdk->customFields->get(\n id: ''\n);\n\nif ($response->customField !== null) {\n // handle response\n}" } ] }, "patch": { "tags": [ "custom-fields", "public" ], "summary": "Update Custom Field", "description": "Update a custom field.\n\n**Scopes**: `custom_fields:write`", "operationId": "custom-fields:update", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid4", "description": "The custom field ID.", "title": "Id" }, "description": "The custom field ID." } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CustomFieldUpdate" } } } }, "responses": { "200": { "description": "Custom field updated.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CustomField", "title": "CustomField" } } } }, "404": { "description": "Custom field not found.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ResourceNotFound" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "custom-fields", "x-speakeasy-name-override": "update", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.CustomFields.Update(ctx, \"\", components.CreateCustomFieldUpdateDate(\n components.CustomFieldUpdateDate{},\n ))\n if err != nil {\n log.Fatal(err)\n }\n if res.CustomField != nil {\n switch res.CustomField.Type {\n case components.CustomFieldUnionTypeCheckbox:\n // res.CustomField.CustomFieldCheckbox is populated\n case components.CustomFieldUnionTypeDate:\n // res.CustomField.CustomFieldDate is populated\n case components.CustomFieldUnionTypeNumber:\n // res.CustomField.CustomFieldNumber is populated\n case components.CustomFieldUnionTypeSelect:\n // res.CustomField.CustomFieldSelect is populated\n case components.CustomFieldUnionTypeText:\n // res.CustomField.CustomFieldText is populated\n }\n\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.custom_fields.update(id=\"\", custom_field_update={\n \"type\": \"date\",\n })\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.customFields.update({\n id: \"\",\n customFieldUpdate: {\n type: \"date\",\n },\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Components;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n\n\n$response = $sdk->customFields->update(\n id: '',\n customFieldUpdate: new Components\\CustomFieldUpdateDate()\n\n);\n\nif ($response->customField !== null) {\n // handle response\n}" } ] }, "delete": { "tags": [ "custom-fields", "public" ], "summary": "Delete Custom Field", "description": "Delete a custom field.\n\n**Scopes**: `custom_fields:write`", "operationId": "custom-fields:delete", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid4", "description": "The custom field ID.", "title": "Id" }, "description": "The custom field ID." } ], "responses": { "204": { "description": "Custom field deleted." }, "404": { "description": "Custom field not found.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ResourceNotFound" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "custom-fields", "x-speakeasy-name-override": "delete", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.CustomFields.Delete(ctx, \"\")\n if err != nil {\n log.Fatal(err)\n }\n if res != nil {\n // handle response\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n polar.custom_fields.delete(id=\"\")\n\n # Use the SDK ..." }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n await polar.customFields.delete({\n id: \"\",\n });\n\n\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n\n\n$response = $sdk->customFields->delete(\n id: ''\n);\n\nif ($response->statusCode === 200) {\n // handle response\n}" } ] } }, "/v1/discounts/": { "get": { "tags": [ "discounts", "public" ], "summary": "List Discounts", "description": "List discounts.\n\n**Scopes**: `discounts:read` `discounts:write`", "operationId": "discounts:list", "parameters": [ { "name": "organization_id", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string", "format": "uuid4", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "description": "The organization ID.", "x-polar-selector-widget": { "resourceRoot": "/v1/organizations", "resourceName": "Organization", "displayProperty": "name" } }, { "type": "array", "items": { "type": "string", "format": "uuid4", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "description": "The organization ID.", "x-polar-selector-widget": { "resourceRoot": "/v1/organizations", "resourceName": "Organization", "displayProperty": "name" } } }, { "type": "null" } ], "title": "OrganizationID Filter", "description": "Filter by organization ID." }, "description": "Filter by organization ID." }, { "name": "query", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "description": "Filter by name.", "title": "Query" }, "description": "Filter by name." }, { "name": "page", "in": "query", "required": false, "schema": { "type": "integer", "exclusiveMinimum": 0, "description": "Page number, defaults to 1.", "default": 1, "title": "Page" }, "description": "Page number, defaults to 1." }, { "name": "limit", "in": "query", "required": false, "schema": { "type": "integer", "exclusiveMinimum": 0, "description": "Size of a page, defaults to 10. Maximum is 100.", "default": 10, "title": "Limit" }, "description": "Size of a page, defaults to 10. Maximum is 100." }, { "name": "sorting", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "array", "items": { "$ref": "#/components/schemas/DiscountSortProperty" } }, { "type": "null" } ], "description": "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.", "default": [ "-created_at" ], "title": "Sorting" }, "description": "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." } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ListResource_Discount_" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-pagination": { "type": "offsetLimit", "inputs": [ { "name": "page", "in": "parameters", "type": "page" }, { "name": "limit", "in": "parameters", "type": "limit" } ], "outputs": { "results": "$.items", "numPages": "$.pagination.max_page" } }, "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "discounts", "x-speakeasy-name-override": "list", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Discounts.List(ctx, operations.DiscountsListRequest{\n OrganizationID: polargo.Pointer(operations.CreateDiscountsListQueryParamOrganizationIDFilterStr(\n \"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n )),\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.ListResourceDiscount != nil {\n for {\n // handle items\n\n res, err = res.Next()\n\n if err != nil {\n // handle error\n }\n\n if res == nil {\n break\n }\n }\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.discounts.list(organization_id=\"1dbfc517-0bbf-4301-9ba8-555ca42b9737\", page=1, limit=10)\n\n while res is not None:\n # Handle items\n\n res = res.next()" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.discounts.list({\n organizationId: \"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n });\n\n for await (const page of result) {\n console.log(page);\n }\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Operations;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n$request = new Operations\\DiscountsListRequest(\n organizationId: '1dbfc517-0bbf-4301-9ba8-555ca42b9737',\n);\n\n$responses = $sdk->discounts->list(\n request: $request\n);\n\n\nforeach ($responses as $response) {\n if ($response->statusCode === 200) {\n // handle response\n }\n}" } ] }, "post": { "tags": [ "discounts", "public" ], "summary": "Create Discount", "description": "Create a discount.\n\n**Scopes**: `discounts:write`", "operationId": "discounts:create", "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/DiscountCreate" } } } }, "responses": { "201": { "description": "Discount created.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Discount", "title": "Discount" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "discounts", "x-speakeasy-name-override": "create", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Discounts.Create(ctx, components.CreateDiscountCreateDiscountPercentageOnceForeverDurationCreate(\n components.DiscountPercentageOnceForeverDurationCreate{\n Duration: components.DiscountDurationOnce,\n Type: components.DiscountTypeFixed,\n BasisPoints: 449604,\n Name: \"\",\n OrganizationID: polargo.Pointer(\"1dbfc517-0bbf-4301-9ba8-555ca42b9737\"),\n },\n ))\n if err != nil {\n log.Fatal(err)\n }\n if res.Discount != nil {\n switch res.Discount.Type {\n case components.DiscountUnionTypeDiscountFixedOnceForeverDuration:\n // res.Discount.DiscountFixedOnceForeverDuration is populated\n case components.DiscountUnionTypeDiscountFixedRepeatDuration:\n // res.Discount.DiscountFixedRepeatDuration is populated\n case components.DiscountUnionTypeDiscountPercentageOnceForeverDuration:\n // res.Discount.DiscountPercentageOnceForeverDuration is populated\n case components.DiscountUnionTypeDiscountPercentageRepeatDuration:\n // res.Discount.DiscountPercentageRepeatDuration is populated\n }\n\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "import polar_sdk\nfrom polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.discounts.create(request={\n \"duration\": polar_sdk.DiscountDuration.ONCE,\n \"type\": polar_sdk.DiscountType.FIXED,\n \"basis_points\": 449604,\n \"name\": \"\",\n \"organization_id\": \"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n })\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.discounts.create({\n duration: \"once\",\n type: \"fixed\",\n basisPoints: 449604,\n name: \"\",\n organizationId: \"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Components;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n$request = new Components\\DiscountPercentageOnceForeverDurationCreate(\n duration: Components\\DiscountDuration::Once,\n type: Components\\DiscountType::Fixed,\n basisPoints: 449604,\n name: '',\n organizationId: '1dbfc517-0bbf-4301-9ba8-555ca42b9737',\n);\n\n$response = $sdk->discounts->create(\n request: $request\n);\n\nif ($response->discount !== null) {\n // handle response\n}" } ] } }, "/v1/discounts/{id}": { "get": { "tags": [ "discounts", "public" ], "summary": "Get Discount", "description": "Get a discount by ID.\n\n**Scopes**: `discounts:read` `discounts:write`", "operationId": "discounts:get", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid4", "description": "The discount ID.", "title": "Id" }, "description": "The discount ID." } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Discount", "title": "Discount" } } } }, "404": { "description": "Discount not found.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ResourceNotFound" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "discounts", "x-speakeasy-name-override": "get", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"log\"\n\t\"github.com/polarsource/polar-go/models/components\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Discounts.Get(ctx, \"\")\n if err != nil {\n log.Fatal(err)\n }\n if res.Discount != nil {\n switch res.Discount.Type {\n case components.DiscountUnionTypeDiscountFixedOnceForeverDuration:\n // res.Discount.DiscountFixedOnceForeverDuration is populated\n case components.DiscountUnionTypeDiscountFixedRepeatDuration:\n // res.Discount.DiscountFixedRepeatDuration is populated\n case components.DiscountUnionTypeDiscountPercentageOnceForeverDuration:\n // res.Discount.DiscountPercentageOnceForeverDuration is populated\n case components.DiscountUnionTypeDiscountPercentageRepeatDuration:\n // res.Discount.DiscountPercentageRepeatDuration is populated\n }\n\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.discounts.get(id=\"\")\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.discounts.get({\n id: \"\",\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n\n\n$response = $sdk->discounts->get(\n id: ''\n);\n\nif ($response->discount !== null) {\n // handle response\n}" } ] }, "patch": { "tags": [ "discounts", "public" ], "summary": "Update Discount", "description": "Update a discount.\n\n**Scopes**: `discounts:write`", "operationId": "discounts:update", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid4", "description": "The discount ID.", "title": "Id" }, "description": "The discount ID." } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/DiscountUpdate" } } } }, "responses": { "200": { "description": "Discount updated.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Discount", "title": "Discount" } } } }, "404": { "description": "Discount not found.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ResourceNotFound" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "discounts", "x-speakeasy-name-override": "update", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Discounts.Update(ctx, \"\", components.DiscountUpdate{})\n if err != nil {\n log.Fatal(err)\n }\n if res.Discount != nil {\n switch res.Discount.Type {\n case components.DiscountUnionTypeDiscountFixedOnceForeverDuration:\n // res.Discount.DiscountFixedOnceForeverDuration is populated\n case components.DiscountUnionTypeDiscountFixedRepeatDuration:\n // res.Discount.DiscountFixedRepeatDuration is populated\n case components.DiscountUnionTypeDiscountPercentageOnceForeverDuration:\n // res.Discount.DiscountPercentageOnceForeverDuration is populated\n case components.DiscountUnionTypeDiscountPercentageRepeatDuration:\n // res.Discount.DiscountPercentageRepeatDuration is populated\n }\n\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.discounts.update(id=\"\", discount_update={})\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.discounts.update({\n id: \"\",\n discountUpdate: {},\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Components;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n$discountUpdate = new Components\\DiscountUpdate();\n\n$response = $sdk->discounts->update(\n id: '',\n discountUpdate: $discountUpdate\n\n);\n\nif ($response->discount !== null) {\n // handle response\n}" } ] }, "delete": { "tags": [ "discounts", "public" ], "summary": "Delete Discount", "description": "Delete a discount.\n\n**Scopes**: `discounts:write`", "operationId": "discounts:delete", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid4", "description": "The discount ID.", "title": "Id" }, "description": "The discount ID." } ], "responses": { "204": { "description": "Discount deleted." }, "404": { "description": "Discount not found.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ResourceNotFound" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "discounts", "x-speakeasy-name-override": "delete", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Discounts.Delete(ctx, \"\")\n if err != nil {\n log.Fatal(err)\n }\n if res != nil {\n // handle response\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n polar.discounts.delete(id=\"\")\n\n # Use the SDK ..." }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n await polar.discounts.delete({\n id: \"\",\n });\n\n\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n\n\n$response = $sdk->discounts->delete(\n id: ''\n);\n\nif ($response->statusCode === 200) {\n // handle response\n}" } ] } }, "/v1/customers/": { "get": { "tags": [ "customers", "public", "mcp" ], "summary": "List Customers", "description": "List customers.\n\n**Scopes**: `customers:read` `customers:write`", "operationId": "customers:list", "parameters": [ { "name": "organization_id", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string", "format": "uuid4", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "description": "The organization ID.", "x-polar-selector-widget": { "resourceRoot": "/v1/organizations", "resourceName": "Organization", "displayProperty": "name" } }, { "type": "array", "items": { "type": "string", "format": "uuid4", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "description": "The organization ID.", "x-polar-selector-widget": { "resourceRoot": "/v1/organizations", "resourceName": "Organization", "displayProperty": "name" } } }, { "type": "null" } ], "title": "OrganizationID Filter", "description": "Filter by organization ID." }, "description": "Filter by organization ID." }, { "name": "email", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "description": "Filter by exact email.", "title": "Email" }, "description": "Filter by exact email." }, { "name": "query", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "description": "Filter by name, email, or external ID.", "title": "Query" }, "description": "Filter by name, email, or external ID." }, { "name": "page", "in": "query", "required": false, "schema": { "type": "integer", "exclusiveMinimum": 0, "description": "Page number, defaults to 1.", "default": 1, "title": "Page" }, "description": "Page number, defaults to 1." }, { "name": "limit", "in": "query", "required": false, "schema": { "type": "integer", "exclusiveMinimum": 0, "description": "Size of a page, defaults to 10. Maximum is 100.", "default": 10, "title": "Limit" }, "description": "Size of a page, defaults to 10. Maximum is 100." }, { "name": "sorting", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "array", "items": { "$ref": "#/components/schemas/CustomerSortProperty" } }, { "type": "null" } ], "description": "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.", "default": [ "-created_at" ], "title": "Sorting" }, "description": "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." }, { "name": "metadata", "in": "query", "required": false, "style": "deepObject", "schema": { "$ref": "#/components/schemas/MetadataQuery" }, "description": "Filter by metadata key-value pairs. It uses the `deepObject` style, e.g. `?metadata[key]=value`." } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ListResource_Customer_" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-pagination": { "type": "offsetLimit", "inputs": [ { "name": "page", "in": "parameters", "type": "page" }, { "name": "limit", "in": "parameters", "type": "limit" } ], "outputs": { "results": "$.items", "numPages": "$.pagination.max_page" } }, "x-speakeasy-mcp": { "disabled": false, "scopes": [ "read", "customers" ] }, "x-speakeasy-group": "customers", "x-speakeasy-name-override": "list", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Customers.List(ctx, operations.CustomersListRequest{\n OrganizationID: polargo.Pointer(operations.CreateCustomersListQueryParamOrganizationIDFilterStr(\n \"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n )),\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.ListResourceCustomerWithMembers != nil {\n for {\n // handle items\n\n res, err = res.Next()\n\n if err != nil {\n // handle error\n }\n\n if res == nil {\n break\n }\n }\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.customers.list(organization_id=\"1dbfc517-0bbf-4301-9ba8-555ca42b9737\", page=1, limit=10)\n\n while res is not None:\n # Handle items\n\n res = res.next()" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.customers.list({\n organizationId: \"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n });\n\n for await (const page of result) {\n console.log(page);\n }\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Operations;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n$request = new Operations\\CustomersListRequest(\n organizationId: '1dbfc517-0bbf-4301-9ba8-555ca42b9737',\n);\n\n$responses = $sdk->customers->list(\n request: $request\n);\n\n\nforeach ($responses as $response) {\n if ($response->statusCode === 200) {\n // handle response\n }\n}" } ] }, "post": { "tags": [ "customers", "public", "mcp" ], "summary": "Create Customer", "description": "Create a customer.\n\n**Scopes**: `customers:write`", "operationId": "customers:create", "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CustomerCreate" } } } }, "responses": { "201": { "description": "Customer created.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Customer" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-mcp": { "disabled": false, "scopes": [ "write", "customers" ] }, "x-speakeasy-group": "customers", "x-speakeasy-name-override": "create", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Customers.Create(ctx, components.CustomerCreate{\n ExternalID: polargo.Pointer(\"usr_1337\"),\n Email: \"customer@example.com\",\n Name: polargo.Pointer(\"John Doe\"),\n BillingAddress: &components.AddressInput{\n Country: components.CountryAlpha2InputUs,\n },\n TaxID: []*components.CustomerCreateTaxID{\n polargo.Pointer(components.CreateCustomerCreateTaxIDStr(\n \"911144442\",\n )),\n polargo.Pointer(components.CreateCustomerCreateTaxIDStr(\n \"us_ein\",\n )),\n },\n Locale: polargo.Pointer(\"en\"),\n Type: components.CustomerTypeIndividual.ToPointer(),\n OrganizationID: polargo.Pointer(\"1dbfc517-0bbf-4301-9ba8-555ca42b9737\"),\n Owner: &components.OwnerCreate{\n Email: polargo.Pointer(\"member@example.com\"),\n Name: polargo.Pointer(\"Jane Doe\"),\n ExternalID: polargo.Pointer(\"usr_1337\"),\n },\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.CustomerWithMembers != nil {\n // handle response\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "import polar_sdk\nfrom polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.customers.create(request={\n \"external_id\": \"usr_1337\",\n \"email\": \"customer@example.com\",\n \"name\": \"John Doe\",\n \"billing_address\": {\n \"country\": polar_sdk.CountryAlpha2Input.US,\n },\n \"tax_id\": [\n \"911144442\",\n \"us_ein\",\n ],\n \"locale\": \"en\",\n \"type\": polar_sdk.CustomerType.INDIVIDUAL,\n \"organization_id\": \"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n \"owner\": {\n \"email\": \"member@example.com\",\n \"name\": \"Jane Doe\",\n \"external_id\": \"usr_1337\",\n },\n })\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.customers.create({\n externalId: \"usr_1337\",\n email: \"customer@example.com\",\n name: \"John Doe\",\n billingAddress: {\n country: \"US\",\n },\n taxId: [\n \"911144442\",\n \"us_ein\",\n ],\n locale: \"en\",\n type: \"individual\",\n organizationId: \"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n owner: {\n email: \"member@example.com\",\n name: \"Jane Doe\",\n externalId: \"usr_1337\",\n },\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Components;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n$request = new Components\\CustomerCreate(\n externalId: 'usr_1337',\n email: 'customer@example.com',\n name: 'John Doe',\n billingAddress: new Components\\AddressInput(\n country: Components\\CountryAlpha2Input::Us,\n ),\n taxId: [\n '911144442',\n 'us_ein',\n ],\n locale: 'en',\n type: Components\\CustomerType::Individual,\n organizationId: '1dbfc517-0bbf-4301-9ba8-555ca42b9737',\n owner: new Components\\OwnerCreate(\n email: 'member@example.com',\n name: 'Jane Doe',\n externalId: 'usr_1337',\n ),\n);\n\n$response = $sdk->customers->create(\n request: $request\n);\n\nif ($response->customerWithMembers !== null) {\n // handle response\n}" } ] } }, "/v1/customers/export": { "get": { "tags": [ "customers", "public", "mcp" ], "summary": "Export Customers", "description": "Export customers as a CSV file.\n\n**Scopes**: `customers:read` `customers:write`", "operationId": "customers:export", "parameters": [ { "name": "organization_id", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string", "format": "uuid4", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "description": "The organization ID.", "x-polar-selector-widget": { "resourceRoot": "/v1/organizations", "resourceName": "Organization", "displayProperty": "name" } }, { "type": "array", "items": { "type": "string", "format": "uuid4", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "description": "The organization ID.", "x-polar-selector-widget": { "resourceRoot": "/v1/organizations", "resourceName": "Organization", "displayProperty": "name" } } }, { "type": "null" } ], "description": "Filter by organization ID.", "title": "Organization Id" }, "description": "Filter by organization ID." } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} }, "text/csv": { "schema": { "type": "string" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-mcp": { "disabled": false, "scopes": [ "read", "customers" ] }, "x-speakeasy-group": "customers", "x-speakeasy-name-override": "export", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Customers.Export(ctx, polargo.Pointer(operations.CreateCustomersExportQueryParamOrganizationIDStr(\n \"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n )))\n if err != nil {\n log.Fatal(err)\n }\n if res.Any != nil {\n // handle response\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.customers.export(organization_id=\"1dbfc517-0bbf-4301-9ba8-555ca42b9737\")\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.customers.export({\n organizationId: \"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n\n\n$response = $sdk->customers->export(\n organizationId: '1dbfc517-0bbf-4301-9ba8-555ca42b9737'\n);\n\nif ($response->any !== null) {\n // handle response\n}" } ] } }, "/v1/customers/{id}": { "get": { "tags": [ "customers", "public", "mcp" ], "summary": "Get Customer", "description": "Get a customer by ID.\n\n**Scopes**: `customers:read` `customers:write`", "operationId": "customers:get", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid4", "description": "The customer ID.", "title": "Id" }, "description": "The customer ID." } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Customer" } } } }, "404": { "description": "Customer not found.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ResourceNotFound" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-mcp": { "disabled": false, "scopes": [ "read", "customers" ] }, "x-speakeasy-group": "customers", "x-speakeasy-name-override": "get", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Customers.Get(ctx, \"\")\n if err != nil {\n log.Fatal(err)\n }\n if res.CustomerWithMembers != nil {\n // handle response\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.customers.get(id=\"\")\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.customers.get({\n id: \"\",\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n\n\n$response = $sdk->customers->get(\n id: ''\n);\n\nif ($response->customerWithMembers !== null) {\n // handle response\n}" } ] }, "patch": { "tags": [ "customers", "public", "mcp" ], "summary": "Update Customer", "description": "Update a customer.\n\n**Scopes**: `customers:write`", "operationId": "customers:update", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid4", "description": "The customer ID.", "title": "Id" }, "description": "The customer ID." } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CustomerUpdate" } } } }, "responses": { "200": { "description": "Customer updated.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Customer" } } } }, "404": { "description": "Customer not found.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ResourceNotFound" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-mcp": { "disabled": false, "scopes": [ "write", "customers" ] }, "x-speakeasy-group": "customers", "x-speakeasy-name-override": "update", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Customers.Update(ctx, \"\", components.CustomerUpdate{\n Email: polargo.Pointer(\"customer@example.com\"),\n Name: polargo.Pointer(\"John Doe\"),\n BillingAddress: &components.AddressInput{\n Country: components.CountryAlpha2InputUs,\n },\n TaxID: []*components.CustomerUpdateTaxID{\n polargo.Pointer(components.CreateCustomerUpdateTaxIDStr(\n \"911144442\",\n )),\n polargo.Pointer(components.CreateCustomerUpdateTaxIDStr(\n \"us_ein\",\n )),\n },\n Locale: polargo.Pointer(\"en\"),\n ExternalID: polargo.Pointer(\"usr_1337\"),\n Type: components.CustomerTypeIndividual.ToPointer(),\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.CustomerWithMembers != nil {\n // handle response\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "import polar_sdk\nfrom polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.customers.update(id=\"\", customer_update={\n \"email\": \"customer@example.com\",\n \"name\": \"John Doe\",\n \"billing_address\": {\n \"country\": polar_sdk.CountryAlpha2Input.US,\n },\n \"tax_id\": [\n \"911144442\",\n \"us_ein\",\n ],\n \"locale\": \"en\",\n \"external_id\": \"usr_1337\",\n \"type\": polar_sdk.CustomerType.INDIVIDUAL,\n })\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.customers.update({\n id: \"\",\n customerUpdate: {\n email: \"customer@example.com\",\n name: \"John Doe\",\n billingAddress: {\n country: \"US\",\n },\n taxId: [\n \"911144442\",\n \"us_ein\",\n ],\n locale: \"en\",\n externalId: \"usr_1337\",\n type: \"individual\",\n },\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Components;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n$customerUpdate = new Components\\CustomerUpdate(\n email: 'customer@example.com',\n name: 'John Doe',\n billingAddress: new Components\\AddressInput(\n country: Components\\CountryAlpha2Input::Us,\n ),\n taxId: [\n '911144442',\n 'us_ein',\n ],\n locale: 'en',\n externalId: 'usr_1337',\n type: Components\\CustomerType::Individual,\n);\n\n$response = $sdk->customers->update(\n id: '',\n customerUpdate: $customerUpdate\n\n);\n\nif ($response->customerWithMembers !== null) {\n // handle response\n}" } ] }, "delete": { "tags": [ "customers", "public", "mcp" ], "summary": "Delete Customer", "description": "Delete a customer.\n\nThis action cannot be undone and will immediately:\n- Cancel any active subscriptions for the customer\n- Revoke all their benefits\n- Clear any `external_id`\n\nUse it only in the context of deleting a user within your\nown service. Otherwise, use more granular API endpoints to cancel\na specific subscription or revoke certain benefits.\n\nNote: The customers information will nonetheless be retained for historic\norders and subscriptions.\n\nSet `anonymize=true` to also anonymize PII for GDPR compliance.\n\n**Scopes**: `customers:write`", "operationId": "customers:delete", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid4", "description": "The customer ID.", "title": "Id" }, "description": "The customer ID." }, { "name": "anonymize", "in": "query", "required": false, "schema": { "type": "boolean", "description": "If true, also anonymize the customer's personal data for GDPR compliance. This replaces email with a hashed version, hashes name and billing name (name preserved for businesses with tax_id), clears billing address, and removes OAuth account data.", "default": false, "title": "Anonymize" }, "description": "If true, also anonymize the customer's personal data for GDPR compliance. This replaces email with a hashed version, hashes name and billing name (name preserved for businesses with tax_id), clears billing address, and removes OAuth account data." } ], "responses": { "204": { "description": "Customer deleted." }, "404": { "description": "Customer not found.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ResourceNotFound" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-mcp": { "disabled": false, "scopes": [ "write", "customers" ] }, "x-speakeasy-group": "customers", "x-speakeasy-name-override": "delete", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Customers.Delete(ctx, \"\", polargo.Pointer(false))\n if err != nil {\n log.Fatal(err)\n }\n if res != nil {\n // handle response\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n polar.customers.delete(id=\"\", anonymize=False)\n\n # Use the SDK ..." }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n await polar.customers.delete({\n id: \"\",\n });\n\n\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n\n\n$response = $sdk->customers->delete(\n id: '',\n anonymize: false\n\n);\n\nif ($response->statusCode === 200) {\n // handle response\n}" } ] } }, "/v1/customers/external/{external_id}": { "get": { "tags": [ "customers", "public", "mcp" ], "summary": "Get Customer by External ID", "description": "Get a customer by external ID.\n\n**Scopes**: `customers:read` `customers:write`", "operationId": "customers:get_external", "parameters": [ { "name": "external_id", "in": "path", "required": true, "schema": { "type": "string", "description": "The customer external ID.", "title": "External Id" }, "description": "The customer external ID." } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Customer" } } } }, "404": { "description": "Customer not found.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ResourceNotFound" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-mcp": { "disabled": false, "scopes": [ "read", "customers" ] }, "x-speakeasy-group": "customers", "x-speakeasy-name-override": "get_external", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Customers.GetExternal(ctx, \"\")\n if err != nil {\n log.Fatal(err)\n }\n if res.CustomerWithMembers != nil {\n // handle response\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.customers.get_external(external_id=\"\")\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.customers.getExternal({\n externalId: \"\",\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n\n\n$response = $sdk->customers->getExternal(\n externalId: ''\n);\n\nif ($response->customerWithMembers !== null) {\n // handle response\n}" } ] }, "patch": { "tags": [ "customers", "public", "mcp" ], "summary": "Update Customer by External ID", "description": "Update a customer by external ID.\n\n**Scopes**: `customers:write`", "operationId": "customers:update_external", "parameters": [ { "name": "external_id", "in": "path", "required": true, "schema": { "type": "string", "description": "The customer external ID.", "title": "External Id" }, "description": "The customer external ID." } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CustomerUpdateExternalID" } } } }, "responses": { "200": { "description": "Customer updated.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Customer" } } } }, "404": { "description": "Customer not found.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ResourceNotFound" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-mcp": { "disabled": false, "scopes": [ "write", "customers" ] }, "x-speakeasy-group": "customers", "x-speakeasy-name-override": "update_external", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Customers.UpdateExternal(ctx, \"\", components.CustomerUpdateExternalID{\n Email: polargo.Pointer(\"customer@example.com\"),\n Name: polargo.Pointer(\"John Doe\"),\n BillingAddress: &components.AddressInput{\n Country: components.CountryAlpha2InputUs,\n },\n TaxID: []*components.CustomerUpdateExternalIDTaxID{\n polargo.Pointer(components.CreateCustomerUpdateExternalIDTaxIDStr(\n \"911144442\",\n )),\n polargo.Pointer(components.CreateCustomerUpdateExternalIDTaxIDStr(\n \"us_ein\",\n )),\n },\n Locale: polargo.Pointer(\"en\"),\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.CustomerWithMembers != nil {\n // handle response\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.customers.update_external(external_id=\"\", customer_update_external_id={\n \"email\": \"customer@example.com\",\n \"name\": \"John Doe\",\n \"billing_address\": None,\n \"tax_id\": [\n \"911144442\",\n \"us_ein\",\n ],\n \"locale\": \"en\",\n })\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.customers.updateExternal({\n externalId: \"\",\n customerUpdateExternalID: {\n email: \"customer@example.com\",\n name: \"John Doe\",\n billingAddress: {\n country: \"US\",\n },\n taxId: [\n \"911144442\",\n \"us_ein\",\n ],\n locale: \"en\",\n },\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Components;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n$customerUpdateExternalID = new Components\\CustomerUpdateExternalID(\n email: 'customer@example.com',\n name: 'John Doe',\n billingAddress: new Components\\AddressInput(\n country: Components\\CountryAlpha2Input::Us,\n ),\n taxId: [\n '911144442',\n 'us_ein',\n ],\n locale: 'en',\n);\n\n$response = $sdk->customers->updateExternal(\n externalId: '',\n customerUpdateExternalID: $customerUpdateExternalID\n\n);\n\nif ($response->customerWithMembers !== null) {\n // handle response\n}" } ] }, "delete": { "tags": [ "customers", "public", "mcp" ], "summary": "Delete Customer by External ID", "description": "Delete a customer by external ID.\n\nImmediately cancels any active subscriptions and revokes any active benefits.\n\nSet `anonymize=true` to also anonymize PII for GDPR compliance.\n\n**Scopes**: `customers:write`", "operationId": "customers:delete_external", "parameters": [ { "name": "external_id", "in": "path", "required": true, "schema": { "type": "string", "description": "The customer external ID.", "title": "External Id" }, "description": "The customer external ID." }, { "name": "anonymize", "in": "query", "required": false, "schema": { "type": "boolean", "description": "If true, also anonymize the customer's personal data for GDPR compliance.", "default": false, "title": "Anonymize" }, "description": "If true, also anonymize the customer's personal data for GDPR compliance." } ], "responses": { "204": { "description": "Customer deleted." }, "404": { "description": "Customer not found.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ResourceNotFound" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-mcp": { "disabled": false, "scopes": [ "write", "customers" ] }, "x-speakeasy-group": "customers", "x-speakeasy-name-override": "delete_external", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Customers.DeleteExternal(ctx, \"\", polargo.Pointer(false))\n if err != nil {\n log.Fatal(err)\n }\n if res != nil {\n // handle response\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n polar.customers.delete_external(external_id=\"\", anonymize=False)\n\n # Use the SDK ..." }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n await polar.customers.deleteExternal({\n externalId: \"\",\n });\n\n\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n\n\n$response = $sdk->customers->deleteExternal(\n externalId: '',\n anonymize: false\n\n);\n\nif ($response->statusCode === 200) {\n // handle response\n}" } ] } }, "/v1/customers/{id}/state": { "get": { "tags": [ "customers", "public", "mcp" ], "summary": "Get Customer State", "description": "Get a customer state by ID.\n\nThe customer state includes information about\nthe customer's active subscriptions and benefits.\n\nIt's the ideal endpoint to use when you need to get a full overview\nof a customer's status.\n\n**Scopes**: `customers:read` `customers:write`", "operationId": "customers:get_state", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid4", "description": "The customer ID.", "title": "Id" }, "description": "The customer ID." } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CustomerState" } } } }, "404": { "description": "Customer not found.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ResourceNotFound" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-mcp": { "disabled": false, "scopes": [ "read", "customers" ] }, "x-speakeasy-group": "customers", "x-speakeasy-name-override": "get_state", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Customers.GetState(ctx, \"\")\n if err != nil {\n log.Fatal(err)\n }\n if res.CustomerState != nil {\n // handle response\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.customers.get_state(id=\"\")\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.customers.getState({\n id: \"\",\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n\n\n$response = $sdk->customers->getState(\n id: ''\n);\n\nif ($response->customerState !== null) {\n // handle response\n}" } ] } }, "/v1/customers/external/{external_id}/state": { "get": { "tags": [ "customers", "public", "mcp" ], "summary": "Get Customer State by External ID", "description": "Get a customer state by external ID.\n\nThe customer state includes information about\nthe customer's active subscriptions and benefits.\n\nIt's the ideal endpoint to use when you need to get a full overview\nof a customer's status.\n\n**Scopes**: `customers:read` `customers:write`", "operationId": "customers:get_state_external", "parameters": [ { "name": "external_id", "in": "path", "required": true, "schema": { "type": "string", "description": "The customer external ID.", "title": "External Id" }, "description": "The customer external ID." } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CustomerState" } } } }, "404": { "description": "Customer not found.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ResourceNotFound" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-mcp": { "disabled": false, "scopes": [ "read", "customers" ] }, "x-speakeasy-group": "customers", "x-speakeasy-name-override": "get_state_external", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Customers.GetStateExternal(ctx, \"\")\n if err != nil {\n log.Fatal(err)\n }\n if res.CustomerState != nil {\n // handle response\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.customers.get_state_external(external_id=\"\")\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.customers.getStateExternal({\n externalId: \"\",\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n\n\n$response = $sdk->customers->getStateExternal(\n externalId: ''\n);\n\nif ($response->customerState !== null) {\n // handle response\n}" } ] } }, "/v1/members/": { "get": { "tags": [ "members", "public", "mcp" ], "summary": "List Members", "description": "List members with optional customer ID filter.\n\n**Scopes**: `members:read` `members:write`", "operationId": "members:list_members", "parameters": [ { "name": "customer_id", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "description": "Filter by customer ID.", "title": "Customer Id" }, "description": "Filter by customer ID." }, { "name": "external_customer_id", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string", "description": "The customer external ID." }, { "type": "null" } ], "description": "Filter by customer external ID.", "title": "External Customer Id" }, "description": "Filter by customer external ID." }, { "name": "page", "in": "query", "required": false, "schema": { "type": "integer", "exclusiveMinimum": 0, "description": "Page number, defaults to 1.", "default": 1, "title": "Page" }, "description": "Page number, defaults to 1." }, { "name": "limit", "in": "query", "required": false, "schema": { "type": "integer", "exclusiveMinimum": 0, "description": "Size of a page, defaults to 10. Maximum is 100.", "default": 10, "title": "Limit" }, "description": "Size of a page, defaults to 10. Maximum is 100." }, { "name": "sorting", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "array", "items": { "$ref": "#/components/schemas/MemberSortProperty" } }, { "type": "null" } ], "description": "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.", "default": [ "-created_at" ], "title": "Sorting" }, "description": "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." } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ListResource_Member_" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-pagination": { "type": "offsetLimit", "inputs": [ { "name": "page", "in": "parameters", "type": "page" }, { "name": "limit", "in": "parameters", "type": "limit" } ], "outputs": { "results": "$.items", "numPages": "$.pagination.max_page" } }, "x-speakeasy-mcp": { "disabled": false, "scopes": [ "read", "members" ] }, "x-speakeasy-group": "members", "x-speakeasy-name-override": "list_members", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Members.ListMembers(ctx, operations.MembersListMembersRequest{})\n if err != nil {\n log.Fatal(err)\n }\n if res.ListResourceMember != nil {\n for {\n // handle items\n\n res, err = res.Next()\n\n if err != nil {\n // handle error\n }\n\n if res == nil {\n break\n }\n }\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.members.list_members(page=1, limit=10)\n\n while res is not None:\n # Handle items\n\n res = res.next()" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.members.listMembers({});\n\n for await (const page of result) {\n console.log(page);\n }\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Operations;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n$request = new Operations\\MembersListMembersRequest();\n\n$responses = $sdk->members->listMembers(\n request: $request\n);\n\n\nforeach ($responses as $response) {\n if ($response->statusCode === 200) {\n // handle response\n }\n}" } ] }, "post": { "tags": [ "members", "public", "mcp" ], "summary": "Create Member", "description": "Create a new member for a customer.\n\nOnly B2B customers with the member management feature enabled can add members.\nThe authenticated user or organization must have access to the customer's organization.\n\n**Scopes**: `members:write`", "operationId": "members:create_member", "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/MemberCreate" } } } }, "responses": { "201": { "description": "Member created.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Member" } } } }, "403": { "description": "Not permitted to add members." }, "404": { "description": "Member not found.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ResourceNotFound" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-mcp": { "disabled": false, "scopes": [ "write", "members" ] }, "x-speakeasy-group": "members", "x-speakeasy-name-override": "create_member", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Members.CreateMember(ctx, components.MemberCreate{\n CustomerID: \"\",\n Email: \"member@example.com\",\n Name: polargo.Pointer(\"Jane Doe\"),\n ExternalID: polargo.Pointer(\"usr_1337\"),\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.Member != nil {\n // handle response\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.members.create_member(request={\n \"customer_id\": \"\",\n \"email\": \"member@example.com\",\n \"name\": \"Jane Doe\",\n \"external_id\": \"usr_1337\",\n })\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.members.createMember({\n customerId: \"\",\n email: \"member@example.com\",\n name: \"Jane Doe\",\n externalId: \"usr_1337\",\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Components;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n$request = new Components\\MemberCreate(\n customerId: '',\n email: 'member@example.com',\n name: 'Jane Doe',\n externalId: 'usr_1337',\n);\n\n$response = $sdk->members->createMember(\n request: $request\n);\n\nif ($response->member !== null) {\n // handle response\n}" } ] } }, "/v1/members/{id}": { "get": { "tags": [ "members", "public", "mcp" ], "summary": "Get Member", "description": "Get a member by ID.\n\nThe authenticated user or organization must have access to the member's organization.\n\n**Scopes**: `members:read` `members:write`", "operationId": "members:get_member", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid", "title": "Id" } } ], "responses": { "200": { "description": "Member retrieved.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Member" } } } }, "404": { "description": "Member not found.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ResourceNotFound" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-mcp": { "disabled": false, "scopes": [ "read", "members" ] }, "x-speakeasy-group": "members", "x-speakeasy-name-override": "get_member", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Members.GetMember(ctx, \"572bebad-ee17-4d04-a50f-6596a7d92cf3\")\n if err != nil {\n log.Fatal(err)\n }\n if res.Member != nil {\n // handle response\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.members.get_member(id=\"572bebad-ee17-4d04-a50f-6596a7d92cf3\")\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.members.getMember({\n id: \"572bebad-ee17-4d04-a50f-6596a7d92cf3\",\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n\n\n$response = $sdk->members->getMember(\n id: '572bebad-ee17-4d04-a50f-6596a7d92cf3'\n);\n\nif ($response->member !== null) {\n // handle response\n}" } ] }, "patch": { "tags": [ "members", "public", "mcp" ], "summary": "Update Member", "description": "Update a member.\n\nOnly name and role can be updated.\nThe authenticated user or organization must have access to the member's organization.\n\n**Scopes**: `members:write`", "operationId": "members:update_member", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid", "title": "Id" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/MemberUpdate" } } } }, "responses": { "200": { "description": "Member updated.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Member" } } } }, "404": { "description": "Member not found.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ResourceNotFound" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-mcp": { "disabled": false, "scopes": [ "write", "members" ] }, "x-speakeasy-group": "members", "x-speakeasy-name-override": "update_member", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Members.UpdateMember(ctx, \"ab9b628a-6dbd-4f07-bcd6-163a8b5b7de4\", components.MemberUpdate{\n Name: polargo.Pointer(\"Jane Doe\"),\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.Member != nil {\n // handle response\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.members.update_member(id=\"ab9b628a-6dbd-4f07-bcd6-163a8b5b7de4\", member_update={\n \"name\": \"Jane Doe\",\n })\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.members.updateMember({\n id: \"ab9b628a-6dbd-4f07-bcd6-163a8b5b7de4\",\n memberUpdate: {\n name: \"Jane Doe\",\n },\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Components;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n$memberUpdate = new Components\\MemberUpdate(\n name: 'Jane Doe',\n);\n\n$response = $sdk->members->updateMember(\n id: 'ab9b628a-6dbd-4f07-bcd6-163a8b5b7de4',\n memberUpdate: $memberUpdate\n\n);\n\nif ($response->member !== null) {\n // handle response\n}" } ] }, "delete": { "tags": [ "members", "public", "mcp" ], "summary": "Delete Member", "description": "Delete a member.\n\nThe authenticated user or organization must have access to the member's organization.\n\n**Scopes**: `members:write`", "operationId": "members:delete_member", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid", "title": "Id" } } ], "responses": { "204": { "description": "Member deleted." }, "404": { "description": "Member not found.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ResourceNotFound" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-mcp": { "disabled": false, "scopes": [ "write", "members" ] }, "x-speakeasy-group": "members", "x-speakeasy-name-override": "delete_member", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Members.DeleteMember(ctx, \"913247e9-8f2b-4bd1-a47e-9842d173a7cb\")\n if err != nil {\n log.Fatal(err)\n }\n if res != nil {\n // handle response\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n polar.members.delete_member(id=\"913247e9-8f2b-4bd1-a47e-9842d173a7cb\")\n\n # Use the SDK ..." }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n await polar.members.deleteMember({\n id: \"913247e9-8f2b-4bd1-a47e-9842d173a7cb\",\n });\n\n\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n\n\n$response = $sdk->members->deleteMember(\n id: '913247e9-8f2b-4bd1-a47e-9842d173a7cb'\n);\n\nif ($response->statusCode === 200) {\n // handle response\n}" } ] } }, "/v1/customer-portal/benefit-grants/": { "get": { "tags": [ "customer_portal", "benefit-grants", "public" ], "summary": "List Benefit Grants", "description": "List benefits grants of the authenticated customer.\n\n**Scopes**: `customer_portal:read` `customer_portal:write`", "operationId": "customer_portal:benefit-grants:list", "security": [ { "customer_session": [ "customer_portal:read", "customer_portal:write" ] }, { "member_session": [ "customer_portal:read", "customer_portal:write" ] } ], "parameters": [ { "name": "query", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "description": "Filter by benefit description.", "title": "Query" }, "description": "Filter by benefit description." }, { "name": "type", "in": "query", "required": false, "schema": { "anyOf": [ { "$ref": "#/components/schemas/BenefitType" }, { "type": "array", "items": { "$ref": "#/components/schemas/BenefitType" } }, { "type": "null" } ], "title": "BenefitType Filter", "description": "Filter by benefit type." }, "description": "Filter by benefit type.", "x-speakeasy-name-override": "type_filter" }, { "name": "benefit_id", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "array", "items": { "type": "string", "format": "uuid4" } }, { "type": "null" } ], "title": "BenefitID Filter", "description": "Filter by benefit ID." }, "description": "Filter by benefit ID." }, { "name": "checkout_id", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "array", "items": { "type": "string", "format": "uuid4" } }, { "type": "null" } ], "title": "CheckoutID Filter", "description": "Filter by checkout ID." }, "description": "Filter by checkout ID." }, { "name": "order_id", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string", "format": "uuid4", "description": "The order ID." }, { "type": "array", "items": { "type": "string", "format": "uuid4", "description": "The order ID." } }, { "type": "null" } ], "title": "OrderID Filter", "description": "Filter by order ID." }, "description": "Filter by order ID." }, { "name": "subscription_id", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string", "format": "uuid4", "description": "The subscription ID." }, { "type": "array", "items": { "type": "string", "format": "uuid4", "description": "The subscription ID." } }, { "type": "null" } ], "title": "SubscriptionID Filter", "description": "Filter by subscription ID." }, "description": "Filter by subscription ID." }, { "name": "member_id", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "array", "items": { "type": "string", "format": "uuid4" } }, { "type": "null" } ], "title": "MemberID Filter", "description": "Filter by member ID." }, "description": "Filter by member ID." }, { "name": "page", "in": "query", "required": false, "schema": { "type": "integer", "exclusiveMinimum": 0, "description": "Page number, defaults to 1.", "default": 1, "title": "Page" }, "description": "Page number, defaults to 1." }, { "name": "limit", "in": "query", "required": false, "schema": { "type": "integer", "exclusiveMinimum": 0, "description": "Size of a page, defaults to 10. Maximum is 100.", "default": 10, "title": "Limit" }, "description": "Size of a page, defaults to 10. Maximum is 100." }, { "name": "sorting", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "array", "items": { "$ref": "#/components/schemas/CustomerBenefitGrantSortProperty" } }, { "type": "null" } ], "description": "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.", "default": [ "product_benefit", "-granted_at" ], "title": "Sorting" }, "description": "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." } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ListResource_CustomerBenefitGrant_" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Customer", "Member" ], "x-speakeasy-pagination": { "type": "offsetLimit", "inputs": [ { "name": "page", "in": "parameters", "type": "page" }, { "name": "limit", "in": "parameters", "type": "limit" } ], "outputs": { "results": "$.items", "numPages": "$.pagination.max_page" } }, "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "customer_portal.benefit-grants", "x-speakeasy-name-override": "list", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/operations\"\n\t\"os\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New()\n\n res, err := s.CustomerPortal.BenefitGrants.List(ctx, operations.CustomerPortalBenefitGrantsListRequest{}, operations.CustomerPortalBenefitGrantsListSecurity{\n CustomerSession: polargo.Pointer(os.Getenv(\"POLAR_CUSTOMER_SESSION\")),\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.ListResourceCustomerBenefitGrant != nil {\n for {\n // handle items\n\n res, err = res.Next()\n\n if err != nil {\n // handle error\n }\n\n if res == nil {\n break\n }\n }\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "import polar_sdk\nfrom polar_sdk import Polar\n\n\nwith Polar() as polar:\n\n res = polar.customer_portal.benefit_grants.list(security=polar_sdk.CustomerPortalBenefitGrantsListSecurity(\n customer_session=\"\",\n ), page=1, limit=10)\n\n while res is not None:\n # Handle items\n\n res = res.next()" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar();\n\nasync function run() {\n const result = await polar.customerPortal.benefitGrants.list({\n customerSession: process.env[\"POLAR_CUSTOMER_SESSION\"] ?? \"\",\n }, {});\n\n for await (const page of result) {\n console.log(page);\n }\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Operations;\n\n$sdk = Polar\\Polar::builder()->build();\n\n$request = new Operations\\CustomerPortalBenefitGrantsListRequest();\n$requestSecurity = new Operations\\CustomerPortalBenefitGrantsListSecurity(\n customerSession: '',\n);\n\n$responses = $sdk->customerPortal->benefitGrants->list(\n request: $request,\n security: $requestSecurity\n);\n\n\nforeach ($responses as $response) {\n if ($response->statusCode === 200) {\n // handle response\n }\n}" } ] } }, "/v1/customer-portal/benefit-grants/{id}": { "get": { "tags": [ "customer_portal", "benefit-grants", "public" ], "summary": "Get Benefit Grant", "description": "Get a benefit grant by ID for the authenticated customer.\n\n**Scopes**: `customer_portal:read` `customer_portal:write`", "operationId": "customer_portal:benefit-grants:get", "security": [ { "customer_session": [ "customer_portal:read", "customer_portal:write" ] }, { "member_session": [ "customer_portal:read", "customer_portal:write" ] } ], "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid4", "description": "The benefit grant ID.", "title": "Id" }, "description": "The benefit grant ID." } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CustomerBenefitGrant", "title": "CustomerBenefitGrant" } } } }, "404": { "description": "Benefit grant not found.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ResourceNotFound" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Customer", "Member" ], "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "customer_portal.benefit-grants", "x-speakeasy-name-override": "get", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"os\"\n\t\"github.com/polarsource/polar-go/models/operations\"\n\t\"log\"\n\t\"github.com/polarsource/polar-go/models/components\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New()\n\n res, err := s.CustomerPortal.BenefitGrants.Get(ctx, operations.CustomerPortalBenefitGrantsGetSecurity{\n CustomerSession: polargo.Pointer(os.Getenv(\"POLAR_CUSTOMER_SESSION\")),\n }, \"\")\n if err != nil {\n log.Fatal(err)\n }\n if res.CustomerBenefitGrant != nil {\n switch res.CustomerBenefitGrant.Type {\n case components.CustomerBenefitGrantTypeCustomerBenefitGrantDiscord:\n // res.CustomerBenefitGrant.CustomerBenefitGrantDiscord is populated\n case components.CustomerBenefitGrantTypeCustomerBenefitGrantGitHubRepository:\n // res.CustomerBenefitGrant.CustomerBenefitGrantGitHubRepository is populated\n case components.CustomerBenefitGrantTypeCustomerBenefitGrantDownloadables:\n // res.CustomerBenefitGrant.CustomerBenefitGrantDownloadables is populated\n case components.CustomerBenefitGrantTypeCustomerBenefitGrantLicenseKeys:\n // res.CustomerBenefitGrant.CustomerBenefitGrantLicenseKeys is populated\n case components.CustomerBenefitGrantTypeCustomerBenefitGrantCustom:\n // res.CustomerBenefitGrant.CustomerBenefitGrantCustom is populated\n case components.CustomerBenefitGrantTypeCustomerBenefitGrantMeterCredit:\n // res.CustomerBenefitGrant.CustomerBenefitGrantMeterCredit is populated\n }\n\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "import polar_sdk\nfrom polar_sdk import Polar\n\n\nwith Polar() as polar:\n\n res = polar.customer_portal.benefit_grants.get(security=polar_sdk.CustomerPortalBenefitGrantsGetSecurity(\n customer_session=\"\",\n ), id=\"\")\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar();\n\nasync function run() {\n const result = await polar.customerPortal.benefitGrants.get({\n customerSession: process.env[\"POLAR_CUSTOMER_SESSION\"] ?? \"\",\n }, {\n id: \"\",\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Operations;\n\n$sdk = Polar\\Polar::builder()->build();\n\n\n$requestSecurity = new Operations\\CustomerPortalBenefitGrantsGetSecurity(\n customerSession: '',\n);\n\n$response = $sdk->customerPortal->benefitGrants->get(\n security: $requestSecurity,\n id: ''\n\n);\n\nif ($response->customerBenefitGrant !== null) {\n // handle response\n}" } ] }, "patch": { "tags": [ "customer_portal", "benefit-grants", "public" ], "summary": "Update Benefit Grant", "description": "Update a benefit grant for the authenticated customer.\n\n**Scopes**: `customer_portal:write`", "operationId": "customer_portal:benefit-grants:update", "security": [ { "customer_session": [ "customer_portal:write" ] }, { "member_session": [ "customer_portal:write" ] } ], "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid4", "description": "The benefit grant ID.", "title": "Id" }, "description": "The benefit grant ID." } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CustomerBenefitGrantUpdate", "title": "CustomerBenefitGrantUpdate" } } } }, "responses": { "200": { "description": "Benefit grant updated.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CustomerBenefitGrant", "title": "CustomerBenefitGrant" } } } }, "403": { "description": "The benefit grant is revoked and cannot be updated.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/NotPermitted" } } } }, "404": { "description": "Benefit grant not found.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ResourceNotFound" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Customer", "Member" ], "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "customer_portal.benefit-grants", "x-speakeasy-name-override": "update", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"os\"\n\t\"github.com/polarsource/polar-go/models/operations\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New()\n\n res, err := s.CustomerPortal.BenefitGrants.Update(ctx, operations.CustomerPortalBenefitGrantsUpdateSecurity{\n CustomerSession: polargo.Pointer(os.Getenv(\"POLAR_CUSTOMER_SESSION\")),\n }, \"\", components.CreateCustomerBenefitGrantUpdateLicenseKeys(\n components.CustomerBenefitGrantLicenseKeysUpdate{},\n ))\n if err != nil {\n log.Fatal(err)\n }\n if res.CustomerBenefitGrant != nil {\n switch res.CustomerBenefitGrant.Type {\n case components.CustomerBenefitGrantTypeCustomerBenefitGrantDiscord:\n // res.CustomerBenefitGrant.CustomerBenefitGrantDiscord is populated\n case components.CustomerBenefitGrantTypeCustomerBenefitGrantGitHubRepository:\n // res.CustomerBenefitGrant.CustomerBenefitGrantGitHubRepository is populated\n case components.CustomerBenefitGrantTypeCustomerBenefitGrantDownloadables:\n // res.CustomerBenefitGrant.CustomerBenefitGrantDownloadables is populated\n case components.CustomerBenefitGrantTypeCustomerBenefitGrantLicenseKeys:\n // res.CustomerBenefitGrant.CustomerBenefitGrantLicenseKeys is populated\n case components.CustomerBenefitGrantTypeCustomerBenefitGrantCustom:\n // res.CustomerBenefitGrant.CustomerBenefitGrantCustom is populated\n case components.CustomerBenefitGrantTypeCustomerBenefitGrantMeterCredit:\n // res.CustomerBenefitGrant.CustomerBenefitGrantMeterCredit is populated\n }\n\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "import polar_sdk\nfrom polar_sdk import Polar\n\n\nwith Polar() as polar:\n\n res = polar.customer_portal.benefit_grants.update(security=polar_sdk.CustomerPortalBenefitGrantsUpdateSecurity(\n customer_session=\"\",\n ), id=\"\", customer_benefit_grant_update={\n \"benefit_type\": \"license_keys\",\n })\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar();\n\nasync function run() {\n const result = await polar.customerPortal.benefitGrants.update({\n customerSession: process.env[\"POLAR_CUSTOMER_SESSION\"] ?? \"\",\n }, {\n id: \"\",\n customerBenefitGrantUpdate: {\n benefitType: \"license_keys\",\n },\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Components;\nuse Polar\\Models\\Operations;\n\n$sdk = Polar\\Polar::builder()->build();\n\n\n$requestSecurity = new Operations\\CustomerPortalBenefitGrantsUpdateSecurity(\n customerSession: '',\n);\n\n$response = $sdk->customerPortal->benefitGrants->update(\n security: $requestSecurity,\n id: '',\n customerBenefitGrantUpdate: new Components\\CustomerBenefitGrantLicenseKeysUpdate()\n\n);\n\nif ($response->customerBenefitGrant !== null) {\n // handle response\n}" } ] } }, "/v1/customer-portal/customers/me": { "get": { "tags": [ "customer_portal", "customers", "public" ], "summary": "Get Customer", "description": "Get authenticated customer.\n\n**Scopes**: `customer_portal:read` `customer_portal:write`", "operationId": "customer_portal:customers:get", "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CustomerPortalCustomer" } } } } }, "security": [ { "customer_session": [ "customer_portal:read", "customer_portal:write" ] }, { "member_session": [ "customer_portal:read", "customer_portal:write" ] } ], "x-polar-allowed-subjects": [ "Customer", "Member" ], "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "customer_portal.customers", "x-speakeasy-name-override": "get", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"os\"\n\t\"github.com/polarsource/polar-go/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New()\n\n res, err := s.CustomerPortal.Customers.Get(ctx, operations.CustomerPortalCustomersGetSecurity{\n CustomerSession: polargo.Pointer(os.Getenv(\"POLAR_CUSTOMER_SESSION\")),\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.CustomerPortalCustomer != nil {\n // handle response\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "import polar_sdk\nfrom polar_sdk import Polar\n\n\nwith Polar() as polar:\n\n res = polar.customer_portal.customers.get(security=polar_sdk.CustomerPortalCustomersGetSecurity(\n customer_session=\"\",\n ))\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar();\n\nasync function run() {\n const result = await polar.customerPortal.customers.get({\n customerSession: process.env[\"POLAR_CUSTOMER_SESSION\"] ?? \"\",\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Operations;\n\n$sdk = Polar\\Polar::builder()->build();\n\n\n$requestSecurity = new Operations\\CustomerPortalCustomersGetSecurity(\n customerSession: '',\n);\n\n$response = $sdk->customerPortal->customers->get(\n security: $requestSecurity\n);\n\nif ($response->customerPortalCustomer !== null) {\n // handle response\n}" } ] }, "patch": { "tags": [ "customer_portal", "customers", "public" ], "summary": "Update Customer", "description": "Update authenticated customer.", "operationId": "customer_portal:customers:update", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CustomerPortalCustomerUpdate" } } }, "required": true }, "responses": { "200": { "description": "Customer updated.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CustomerPortalCustomer" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "security": [ { "customer_session": [ "customer_portal:write" ] }, { "member_session": [ "customer_portal:write" ] } ], "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "customer_portal.customers", "x-speakeasy-name-override": "update", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"os\"\n\t\"github.com/polarsource/polar-go/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New()\n\n res, err := s.CustomerPortal.Customers.Update(ctx, components.CustomerPortalCustomerUpdate{\n BillingAddress: &components.AddressInput{\n Country: components.CountryAlpha2InputUs,\n },\n }, operations.CustomerPortalCustomersUpdateSecurity{\n CustomerSession: polargo.Pointer(os.Getenv(\"POLAR_CUSTOMER_SESSION\")),\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.CustomerPortalCustomer != nil {\n // handle response\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "import polar_sdk\nfrom polar_sdk import Polar\n\n\nwith Polar() as polar:\n\n res = polar.customer_portal.customers.update(security=polar_sdk.CustomerPortalCustomersUpdateSecurity(\n customer_session=\"\",\n ), request={\n \"billing_address\": {\n \"country\": polar_sdk.CountryAlpha2Input.US,\n },\n })\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar();\n\nasync function run() {\n const result = await polar.customerPortal.customers.update({\n customerSession: process.env[\"POLAR_CUSTOMER_SESSION\"] ?? \"\",\n }, {\n billingAddress: {\n country: \"US\",\n },\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Components;\nuse Polar\\Models\\Operations;\n\n$sdk = Polar\\Polar::builder()->build();\n\n$request = new Components\\CustomerPortalCustomerUpdate(\n billingAddress: new Components\\AddressInput(\n country: Components\\CountryAlpha2Input::Us,\n ),\n);\n$requestSecurity = new Operations\\CustomerPortalCustomersUpdateSecurity(\n customerSession: '',\n);\n\n$response = $sdk->customerPortal->customers->update(\n request: $request,\n security: $requestSecurity\n);\n\nif ($response->customerPortalCustomer !== null) {\n // handle response\n}" } ] } }, "/v1/customer-portal/customers/me/payment-methods": { "get": { "tags": [ "customer_portal", "customers", "public" ], "summary": "List Customer Payment Methods", "description": "Get saved payment methods of the authenticated customer.", "operationId": "customer_portal:customers:list_payment_methods", "security": [ { "customer_session": [ "customer_portal:read", "customer_portal:write" ] }, { "member_session": [ "customer_portal:read", "customer_portal:write" ] } ], "parameters": [ { "name": "page", "in": "query", "required": false, "schema": { "type": "integer", "exclusiveMinimum": 0, "description": "Page number, defaults to 1.", "default": 1, "title": "Page" }, "description": "Page number, defaults to 1." }, { "name": "limit", "in": "query", "required": false, "schema": { "type": "integer", "exclusiveMinimum": 0, "description": "Size of a page, defaults to 10. Maximum is 100.", "default": 10, "title": "Limit" }, "description": "Size of a page, defaults to 10. Maximum is 100." } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ListResource_CustomerPaymentMethod_" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-speakeasy-pagination": { "type": "offsetLimit", "inputs": [ { "name": "page", "in": "parameters", "type": "page" }, { "name": "limit", "in": "parameters", "type": "limit" } ], "outputs": { "results": "$.items", "numPages": "$.pagination.max_page" } }, "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "customer_portal.customers", "x-speakeasy-name-override": "list_payment_methods", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"os\"\n\t\"github.com/polarsource/polar-go/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New()\n\n res, err := s.CustomerPortal.Customers.ListPaymentMethods(ctx, operations.CustomerPortalCustomersListPaymentMethodsSecurity{\n CustomerSession: polargo.Pointer(os.Getenv(\"POLAR_CUSTOMER_SESSION\")),\n }, polargo.Pointer[int64](1), polargo.Pointer[int64](10))\n if err != nil {\n log.Fatal(err)\n }\n if res.ListResourceCustomerPaymentMethod != nil {\n for {\n // handle items\n\n res, err = res.Next()\n\n if err != nil {\n // handle error\n }\n\n if res == nil {\n break\n }\n }\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "import polar_sdk\nfrom polar_sdk import Polar\n\n\nwith Polar() as polar:\n\n res = polar.customer_portal.customers.list_payment_methods(security=polar_sdk.CustomerPortalCustomersListPaymentMethodsSecurity(\n customer_session=\"\",\n ), page=1, limit=10)\n\n while res is not None:\n # Handle items\n\n res = res.next()" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar();\n\nasync function run() {\n const result = await polar.customerPortal.customers.listPaymentMethods({\n customerSession: process.env[\"POLAR_CUSTOMER_SESSION\"] ?? \"\",\n }, {});\n\n for await (const page of result) {\n console.log(page);\n }\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Operations;\n\n$sdk = Polar\\Polar::builder()->build();\n\n\n$requestSecurity = new Operations\\CustomerPortalCustomersListPaymentMethodsSecurity(\n customerSession: '',\n);\n\n$responses = $sdk->customerPortal->customers->listPaymentMethods(\n security: $requestSecurity,\n page: 1,\n limit: 10\n\n);\n\n\nforeach ($responses as $response) {\n if ($response->statusCode === 200) {\n // handle response\n }\n}" } ] }, "post": { "tags": [ "customer_portal", "customers", "public" ], "summary": "Add Customer Payment Method", "description": "Add a payment method to the authenticated customer.", "operationId": "customer_portal:customers:add_payment_method", "security": [ { "customer_session": [ "customer_portal:write" ] }, { "member_session": [ "customer_portal:write" ] } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CustomerPaymentMethodCreate" } } } }, "responses": { "201": { "description": "Payment method created or setup initiated.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CustomerPaymentMethodCreateResponse", "title": "CustomerPaymentMethodCreateResponse" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "customer_portal.customers", "x-speakeasy-name-override": "add_payment_method", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"os\"\n\t\"github.com/polarsource/polar-go/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New()\n\n res, err := s.CustomerPortal.Customers.AddPaymentMethod(ctx, components.CustomerPaymentMethodCreate{\n ConfirmationTokenID: \"\",\n SetDefault: false,\n ReturnURL: \"https://yearly-custom.net/\",\n }, operations.CustomerPortalCustomersAddPaymentMethodSecurity{\n CustomerSession: polargo.Pointer(os.Getenv(\"POLAR_CUSTOMER_SESSION\")),\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.CustomerPaymentMethodCreateResponse != nil {\n switch res.CustomerPaymentMethodCreateResponse.Type {\n case components.CustomerPaymentMethodCreateResponseTypeRequiresAction:\n // res.CustomerPaymentMethodCreateResponse.CustomerPaymentMethodCreateRequiresActionResponse is populated\n case components.CustomerPaymentMethodCreateResponseTypeSucceeded:\n // res.CustomerPaymentMethodCreateResponse.CustomerPaymentMethodCreateSucceededResponse is populated\n }\n\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "import polar_sdk\nfrom polar_sdk import Polar\n\n\nwith Polar() as polar:\n\n res = polar.customer_portal.customers.add_payment_method(security=polar_sdk.CustomerPortalCustomersAddPaymentMethodSecurity(\n customer_session=\"\",\n ), request={\n \"confirmation_token_id\": \"\",\n \"set_default\": False,\n \"return_url\": \"https://yearly-custom.net/\",\n })\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar();\n\nasync function run() {\n const result = await polar.customerPortal.customers.addPaymentMethod({\n customerSession: process.env[\"POLAR_CUSTOMER_SESSION\"] ?? \"\",\n }, {\n confirmationTokenId: \"\",\n setDefault: false,\n returnUrl: \"https://yearly-custom.net/\",\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Components;\nuse Polar\\Models\\Operations;\n\n$sdk = Polar\\Polar::builder()->build();\n\n$request = new Components\\CustomerPaymentMethodCreate(\n confirmationTokenId: '',\n setDefault: false,\n returnUrl: 'https://yearly-custom.net/',\n);\n$requestSecurity = new Operations\\CustomerPortalCustomersAddPaymentMethodSecurity(\n customerSession: '',\n);\n\n$response = $sdk->customerPortal->customers->addPaymentMethod(\n request: $request,\n security: $requestSecurity\n);\n\nif ($response->customerPaymentMethodCreateResponse !== null) {\n // handle response\n}" } ] } }, "/v1/customer-portal/customers/me/payment-methods/confirm": { "post": { "tags": [ "customer_portal", "customers", "public" ], "summary": "Confirm Customer Payment Method", "description": "Confirm a payment method for the authenticated customer.", "operationId": "customer_portal:customers:confirm_payment_method", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CustomerPaymentMethodConfirm" } } }, "required": true }, "responses": { "201": { "description": "Payment method created or setup initiated.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CustomerPaymentMethodCreateResponse", "title": "CustomerPaymentMethodCreateResponse" } } } }, "400": { "description": "Customer is not ready to confirm a payment method.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CustomerNotReady" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "security": [ { "customer_session": [ "customer_portal:write" ] }, { "member_session": [ "customer_portal:write" ] } ], "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "customer_portal.customers", "x-speakeasy-name-override": "confirm_payment_method", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"os\"\n\t\"github.com/polarsource/polar-go/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New()\n\n res, err := s.CustomerPortal.Customers.ConfirmPaymentMethod(ctx, components.CustomerPaymentMethodConfirm{\n SetupIntentID: \"\",\n SetDefault: true,\n }, operations.CustomerPortalCustomersConfirmPaymentMethodSecurity{\n CustomerSession: polargo.Pointer(os.Getenv(\"POLAR_CUSTOMER_SESSION\")),\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.CustomerPaymentMethodCreateResponse != nil {\n switch res.CustomerPaymentMethodCreateResponse.Type {\n case components.CustomerPaymentMethodCreateResponseTypeRequiresAction:\n // res.CustomerPaymentMethodCreateResponse.CustomerPaymentMethodCreateRequiresActionResponse is populated\n case components.CustomerPaymentMethodCreateResponseTypeSucceeded:\n // res.CustomerPaymentMethodCreateResponse.CustomerPaymentMethodCreateSucceededResponse is populated\n }\n\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "import polar_sdk\nfrom polar_sdk import Polar\n\n\nwith Polar() as polar:\n\n res = polar.customer_portal.customers.confirm_payment_method(security=polar_sdk.CustomerPortalCustomersConfirmPaymentMethodSecurity(\n customer_session=\"\",\n ), request={\n \"setup_intent_id\": \"\",\n \"set_default\": True,\n })\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar();\n\nasync function run() {\n const result = await polar.customerPortal.customers.confirmPaymentMethod({\n customerSession: process.env[\"POLAR_CUSTOMER_SESSION\"] ?? \"\",\n }, {\n setupIntentId: \"\",\n setDefault: true,\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Components;\nuse Polar\\Models\\Operations;\n\n$sdk = Polar\\Polar::builder()->build();\n\n$request = new Components\\CustomerPaymentMethodConfirm(\n setupIntentId: '',\n setDefault: true,\n);\n$requestSecurity = new Operations\\CustomerPortalCustomersConfirmPaymentMethodSecurity(\n customerSession: '',\n);\n\n$response = $sdk->customerPortal->customers->confirmPaymentMethod(\n request: $request,\n security: $requestSecurity\n);\n\nif ($response->customerPaymentMethodCreateResponse !== null) {\n // handle response\n}" } ] } }, "/v1/customer-portal/customers/me/payment-methods/{id}": { "delete": { "tags": [ "customer_portal", "customers", "public" ], "summary": "Delete Customer Payment Method", "description": "Delete a payment method from the authenticated customer.", "operationId": "customer_portal:customers:delete_payment_method", "security": [ { "customer_session": [ "customer_portal:write" ] }, { "member_session": [ "customer_portal:write" ] } ], "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid4", "title": "Id" } } ], "responses": { "204": { "description": "Payment method deleted." }, "400": { "description": "Payment method is used by active subscription(s).", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PaymentMethodInUseByActiveSubscription" } } } }, "404": { "description": "Payment method not found.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ResourceNotFound" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "customer_portal.customers", "x-speakeasy-name-override": "delete_payment_method", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"os\"\n\t\"github.com/polarsource/polar-go/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New()\n\n res, err := s.CustomerPortal.Customers.DeletePaymentMethod(ctx, operations.CustomerPortalCustomersDeletePaymentMethodSecurity{\n CustomerSession: polargo.Pointer(os.Getenv(\"POLAR_CUSTOMER_SESSION\")),\n }, \"\")\n if err != nil {\n log.Fatal(err)\n }\n if res != nil {\n // handle response\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "import polar_sdk\nfrom polar_sdk import Polar\n\n\nwith Polar() as polar:\n\n polar.customer_portal.customers.delete_payment_method(security=polar_sdk.CustomerPortalCustomersDeletePaymentMethodSecurity(\n customer_session=\"\",\n ), id=\"\")\n\n # Use the SDK ..." }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar();\n\nasync function run() {\n await polar.customerPortal.customers.deletePaymentMethod({\n customerSession: process.env[\"POLAR_CUSTOMER_SESSION\"] ?? \"\",\n }, {\n id: \"\",\n });\n\n\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Operations;\n\n$sdk = Polar\\Polar::builder()->build();\n\n\n$requestSecurity = new Operations\\CustomerPortalCustomersDeletePaymentMethodSecurity(\n customerSession: '',\n);\n\n$response = $sdk->customerPortal->customers->deletePaymentMethod(\n security: $requestSecurity,\n id: ''\n\n);\n\nif ($response->statusCode === 200) {\n // handle response\n}" } ] } }, "/v1/customer-portal/meters/": { "get": { "tags": [ "customer_portal", "customer_meters", "public" ], "summary": "List Meters", "description": "List meters of the authenticated customer.\n\n**Scopes**: `customer_portal:read` `customer_portal:write`", "operationId": "customer_portal:customer_meters:list", "security": [ { "customer_session": [ "customer_portal:read", "customer_portal:write" ] }, { "member_session": [ "customer_portal:read", "customer_portal:write" ] } ], "parameters": [ { "name": "meter_id", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string", "format": "uuid4", "description": "The meter ID." }, { "type": "array", "items": { "type": "string", "format": "uuid4", "description": "The meter ID." } }, { "type": "null" } ], "title": "MeterID Filter", "description": "Filter by meter ID." }, "description": "Filter by meter ID." }, { "name": "query", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "description": "Filter by meter name.", "title": "Query" }, "description": "Filter by meter name." }, { "name": "page", "in": "query", "required": false, "schema": { "type": "integer", "exclusiveMinimum": 0, "description": "Page number, defaults to 1.", "default": 1, "title": "Page" }, "description": "Page number, defaults to 1." }, { "name": "limit", "in": "query", "required": false, "schema": { "type": "integer", "exclusiveMinimum": 0, "description": "Size of a page, defaults to 10. Maximum is 100.", "default": 10, "title": "Limit" }, "description": "Size of a page, defaults to 10. Maximum is 100." }, { "name": "sorting", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "array", "items": { "$ref": "#/components/schemas/CustomerCustomerMeterSortProperty" } }, { "type": "null" } ], "description": "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.", "default": [ "-modified_at" ], "title": "Sorting" }, "description": "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." } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ListResource_CustomerCustomerMeter_" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Customer", "Member" ], "x-speakeasy-pagination": { "type": "offsetLimit", "inputs": [ { "name": "page", "in": "parameters", "type": "page" }, { "name": "limit", "in": "parameters", "type": "limit" } ], "outputs": { "results": "$.items", "numPages": "$.pagination.max_page" } }, "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "customer_portal.customer_meters", "x-speakeasy-name-override": "list", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/operations\"\n\t\"os\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New()\n\n res, err := s.CustomerPortal.CustomerMeters.List(ctx, operations.CustomerPortalCustomerMetersListRequest{}, operations.CustomerPortalCustomerMetersListSecurity{\n CustomerSession: polargo.Pointer(os.Getenv(\"POLAR_CUSTOMER_SESSION\")),\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.ListResourceCustomerCustomerMeter != nil {\n for {\n // handle items\n\n res, err = res.Next()\n\n if err != nil {\n // handle error\n }\n\n if res == nil {\n break\n }\n }\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "import polar_sdk\nfrom polar_sdk import Polar\n\n\nwith Polar() as polar:\n\n res = polar.customer_portal.customer_meters.list(security=polar_sdk.CustomerPortalCustomerMetersListSecurity(\n customer_session=\"\",\n ), page=1, limit=10)\n\n while res is not None:\n # Handle items\n\n res = res.next()" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar();\n\nasync function run() {\n const result = await polar.customerPortal.customerMeters.list({\n customerSession: process.env[\"POLAR_CUSTOMER_SESSION\"] ?? \"\",\n }, {});\n\n for await (const page of result) {\n console.log(page);\n }\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Operations;\n\n$sdk = Polar\\Polar::builder()->build();\n\n$request = new Operations\\CustomerPortalCustomerMetersListRequest();\n$requestSecurity = new Operations\\CustomerPortalCustomerMetersListSecurity(\n customerSession: '',\n);\n\n$responses = $sdk->customerPortal->customerMeters->list(\n request: $request,\n security: $requestSecurity\n);\n\n\nforeach ($responses as $response) {\n if ($response->statusCode === 200) {\n // handle response\n }\n}" } ] } }, "/v1/customer-portal/meters/{id}": { "get": { "tags": [ "customer_portal", "customer_meters", "public" ], "summary": "Get Customer Meter", "description": "Get a meter by ID for the authenticated customer.\n\n**Scopes**: `customer_portal:read` `customer_portal:write`", "operationId": "customer_portal:customer_meters:get", "security": [ { "customer_session": [ "customer_portal:read", "customer_portal:write" ] }, { "member_session": [ "customer_portal:read", "customer_portal:write" ] } ], "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid4", "description": "The customer meter ID.", "title": "Id" }, "description": "The customer meter ID." } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CustomerCustomerMeter" } } } }, "404": { "description": "Customer meter not found.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ResourceNotFound" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Customer", "Member" ], "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "customer_portal.customer_meters", "x-speakeasy-name-override": "get", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"os\"\n\t\"github.com/polarsource/polar-go/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New()\n\n res, err := s.CustomerPortal.CustomerMeters.Get(ctx, operations.CustomerPortalCustomerMetersGetSecurity{\n CustomerSession: polargo.Pointer(os.Getenv(\"POLAR_CUSTOMER_SESSION\")),\n }, \"\")\n if err != nil {\n log.Fatal(err)\n }\n if res.CustomerCustomerMeter != nil {\n // handle response\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "import polar_sdk\nfrom polar_sdk import Polar\n\n\nwith Polar() as polar:\n\n res = polar.customer_portal.customer_meters.get(security=polar_sdk.CustomerPortalCustomerMetersGetSecurity(\n customer_session=\"\",\n ), id=\"\")\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar();\n\nasync function run() {\n const result = await polar.customerPortal.customerMeters.get({\n customerSession: process.env[\"POLAR_CUSTOMER_SESSION\"] ?? \"\",\n }, {\n id: \"\",\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Operations;\n\n$sdk = Polar\\Polar::builder()->build();\n\n\n$requestSecurity = new Operations\\CustomerPortalCustomerMetersGetSecurity(\n customerSession: '',\n);\n\n$response = $sdk->customerPortal->customerMeters->get(\n security: $requestSecurity,\n id: ''\n\n);\n\nif ($response->customerCustomerMeter !== null) {\n // handle response\n}" } ] } }, "/v1/customer-portal/seats": { "get": { "tags": [ "customer_portal", "seats", "public" ], "summary": "List Seats", "description": "**Scopes**: `customer_portal:read` `customer_portal:write`", "operationId": "customer_portal:seats:list_seats", "security": [ { "customer_session": [ "customer_portal:read", "customer_portal:write" ] }, { "member_session": [ "customer_portal:read", "customer_portal:write" ] } ], "parameters": [ { "name": "subscription_id", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "description": "Subscription ID", "title": "Subscription Id" }, "description": "Subscription ID" }, { "name": "order_id", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "description": "Order ID", "title": "Order Id" }, "description": "Order ID" } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SeatsList" } } } }, "401": { "description": "Authentication required" }, "403": { "description": "Not permitted or seat-based pricing not enabled" }, "404": { "description": "Subscription or order not found" }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Customer", "Member" ], "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "customer_portal.seats", "x-speakeasy-name-override": "list_seats", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"os\"\n\t\"github.com/polarsource/polar-go/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New()\n\n res, err := s.CustomerPortal.Seats.ListSeats(ctx, operations.CustomerPortalSeatsListSeatsSecurity{\n CustomerSession: polargo.Pointer(os.Getenv(\"POLAR_CUSTOMER_SESSION\")),\n }, polargo.Pointer(\"\"), nil)\n if err != nil {\n log.Fatal(err)\n }\n if res.SeatsList != nil {\n // handle response\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "import polar_sdk\nfrom polar_sdk import Polar\n\n\nwith Polar() as polar:\n\n res = polar.customer_portal.seats.list_seats(security=polar_sdk.CustomerPortalSeatsListSeatsSecurity(\n customer_session=\"\",\n ))\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar();\n\nasync function run() {\n const result = await polar.customerPortal.seats.listSeats({\n customerSession: process.env[\"POLAR_CUSTOMER_SESSION\"] ?? \"\",\n }, {\n subscriptionId: \"\",\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Operations;\n\n$sdk = Polar\\Polar::builder()->build();\n\n\n$requestSecurity = new Operations\\CustomerPortalSeatsListSeatsSecurity(\n customerSession: '',\n);\n\n$response = $sdk->customerPortal->seats->listSeats(\n security: $requestSecurity,\n subscriptionId: ''\n\n);\n\nif ($response->seatsList !== null) {\n // handle response\n}" } ] }, "post": { "tags": [ "customer_portal", "seats", "public" ], "summary": "Assign Seat", "operationId": "customer_portal:seats:assign_seat", "security": [ { "customer_session": [ "customer_portal:write" ] }, { "member_session": [ "customer_portal:write" ] } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SeatAssign" } } } }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CustomerSeat" } } } }, "400": { "description": "No available seats or customer already has a seat" }, "401": { "description": "Authentication required" }, "403": { "description": "Not permitted or seat-based pricing not enabled" }, "404": { "description": "Subscription, order, or customer not found" }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "customer_portal.seats", "x-speakeasy-name-override": "assign_seat", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"os\"\n\t\"github.com/polarsource/polar-go/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New()\n\n res, err := s.CustomerPortal.Seats.AssignSeat(ctx, components.SeatAssign{}, operations.CustomerPortalSeatsAssignSeatSecurity{\n CustomerSession: polargo.Pointer(os.Getenv(\"POLAR_CUSTOMER_SESSION\")),\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.CustomerSeat != nil {\n // handle response\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "import polar_sdk\nfrom polar_sdk import Polar\n\n\nwith Polar() as polar:\n\n res = polar.customer_portal.seats.assign_seat(security=polar_sdk.CustomerPortalSeatsAssignSeatSecurity(\n customer_session=\"\",\n ), request={})\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar();\n\nasync function run() {\n const result = await polar.customerPortal.seats.assignSeat({\n customerSession: process.env[\"POLAR_CUSTOMER_SESSION\"] ?? \"\",\n }, {});\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Components;\nuse Polar\\Models\\Operations;\n\n$sdk = Polar\\Polar::builder()->build();\n\n$request = new Components\\SeatAssign();\n$requestSecurity = new Operations\\CustomerPortalSeatsAssignSeatSecurity(\n customerSession: '',\n);\n\n$response = $sdk->customerPortal->seats->assignSeat(\n request: $request,\n security: $requestSecurity\n);\n\nif ($response->customerSeat !== null) {\n // handle response\n}" } ] } }, "/v1/customer-portal/seats/{seat_id}": { "delete": { "tags": [ "customer_portal", "seats", "public" ], "summary": "Revoke Seat", "operationId": "customer_portal:seats:revoke_seat", "security": [ { "customer_session": [ "customer_portal:write" ] }, { "member_session": [ "customer_portal:write" ] } ], "parameters": [ { "name": "seat_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid4", "title": "Seat Id" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CustomerSeat" } } } }, "401": { "description": "Authentication required" }, "403": { "description": "Not permitted or seat-based pricing not enabled" }, "404": { "description": "Seat not found" }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "customer_portal.seats", "x-speakeasy-name-override": "revoke_seat", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"os\"\n\t\"github.com/polarsource/polar-go/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New()\n\n res, err := s.CustomerPortal.Seats.RevokeSeat(ctx, operations.CustomerPortalSeatsRevokeSeatSecurity{\n CustomerSession: polargo.Pointer(os.Getenv(\"POLAR_CUSTOMER_SESSION\")),\n }, \"4b3d74b3-01ff-4aac-bd03-320535cd5ce4\")\n if err != nil {\n log.Fatal(err)\n }\n if res.CustomerSeat != nil {\n // handle response\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "import polar_sdk\nfrom polar_sdk import Polar\n\n\nwith Polar() as polar:\n\n res = polar.customer_portal.seats.revoke_seat(security=polar_sdk.CustomerPortalSeatsRevokeSeatSecurity(\n customer_session=\"\",\n ), seat_id=\"\")\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar();\n\nasync function run() {\n const result = await polar.customerPortal.seats.revokeSeat({\n customerSession: process.env[\"POLAR_CUSTOMER_SESSION\"] ?? \"\",\n }, {\n seatId: \"4b3d74b3-01ff-4aac-bd03-320535cd5ce4\",\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Operations;\n\n$sdk = Polar\\Polar::builder()->build();\n\n\n$requestSecurity = new Operations\\CustomerPortalSeatsRevokeSeatSecurity(\n customerSession: '',\n);\n\n$response = $sdk->customerPortal->seats->revokeSeat(\n security: $requestSecurity,\n seatId: '4b3d74b3-01ff-4aac-bd03-320535cd5ce4'\n\n);\n\nif ($response->customerSeat !== null) {\n // handle response\n}" } ] } }, "/v1/customer-portal/seats/{seat_id}/resend": { "post": { "tags": [ "customer_portal", "seats", "public" ], "summary": "Resend Invitation", "operationId": "customer_portal:seats:resend_invitation", "security": [ { "customer_session": [ "customer_portal:write" ] }, { "member_session": [ "customer_portal:write" ] } ], "parameters": [ { "name": "seat_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid4", "title": "Seat Id" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CustomerSeat" } } } }, "400": { "description": "Seat is not pending or already claimed" }, "401": { "description": "Authentication required" }, "403": { "description": "Not permitted or seat-based pricing not enabled" }, "404": { "description": "Seat not found" }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "customer_portal.seats", "x-speakeasy-name-override": "resend_invitation", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"os\"\n\t\"github.com/polarsource/polar-go/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New()\n\n res, err := s.CustomerPortal.Seats.ResendInvitation(ctx, operations.CustomerPortalSeatsResendInvitationSecurity{\n CustomerSession: polargo.Pointer(os.Getenv(\"POLAR_CUSTOMER_SESSION\")),\n }, \"e3817437-8d53-4578-88d2-1dc256825965\")\n if err != nil {\n log.Fatal(err)\n }\n if res.CustomerSeat != nil {\n // handle response\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "import polar_sdk\nfrom polar_sdk import Polar\n\n\nwith Polar() as polar:\n\n res = polar.customer_portal.seats.resend_invitation(security=polar_sdk.CustomerPortalSeatsResendInvitationSecurity(\n customer_session=\"\",\n ), seat_id=\"\")\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar();\n\nasync function run() {\n const result = await polar.customerPortal.seats.resendInvitation({\n customerSession: process.env[\"POLAR_CUSTOMER_SESSION\"] ?? \"\",\n }, {\n seatId: \"e3817437-8d53-4578-88d2-1dc256825965\",\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Operations;\n\n$sdk = Polar\\Polar::builder()->build();\n\n\n$requestSecurity = new Operations\\CustomerPortalSeatsResendInvitationSecurity(\n customerSession: '',\n);\n\n$response = $sdk->customerPortal->seats->resendInvitation(\n security: $requestSecurity,\n seatId: 'e3817437-8d53-4578-88d2-1dc256825965'\n\n);\n\nif ($response->customerSeat !== null) {\n // handle response\n}" } ] } }, "/v1/customer-portal/seats/subscriptions": { "get": { "tags": [ "customer_portal", "seats", "public" ], "summary": "List Claimed Subscriptions", "description": "List all subscriptions where the authenticated customer has claimed a seat.\n\n**Scopes**: `customer_portal:read` `customer_portal:write`", "operationId": "customer_portal:seats:list_claimed_subscriptions", "security": [ { "customer_session": [ "customer_portal:read", "customer_portal:write" ] }, { "member_session": [ "customer_portal:read", "customer_portal:write" ] } ], "parameters": [ { "name": "page", "in": "query", "required": false, "schema": { "type": "integer", "exclusiveMinimum": 0, "description": "Page number, defaults to 1.", "default": 1, "title": "Page" }, "description": "Page number, defaults to 1." }, { "name": "limit", "in": "query", "required": false, "schema": { "type": "integer", "exclusiveMinimum": 0, "description": "Size of a page, defaults to 10. Maximum is 100.", "default": 10, "title": "Limit" }, "description": "Size of a page, defaults to 10. Maximum is 100." } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ListResource_CustomerSubscription_" } } } }, "401": { "description": "Authentication required" }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Customer", "Member" ], "x-speakeasy-pagination": { "type": "offsetLimit", "inputs": [ { "name": "page", "in": "parameters", "type": "page" }, { "name": "limit", "in": "parameters", "type": "limit" } ], "outputs": { "results": "$.items", "numPages": "$.pagination.max_page" } }, "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "customer_portal.seats", "x-speakeasy-name-override": "list_claimed_subscriptions", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"os\"\n\t\"github.com/polarsource/polar-go/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New()\n\n res, err := s.CustomerPortal.Seats.ListClaimedSubscriptions(ctx, operations.CustomerPortalSeatsListClaimedSubscriptionsSecurity{\n CustomerSession: polargo.Pointer(os.Getenv(\"POLAR_CUSTOMER_SESSION\")),\n }, polargo.Pointer[int64](1), polargo.Pointer[int64](10))\n if err != nil {\n log.Fatal(err)\n }\n if res.ListResourceCustomerSubscription != nil {\n for {\n // handle items\n\n res, err = res.Next()\n\n if err != nil {\n // handle error\n }\n\n if res == nil {\n break\n }\n }\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "import polar_sdk\nfrom polar_sdk import Polar\n\n\nwith Polar() as polar:\n\n res = polar.customer_portal.seats.list_claimed_subscriptions(security=polar_sdk.CustomerPortalSeatsListClaimedSubscriptionsSecurity(\n customer_session=\"\",\n ), page=1, limit=10)\n\n while res is not None:\n # Handle items\n\n res = res.next()" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar();\n\nasync function run() {\n const result = await polar.customerPortal.seats.listClaimedSubscriptions({\n customerSession: process.env[\"POLAR_CUSTOMER_SESSION\"] ?? \"\",\n }, {});\n\n for await (const page of result) {\n console.log(page);\n }\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Operations;\n\n$sdk = Polar\\Polar::builder()->build();\n\n\n$requestSecurity = new Operations\\CustomerPortalSeatsListClaimedSubscriptionsSecurity(\n customerSession: '',\n);\n\n$responses = $sdk->customerPortal->seats->listClaimedSubscriptions(\n security: $requestSecurity,\n page: 1,\n limit: 10\n\n);\n\n\nforeach ($responses as $response) {\n if ($response->statusCode === 200) {\n // handle response\n }\n}" } ] } }, "/v1/customer-portal/customer-session/introspect": { "get": { "tags": [ "customer_portal", "customer-session", "public" ], "summary": "Introspect Customer Session", "description": "Introspect the current session and return its information.\n\n**Scopes**: `customer_portal:read` `customer_portal:write`", "operationId": "customer_portal:customer-session:introspect", "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CustomerCustomerSession" } } } } }, "security": [ { "customer_session": [ "customer_portal:read", "customer_portal:write" ] }, { "member_session": [ "customer_portal:read", "customer_portal:write" ] } ], "x-polar-allowed-subjects": [ "Customer", "Member" ], "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "customer_portal.customer-session", "x-speakeasy-name-override": "introspect", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"os\"\n\t\"github.com/polarsource/polar-go/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New()\n\n res, err := s.CustomerPortal.CustomerSession.Introspect(ctx, operations.CustomerPortalCustomerSessionIntrospectSecurity{\n CustomerSession: polargo.Pointer(os.Getenv(\"POLAR_CUSTOMER_SESSION\")),\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.CustomerCustomerSession != nil {\n // handle response\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "import polar_sdk\nfrom polar_sdk import Polar\n\n\nwith Polar() as polar:\n\n res = polar.customer_portal.customer_session.introspect(security=polar_sdk.CustomerPortalCustomerSessionIntrospectSecurity(\n customer_session=\"\",\n ))\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar();\n\nasync function run() {\n const result = await polar.customerPortal.customerSession.introspect({\n customerSession: process.env[\"POLAR_CUSTOMER_SESSION\"] ?? \"\",\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Operations;\n\n$sdk = Polar\\Polar::builder()->build();\n\n\n$requestSecurity = new Operations\\CustomerPortalCustomerSessionIntrospectSecurity(\n customerSession: '',\n);\n\n$response = $sdk->customerPortal->customerSession->introspect(\n security: $requestSecurity\n);\n\nif ($response->customerCustomerSession !== null) {\n // handle response\n}" } ] } }, "/v1/customer-portal/customer-session/user": { "get": { "tags": [ "customer_portal", "customer-session", "public" ], "summary": "Get Authenticated Portal User", "description": "Get information about the currently authenticated portal user.\n\n**Scopes**: `customer_portal:read` `customer_portal:write`", "operationId": "customer_portal:customer-session:get_authenticated_user", "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PortalAuthenticatedUser" } } } } }, "security": [ { "customer_session": [ "customer_portal:read", "customer_portal:write" ] }, { "member_session": [ "customer_portal:read", "customer_portal:write" ] } ], "x-polar-allowed-subjects": [ "Customer", "Member" ], "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "customer_portal.customer-session", "x-speakeasy-name-override": "get_authenticated_user", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"os\"\n\t\"github.com/polarsource/polar-go/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New()\n\n res, err := s.CustomerPortal.CustomerSession.GetAuthenticatedUser(ctx, operations.CustomerPortalCustomerSessionGetAuthenticatedUserSecurity{\n CustomerSession: polargo.Pointer(os.Getenv(\"POLAR_CUSTOMER_SESSION\")),\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.PortalAuthenticatedUser != nil {\n // handle response\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "import polar_sdk\nfrom polar_sdk import Polar\n\n\nwith Polar() as polar:\n\n res = polar.customer_portal.customer_session.get_authenticated_user(security=polar_sdk.CustomerPortalCustomerSessionGetAuthenticatedUserSecurity(\n customer_session=\"\",\n ))\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar();\n\nasync function run() {\n const result = await polar.customerPortal.customerSession.getAuthenticatedUser({\n customerSession: process.env[\"POLAR_CUSTOMER_SESSION\"] ?? \"\",\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Operations;\n\n$sdk = Polar\\Polar::builder()->build();\n\n\n$requestSecurity = new Operations\\CustomerPortalCustomerSessionGetAuthenticatedUserSecurity(\n customerSession: '',\n);\n\n$response = $sdk->customerPortal->customerSession->getAuthenticatedUser(\n security: $requestSecurity\n);\n\nif ($response->portalAuthenticatedUser !== null) {\n // handle response\n}" } ] } }, "/v1/customer-portal/downloadables/": { "get": { "tags": [ "customer_portal", "downloadables", "public" ], "summary": "List Downloadables", "description": "**Scopes**: `customer_portal:read` `customer_portal:write`", "operationId": "customer_portal:downloadables:list", "security": [ { "customer_session": [ "customer_portal:read", "customer_portal:write" ] }, { "member_session": [ "customer_portal:read", "customer_portal:write" ] } ], "parameters": [ { "name": "benefit_id", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string", "format": "uuid4", "description": "The benefit ID.", "x-polar-selector-widget": { "resourceRoot": "/v1/benefits", "resourceName": "Benefit", "displayProperty": "description" } }, { "type": "array", "items": { "type": "string", "format": "uuid4", "description": "The benefit ID.", "x-polar-selector-widget": { "resourceRoot": "/v1/benefits", "resourceName": "Benefit", "displayProperty": "description" } } }, { "type": "null" } ], "title": "BenefitID Filter", "description": "Filter by benefit ID." }, "description": "Filter by benefit ID." }, { "name": "page", "in": "query", "required": false, "schema": { "type": "integer", "exclusiveMinimum": 0, "description": "Page number, defaults to 1.", "default": 1, "title": "Page" }, "description": "Page number, defaults to 1." }, { "name": "limit", "in": "query", "required": false, "schema": { "type": "integer", "exclusiveMinimum": 0, "description": "Size of a page, defaults to 10. Maximum is 100.", "default": 10, "title": "Limit" }, "description": "Size of a page, defaults to 10. Maximum is 100." } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ListResource_DownloadableRead_" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Customer", "Member" ], "x-speakeasy-pagination": { "type": "offsetLimit", "inputs": [ { "name": "page", "in": "parameters", "type": "page" }, { "name": "limit", "in": "parameters", "type": "limit" } ], "outputs": { "results": "$.items", "numPages": "$.pagination.max_page" } }, "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "customer_portal.downloadables", "x-speakeasy-name-override": "list", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"os\"\n\t\"github.com/polarsource/polar-go/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New()\n\n res, err := s.CustomerPortal.Downloadables.List(ctx, operations.CustomerPortalDownloadablesListSecurity{\n CustomerSession: polargo.Pointer(os.Getenv(\"POLAR_CUSTOMER_SESSION\")),\n }, nil, polargo.Pointer[int64](1), polargo.Pointer[int64](10))\n if err != nil {\n log.Fatal(err)\n }\n if res.ListResourceDownloadableRead != nil {\n for {\n // handle items\n\n res, err = res.Next()\n\n if err != nil {\n // handle error\n }\n\n if res == nil {\n break\n }\n }\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "import polar_sdk\nfrom polar_sdk import Polar\n\n\nwith Polar() as polar:\n\n res = polar.customer_portal.downloadables.list(security=polar_sdk.CustomerPortalDownloadablesListSecurity(\n customer_session=\"\",\n ), page=1, limit=10)\n\n while res is not None:\n # Handle items\n\n res = res.next()" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar();\n\nasync function run() {\n const result = await polar.customerPortal.downloadables.list({\n customerSession: process.env[\"POLAR_CUSTOMER_SESSION\"] ?? \"\",\n }, {});\n\n for await (const page of result) {\n console.log(page);\n }\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Operations;\n\n$sdk = Polar\\Polar::builder()->build();\n\n\n$requestSecurity = new Operations\\CustomerPortalDownloadablesListSecurity(\n customerSession: '',\n);\n\n$responses = $sdk->customerPortal->downloadables->list(\n security: $requestSecurity,\n page: 1,\n limit: 10\n\n);\n\n\nforeach ($responses as $response) {\n if ($response->statusCode === 200) {\n // handle response\n }\n}" } ] } }, "/v1/customer-portal/license-keys/": { "get": { "tags": [ "customer_portal", "license_keys", "public" ], "summary": "List License Keys", "description": "**Scopes**: `customer_portal:read` `customer_portal:write`", "operationId": "customer_portal:license_keys:list", "security": [ { "customer_session": [ "customer_portal:read", "customer_portal:write" ] }, { "member_session": [ "customer_portal:read", "customer_portal:write" ] } ], "parameters": [ { "name": "benefit_id", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string", "format": "uuid4", "description": "The benefit ID.", "x-polar-selector-widget": { "resourceRoot": "/v1/benefits", "resourceName": "Benefit", "displayProperty": "description" } }, { "type": "null" } ], "description": "Filter by a specific benefit", "title": "Benefit Id" }, "description": "Filter by a specific benefit" }, { "name": "page", "in": "query", "required": false, "schema": { "type": "integer", "exclusiveMinimum": 0, "description": "Page number, defaults to 1.", "default": 1, "title": "Page" }, "description": "Page number, defaults to 1." }, { "name": "limit", "in": "query", "required": false, "schema": { "type": "integer", "exclusiveMinimum": 0, "description": "Size of a page, defaults to 10. Maximum is 100.", "default": 10, "title": "Limit" }, "description": "Size of a page, defaults to 10. Maximum is 100." } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ListResource_LicenseKeyRead_" } } } }, "401": { "description": "Not authorized to manage license key.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Unauthorized" } } } }, "404": { "description": "License key not found.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ResourceNotFound" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Customer", "Member" ], "x-speakeasy-pagination": { "type": "offsetLimit", "inputs": [ { "name": "page", "in": "parameters", "type": "page" }, { "name": "limit", "in": "parameters", "type": "limit" } ], "outputs": { "results": "$.items", "numPages": "$.pagination.max_page" } }, "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "customer_portal.license_keys", "x-speakeasy-name-override": "list", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"os\"\n\t\"github.com/polarsource/polar-go/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New()\n\n res, err := s.CustomerPortal.LicenseKeys.List(ctx, operations.CustomerPortalLicenseKeysListSecurity{\n CustomerSession: polargo.Pointer(os.Getenv(\"POLAR_CUSTOMER_SESSION\")),\n }, nil, polargo.Pointer[int64](1), polargo.Pointer[int64](10))\n if err != nil {\n log.Fatal(err)\n }\n if res.ListResourceLicenseKeyRead != nil {\n for {\n // handle items\n\n res, err = res.Next()\n\n if err != nil {\n // handle error\n }\n\n if res == nil {\n break\n }\n }\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "import polar_sdk\nfrom polar_sdk import Polar\n\n\nwith Polar() as polar:\n\n res = polar.customer_portal.license_keys.list(security=polar_sdk.CustomerPortalLicenseKeysListSecurity(\n customer_session=\"\",\n ), page=1, limit=10)\n\n while res is not None:\n # Handle items\n\n res = res.next()" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar();\n\nasync function run() {\n const result = await polar.customerPortal.licenseKeys.list({\n customerSession: process.env[\"POLAR_CUSTOMER_SESSION\"] ?? \"\",\n }, {});\n\n for await (const page of result) {\n console.log(page);\n }\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Operations;\n\n$sdk = Polar\\Polar::builder()->build();\n\n\n$requestSecurity = new Operations\\CustomerPortalLicenseKeysListSecurity(\n customerSession: '',\n);\n\n$responses = $sdk->customerPortal->licenseKeys->list(\n security: $requestSecurity,\n page: 1,\n limit: 10\n\n);\n\n\nforeach ($responses as $response) {\n if ($response->statusCode === 200) {\n // handle response\n }\n}" } ] } }, "/v1/customer-portal/license-keys/{id}": { "get": { "tags": [ "customer_portal", "license_keys", "public" ], "summary": "Get License Key", "description": "Get a license key.\n\n**Scopes**: `customer_portal:read` `customer_portal:write`", "operationId": "customer_portal:license_keys:get", "security": [ { "customer_session": [ "customer_portal:read", "customer_portal:write" ] }, { "member_session": [ "customer_portal:read", "customer_portal:write" ] } ], "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid4", "title": "Id" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/LicenseKeyWithActivations" } } } }, "404": { "description": "License key not found.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ResourceNotFound" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Customer", "Member" ], "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "customer_portal.license_keys", "x-speakeasy-name-override": "get", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"os\"\n\t\"github.com/polarsource/polar-go/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New()\n\n res, err := s.CustomerPortal.LicenseKeys.Get(ctx, operations.CustomerPortalLicenseKeysGetSecurity{\n CustomerSession: polargo.Pointer(os.Getenv(\"POLAR_CUSTOMER_SESSION\")),\n }, \"\")\n if err != nil {\n log.Fatal(err)\n }\n if res.LicenseKeyWithActivations != nil {\n // handle response\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "import polar_sdk\nfrom polar_sdk import Polar\n\n\nwith Polar() as polar:\n\n res = polar.customer_portal.license_keys.get(security=polar_sdk.CustomerPortalLicenseKeysGetSecurity(\n customer_session=\"\",\n ), id=\"\")\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar();\n\nasync function run() {\n const result = await polar.customerPortal.licenseKeys.get({\n customerSession: process.env[\"POLAR_CUSTOMER_SESSION\"] ?? \"\",\n }, {\n id: \"\",\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Operations;\n\n$sdk = Polar\\Polar::builder()->build();\n\n\n$requestSecurity = new Operations\\CustomerPortalLicenseKeysGetSecurity(\n customerSession: '',\n);\n\n$response = $sdk->customerPortal->licenseKeys->get(\n security: $requestSecurity,\n id: ''\n\n);\n\nif ($response->licenseKeyWithActivations !== null) {\n // handle response\n}" } ] } }, "/v1/customer-portal/license-keys/validate": { "post": { "tags": [ "customer_portal", "license_keys", "public" ], "summary": "Validate License Key", "description": "Validate a license key.\n\n> This endpoint doesn't require authentication and can be safely used on a public\n> client, like a desktop application or a mobile app.\n> If you plan to validate a license key on a server, use the `/v1/license-keys/validate`\n> endpoint instead.", "operationId": "customer_portal:license_keys:validate", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/LicenseKeyValidate" } } }, "required": true }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ValidatedLicenseKey" } } } }, "404": { "description": "License key not found.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ResourceNotFound" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "customer_portal.license_keys", "x-speakeasy-name-override": "validate", "security": [ {} ], "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New()\n\n res, err := s.CustomerPortal.LicenseKeys.Validate(ctx, components.LicenseKeyValidate{\n Key: \"\",\n OrganizationID: \"\",\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.ValidatedLicenseKey != nil {\n // handle response\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar() as polar:\n\n res = polar.customer_portal.license_keys.validate(request={\n \"key\": \"\",\n \"organization_id\": \"\",\n })\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar();\n\nasync function run() {\n const result = await polar.customerPortal.licenseKeys.validate({\n key: \"\",\n organizationId: \"\",\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Components;\n\n$sdk = Polar\\Polar::builder()->build();\n\n$request = new Components\\LicenseKeyValidate(\n key: '',\n organizationId: '',\n);\n\n$response = $sdk->customerPortal->licenseKeys->validate(\n request: $request\n);\n\nif ($response->validatedLicenseKey !== null) {\n // handle response\n}" } ] } }, "/v1/customer-portal/license-keys/activate": { "post": { "tags": [ "customer_portal", "license_keys", "public" ], "summary": "Activate License Key", "description": "Activate a license key instance.\n\n> This endpoint doesn't require authentication and can be safely used on a public\n> client, like a desktop application or a mobile app.\n> If you plan to validate a license key on a server, use the `/v1/license-keys/activate`\n> endpoint instead.", "operationId": "customer_portal:license_keys:activate", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/LicenseKeyActivate" } } }, "required": true }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/LicenseKeyActivationRead" } } } }, "403": { "description": "License key activation not supported or limit reached. Use /validate endpoint for licenses without activations.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/NotPermitted" } } } }, "404": { "description": "License key not found.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ResourceNotFound" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "customer_portal.license_keys", "x-speakeasy-name-override": "activate", "security": [ {} ], "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New()\n\n res, err := s.CustomerPortal.LicenseKeys.Activate(ctx, components.LicenseKeyActivate{\n Key: \"\",\n OrganizationID: \"\",\n Label: \"\",\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.LicenseKeyActivationRead != nil {\n // handle response\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar() as polar:\n\n res = polar.customer_portal.license_keys.activate(request={\n \"key\": \"\",\n \"organization_id\": \"\",\n \"label\": \"\",\n })\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar();\n\nasync function run() {\n const result = await polar.customerPortal.licenseKeys.activate({\n key: \"\",\n organizationId: \"\",\n label: \"\",\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Components;\n\n$sdk = Polar\\Polar::builder()->build();\n\n$request = new Components\\LicenseKeyActivate(\n key: '',\n organizationId: '',\n label: '',\n);\n\n$response = $sdk->customerPortal->licenseKeys->activate(\n request: $request\n);\n\nif ($response->licenseKeyActivationRead !== null) {\n // handle response\n}" } ] } }, "/v1/customer-portal/license-keys/deactivate": { "post": { "tags": [ "customer_portal", "license_keys", "public" ], "summary": "Deactivate License Key", "description": "Deactivate a license key instance.\n\n> This endpoint doesn't require authentication and can be safely used on a public\n> client, like a desktop application or a mobile app.\n> If you plan to validate a license key on a server, use the `/v1/license-keys/deactivate`\n> endpoint instead.", "operationId": "customer_portal:license_keys:deactivate", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/LicenseKeyDeactivate" } } }, "required": true }, "responses": { "204": { "description": "License key activation deactivated." }, "404": { "description": "License key not found.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ResourceNotFound" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "customer_portal.license_keys", "x-speakeasy-name-override": "deactivate", "security": [ {} ], "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New()\n\n res, err := s.CustomerPortal.LicenseKeys.Deactivate(ctx, components.LicenseKeyDeactivate{\n Key: \"\",\n OrganizationID: \"\",\n ActivationID: \"\",\n })\n if err != nil {\n log.Fatal(err)\n }\n if res != nil {\n // handle response\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar() as polar:\n\n polar.customer_portal.license_keys.deactivate(request={\n \"key\": \"\",\n \"organization_id\": \"\",\n \"activation_id\": \"\",\n })\n\n # Use the SDK ..." }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar();\n\nasync function run() {\n await polar.customerPortal.licenseKeys.deactivate({\n key: \"\",\n organizationId: \"\",\n activationId: \"\",\n });\n\n\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Components;\n\n$sdk = Polar\\Polar::builder()->build();\n\n$request = new Components\\LicenseKeyDeactivate(\n key: '',\n organizationId: '',\n activationId: '',\n);\n\n$response = $sdk->customerPortal->licenseKeys->deactivate(\n request: $request\n);\n\nif ($response->statusCode === 200) {\n // handle response\n}" } ] } }, "/v1/customer-portal/members": { "get": { "tags": [ "customer_portal", "members", "public" ], "summary": "List Members", "description": "List all members of the customer's team.\n\nOnly available to owners and billing managers of team customers.", "operationId": "customer_portal:members:list_members", "parameters": [ { "name": "page", "in": "query", "required": false, "schema": { "type": "integer", "exclusiveMinimum": 0, "description": "Page number, defaults to 1.", "default": 1, "title": "Page" }, "description": "Page number, defaults to 1." }, { "name": "limit", "in": "query", "required": false, "schema": { "type": "integer", "exclusiveMinimum": 0, "description": "Size of a page, defaults to 10. Maximum is 100.", "default": 10, "title": "Limit" }, "description": "Size of a page, defaults to 10. Maximum is 100." } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ListResource_CustomerPortalMember_" } } } }, "401": { "description": "Authentication required" }, "403": { "description": "Not permitted - requires owner or billing manager role" }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-speakeasy-pagination": { "type": "offsetLimit", "inputs": [ { "name": "page", "in": "parameters", "type": "page" }, { "name": "limit", "in": "parameters", "type": "limit" } ], "outputs": { "results": "$.items", "numPages": "$.pagination.max_page" } }, "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "customer_portal.members", "x-speakeasy-name-override": "list_members", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.CustomerPortal.Members.ListMembers(ctx, polargo.Pointer[int64](1), polargo.Pointer[int64](10))\n if err != nil {\n log.Fatal(err)\n }\n if res.ListResourceCustomerPortalMember != nil {\n for {\n // handle items\n\n res, err = res.Next()\n\n if err != nil {\n // handle error\n }\n\n if res == nil {\n break\n }\n }\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.customer_portal.members.list_members(page=1, limit=10)\n\n while res is not None:\n # Handle items\n\n res = res.next()" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.customerPortal.members.listMembers({});\n\n for await (const page of result) {\n console.log(page);\n }\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n\n\n$responses = $sdk->customerPortal->members->listMembers(\n page: 1,\n limit: 10\n\n);\n\n\nforeach ($responses as $response) {\n if ($response->statusCode === 200) {\n // handle response\n }\n}" } ] }, "post": { "tags": [ "customer_portal", "members", "public" ], "summary": "Add Member", "description": "Add a new member to the customer's team.\n\nOnly available to owners and billing managers of team customers.\n\nRules:\n- Cannot add a member with the owner role (there must be exactly one owner)\n- If a member with this email already exists, the existing member is returned", "operationId": "customer_portal:members:add_member", "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CustomerPortalMemberCreate" } } } }, "responses": { "201": { "description": "Member added.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CustomerPortalMember" } } } }, "400": { "description": "Invalid request or member already exists." }, "401": { "description": "Authentication required" }, "403": { "description": "Not permitted - requires owner or billing manager role" }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "customer_portal.members", "x-speakeasy-name-override": "add_member", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.CustomerPortal.Members.AddMember(ctx, components.CustomerPortalMemberCreate{\n Email: \"Domenica.Schamberger@yahoo.com\",\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.CustomerPortalMember != nil {\n // handle response\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.customer_portal.members.add_member(request={\n \"email\": \"Domenica.Schamberger@yahoo.com\",\n })\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.customerPortal.members.addMember({\n email: \"Domenica.Schamberger@yahoo.com\",\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Components;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n$request = new Components\\CustomerPortalMemberCreate(\n email: 'Domenica.Schamberger@yahoo.com',\n);\n\n$response = $sdk->customerPortal->members->addMember(\n request: $request\n);\n\nif ($response->customerPortalMember !== null) {\n // handle response\n}" } ] } }, "/v1/customer-portal/members/{id}": { "patch": { "tags": [ "customer_portal", "members", "public" ], "summary": "Update Member", "description": "Update a member's role.\n\nOnly available to owners and billing managers of team customers.\n\nRules:\n- Cannot modify your own role (to prevent self-demotion)\n- Customer must have exactly one owner at all times", "operationId": "customer_portal:members:update_member", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid", "title": "Id" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CustomerPortalMemberUpdate" } } } }, "responses": { "200": { "description": "Member updated.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CustomerPortalMember" } } } }, "400": { "description": "Invalid role change." }, "401": { "description": "Authentication required" }, "403": { "description": "Not permitted - requires owner or billing manager role" }, "404": { "description": "Member not found." }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "customer_portal.members", "x-speakeasy-name-override": "update_member", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.CustomerPortal.Members.UpdateMember(ctx, \"8319ae11-ed5f-4642-81e4-4b40731df195\", components.CustomerPortalMemberUpdate{})\n if err != nil {\n log.Fatal(err)\n }\n if res.CustomerPortalMember != nil {\n // handle response\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.customer_portal.members.update_member(id=\"8319ae11-ed5f-4642-81e4-4b40731df195\", customer_portal_member_update={})\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.customerPortal.members.updateMember({\n id: \"8319ae11-ed5f-4642-81e4-4b40731df195\",\n customerPortalMemberUpdate: {},\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Components;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n$customerPortalMemberUpdate = new Components\\CustomerPortalMemberUpdate();\n\n$response = $sdk->customerPortal->members->updateMember(\n id: '8319ae11-ed5f-4642-81e4-4b40731df195',\n customerPortalMemberUpdate: $customerPortalMemberUpdate\n\n);\n\nif ($response->customerPortalMember !== null) {\n // handle response\n}" } ] }, "delete": { "tags": [ "customer_portal", "members", "public" ], "summary": "Remove Member", "description": "Remove a member from the team.\n\nOnly available to owners and billing managers of team customers.\n\nRules:\n- Cannot remove yourself\n- Cannot remove the only owner", "operationId": "customer_portal:members:remove_member", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid", "title": "Id" } } ], "responses": { "204": { "description": "Member removed." }, "400": { "description": "Cannot remove the only owner." }, "401": { "description": "Authentication required" }, "403": { "description": "Not permitted - requires owner or billing manager role" }, "404": { "description": "Member not found." }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "customer_portal.members", "x-speakeasy-name-override": "remove_member", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.CustomerPortal.Members.RemoveMember(ctx, \"b61c5e87-cda5-4b14-93ee-71a695f42d9d\")\n if err != nil {\n log.Fatal(err)\n }\n if res != nil {\n // handle response\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n polar.customer_portal.members.remove_member(id=\"b61c5e87-cda5-4b14-93ee-71a695f42d9d\")\n\n # Use the SDK ..." }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n await polar.customerPortal.members.removeMember({\n id: \"b61c5e87-cda5-4b14-93ee-71a695f42d9d\",\n });\n\n\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n\n\n$response = $sdk->customerPortal->members->removeMember(\n id: 'b61c5e87-cda5-4b14-93ee-71a695f42d9d'\n);\n\nif ($response->statusCode === 200) {\n // handle response\n}" } ] } }, "/v1/customer-portal/orders/": { "get": { "tags": [ "customer_portal", "orders", "public" ], "summary": "List Orders", "description": "List orders of the authenticated customer.", "operationId": "customer_portal:orders:list", "security": [ { "customer_session": [ "customer_portal:read", "customer_portal:write" ] }, { "member_session": [ "customer_portal:read", "customer_portal:write" ] } ], "parameters": [ { "name": "product_id", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string", "format": "uuid4", "description": "The product ID.", "x-polar-selector-widget": { "resourceRoot": "/v1/products", "resourceName": "Product", "displayProperty": "name" } }, { "type": "array", "items": { "type": "string", "format": "uuid4", "description": "The product ID.", "x-polar-selector-widget": { "resourceRoot": "/v1/products", "resourceName": "Product", "displayProperty": "name" } } }, { "type": "null" } ], "title": "ProductID Filter", "description": "Filter by product ID." }, "description": "Filter by product ID." }, { "name": "product_billing_type", "in": "query", "required": false, "schema": { "anyOf": [ { "$ref": "#/components/schemas/ProductBillingType" }, { "type": "array", "items": { "$ref": "#/components/schemas/ProductBillingType" } }, { "type": "null" } ], "title": "ProductBillingType Filter", "description": "Filter by product billing type. `recurring` will filter data corresponding to subscriptions creations or renewals. `one_time` will filter data corresponding to one-time purchases." }, "description": "Filter by product billing type. `recurring` will filter data corresponding to subscriptions creations or renewals. `one_time` will filter data corresponding to one-time purchases." }, { "name": "subscription_id", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string", "format": "uuid4", "description": "The subscription ID." }, { "type": "array", "items": { "type": "string", "format": "uuid4", "description": "The subscription ID." } }, { "type": "null" } ], "title": "SubscriptionID Filter", "description": "Filter by subscription ID." }, "description": "Filter by subscription ID." }, { "name": "query", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "description": "Search by product or organization name.", "title": "Query" }, "description": "Search by product or organization name." }, { "name": "page", "in": "query", "required": false, "schema": { "type": "integer", "exclusiveMinimum": 0, "description": "Page number, defaults to 1.", "default": 1, "title": "Page" }, "description": "Page number, defaults to 1." }, { "name": "limit", "in": "query", "required": false, "schema": { "type": "integer", "exclusiveMinimum": 0, "description": "Size of a page, defaults to 10. Maximum is 100.", "default": 10, "title": "Limit" }, "description": "Size of a page, defaults to 10. Maximum is 100." }, { "name": "sorting", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "array", "items": { "$ref": "#/components/schemas/CustomerOrderSortProperty" } }, { "type": "null" } ], "description": "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.", "default": [ "-created_at" ], "title": "Sorting" }, "description": "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." } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ListResource_CustomerOrder_" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-speakeasy-pagination": { "type": "offsetLimit", "inputs": [ { "name": "page", "in": "parameters", "type": "page" }, { "name": "limit", "in": "parameters", "type": "limit" } ], "outputs": { "results": "$.items", "numPages": "$.pagination.max_page" } }, "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "customer_portal.orders", "x-speakeasy-name-override": "list", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/operations\"\n\t\"os\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New()\n\n res, err := s.CustomerPortal.Orders.List(ctx, operations.CustomerPortalOrdersListRequest{}, operations.CustomerPortalOrdersListSecurity{\n CustomerSession: polargo.Pointer(os.Getenv(\"POLAR_CUSTOMER_SESSION\")),\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.ListResourceCustomerOrder != nil {\n for {\n // handle items\n\n res, err = res.Next()\n\n if err != nil {\n // handle error\n }\n\n if res == nil {\n break\n }\n }\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "import polar_sdk\nfrom polar_sdk import Polar\n\n\nwith Polar() as polar:\n\n res = polar.customer_portal.orders.list(security=polar_sdk.CustomerPortalOrdersListSecurity(\n customer_session=\"\",\n ), page=1, limit=10)\n\n while res is not None:\n # Handle items\n\n res = res.next()" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar();\n\nasync function run() {\n const result = await polar.customerPortal.orders.list({\n customerSession: process.env[\"POLAR_CUSTOMER_SESSION\"] ?? \"\",\n }, {});\n\n for await (const page of result) {\n console.log(page);\n }\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Operations;\n\n$sdk = Polar\\Polar::builder()->build();\n\n$request = new Operations\\CustomerPortalOrdersListRequest();\n$requestSecurity = new Operations\\CustomerPortalOrdersListSecurity(\n customerSession: '',\n);\n\n$responses = $sdk->customerPortal->orders->list(\n request: $request,\n security: $requestSecurity\n);\n\n\nforeach ($responses as $response) {\n if ($response->statusCode === 200) {\n // handle response\n }\n}" } ] } }, "/v1/customer-portal/orders/{id}": { "get": { "tags": [ "customer_portal", "orders", "public" ], "summary": "Get Order", "description": "Get an order by ID for the authenticated customer.", "operationId": "customer_portal:orders:get", "security": [ { "customer_session": [ "customer_portal:read", "customer_portal:write" ] }, { "member_session": [ "customer_portal:read", "customer_portal:write" ] } ], "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid4", "description": "The order ID.", "title": "Id" }, "description": "The order ID." } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CustomerOrder" } } } }, "404": { "description": "Order not found.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ResourceNotFound" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "customer_portal.orders", "x-speakeasy-name-override": "get", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"os\"\n\t\"github.com/polarsource/polar-go/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New()\n\n res, err := s.CustomerPortal.Orders.Get(ctx, operations.CustomerPortalOrdersGetSecurity{\n CustomerSession: polargo.Pointer(os.Getenv(\"POLAR_CUSTOMER_SESSION\")),\n }, \"\")\n if err != nil {\n log.Fatal(err)\n }\n if res.CustomerOrder != nil {\n // handle response\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "import polar_sdk\nfrom polar_sdk import Polar\n\n\nwith Polar() as polar:\n\n res = polar.customer_portal.orders.get(security=polar_sdk.CustomerPortalOrdersGetSecurity(\n customer_session=\"\",\n ), id=\"\")\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar();\n\nasync function run() {\n const result = await polar.customerPortal.orders.get({\n customerSession: process.env[\"POLAR_CUSTOMER_SESSION\"] ?? \"\",\n }, {\n id: \"\",\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Operations;\n\n$sdk = Polar\\Polar::builder()->build();\n\n\n$requestSecurity = new Operations\\CustomerPortalOrdersGetSecurity(\n customerSession: '',\n);\n\n$response = $sdk->customerPortal->orders->get(\n security: $requestSecurity,\n id: ''\n\n);\n\nif ($response->customerOrder !== null) {\n // handle response\n}" } ] }, "patch": { "tags": [ "customer_portal", "orders", "public" ], "summary": "Update Order", "description": "Update an order for the authenticated customer.", "operationId": "customer_portal:orders:update", "security": [ { "customer_session": [ "customer_portal:write" ] }, { "member_session": [ "customer_portal:write" ] } ], "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid4", "description": "The order ID.", "title": "Id" }, "description": "The order ID." } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CustomerOrderUpdate" } } } }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CustomerOrder" } } } }, "404": { "description": "Order not found.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ResourceNotFound" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "customer_portal.orders", "x-speakeasy-name-override": "update", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"os\"\n\t\"github.com/polarsource/polar-go/models/operations\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New()\n\n res, err := s.CustomerPortal.Orders.Update(ctx, operations.CustomerPortalOrdersUpdateSecurity{\n CustomerSession: polargo.Pointer(os.Getenv(\"POLAR_CUSTOMER_SESSION\")),\n }, \"\", components.CustomerOrderUpdate{\n BillingAddress: &components.AddressInput{\n Country: components.CountryAlpha2InputUs,\n },\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.CustomerOrder != nil {\n // handle response\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "import polar_sdk\nfrom polar_sdk import Polar\n\n\nwith Polar() as polar:\n\n res = polar.customer_portal.orders.update(security=polar_sdk.CustomerPortalOrdersUpdateSecurity(\n customer_session=\"\",\n ), id=\"\", customer_order_update={\n \"billing_address\": {\n \"country\": polar_sdk.CountryAlpha2Input.US,\n },\n })\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar();\n\nasync function run() {\n const result = await polar.customerPortal.orders.update({\n customerSession: process.env[\"POLAR_CUSTOMER_SESSION\"] ?? \"\",\n }, {\n id: \"\",\n customerOrderUpdate: {\n billingAddress: {\n country: \"US\",\n },\n },\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Components;\nuse Polar\\Models\\Operations;\n\n$sdk = Polar\\Polar::builder()->build();\n\n$customerOrderUpdate = new Components\\CustomerOrderUpdate(\n billingAddress: new Components\\AddressInput(\n country: Components\\CountryAlpha2Input::Us,\n ),\n);\n$requestSecurity = new Operations\\CustomerPortalOrdersUpdateSecurity(\n customerSession: '',\n);\n\n$response = $sdk->customerPortal->orders->update(\n security: $requestSecurity,\n id: '',\n customerOrderUpdate: $customerOrderUpdate\n\n);\n\nif ($response->customerOrder !== null) {\n // handle response\n}" } ] } }, "/v1/customer-portal/orders/{id}/invoice": { "post": { "tags": [ "customer_portal", "orders", "public" ], "summary": "Generate Order Invoice", "description": "Trigger generation of an order's invoice.", "operationId": "customer_portal:orders:generate_invoice", "security": [ { "customer_session": [ "customer_portal:read", "customer_portal:write" ] }, { "member_session": [ "customer_portal:read", "customer_portal:write" ] } ], "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid4", "description": "The order ID.", "title": "Id" }, "description": "The order ID." } ], "responses": { "202": { "description": "Successful Response", "content": { "application/json": { "schema": {} } } }, "422": { "description": "Order is not paid or is missing billing name or address.", "content": { "application/json": { "schema": { "anyOf": [ { "$ref": "#/components/schemas/MissingInvoiceBillingDetails" }, { "$ref": "#/components/schemas/NotPaidOrder" } ], "title": "Response 422 Customer Portal:Orders:Generate Invoice" } } } } }, "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "customer_portal.orders", "x-speakeasy-name-override": "generate_invoice", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"os\"\n\t\"github.com/polarsource/polar-go/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New()\n\n res, err := s.CustomerPortal.Orders.GenerateInvoice(ctx, operations.CustomerPortalOrdersGenerateInvoiceSecurity{\n CustomerSession: polargo.Pointer(os.Getenv(\"POLAR_CUSTOMER_SESSION\")),\n }, \"\")\n if err != nil {\n log.Fatal(err)\n }\n if res.Any != nil {\n // handle response\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "import polar_sdk\nfrom polar_sdk import Polar\n\n\nwith Polar() as polar:\n\n res = polar.customer_portal.orders.generate_invoice(security=polar_sdk.CustomerPortalOrdersGenerateInvoiceSecurity(\n customer_session=\"\",\n ), id=\"\")\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar();\n\nasync function run() {\n const result = await polar.customerPortal.orders.generateInvoice({\n customerSession: process.env[\"POLAR_CUSTOMER_SESSION\"] ?? \"\",\n }, {\n id: \"\",\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Operations;\n\n$sdk = Polar\\Polar::builder()->build();\n\n\n$requestSecurity = new Operations\\CustomerPortalOrdersGenerateInvoiceSecurity(\n customerSession: '',\n);\n\n$response = $sdk->customerPortal->orders->generateInvoice(\n security: $requestSecurity,\n id: ''\n\n);\n\nif ($response->any !== null) {\n // handle response\n}" } ] }, "get": { "tags": [ "customer_portal", "orders", "public" ], "summary": "Get Order Invoice", "description": "Get an order's invoice data.", "operationId": "customer_portal:orders:invoice", "security": [ { "customer_session": [ "customer_portal:read", "customer_portal:write" ] }, { "member_session": [ "customer_portal:read", "customer_portal:write" ] } ], "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid4", "description": "The order ID.", "title": "Id" }, "description": "The order ID." } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CustomerOrderInvoice" } } } }, "404": { "description": "Order not found.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ResourceNotFound" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "customer_portal.orders", "x-speakeasy-name-override": "invoice", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"os\"\n\t\"github.com/polarsource/polar-go/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New()\n\n res, err := s.CustomerPortal.Orders.Invoice(ctx, operations.CustomerPortalOrdersInvoiceSecurity{\n CustomerSession: polargo.Pointer(os.Getenv(\"POLAR_CUSTOMER_SESSION\")),\n }, \"\")\n if err != nil {\n log.Fatal(err)\n }\n if res.CustomerOrderInvoice != nil {\n // handle response\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "import polar_sdk\nfrom polar_sdk import Polar\n\n\nwith Polar() as polar:\n\n res = polar.customer_portal.orders.invoice(security=polar_sdk.CustomerPortalOrdersInvoiceSecurity(\n customer_session=\"\",\n ), id=\"\")\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar();\n\nasync function run() {\n const result = await polar.customerPortal.orders.invoice({\n customerSession: process.env[\"POLAR_CUSTOMER_SESSION\"] ?? \"\",\n }, {\n id: \"\",\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Operations;\n\n$sdk = Polar\\Polar::builder()->build();\n\n\n$requestSecurity = new Operations\\CustomerPortalOrdersInvoiceSecurity(\n customerSession: '',\n);\n\n$response = $sdk->customerPortal->orders->invoice(\n security: $requestSecurity,\n id: ''\n\n);\n\nif ($response->customerOrderInvoice !== null) {\n // handle response\n}" } ] } }, "/v1/customer-portal/orders/{id}/payment-status": { "get": { "tags": [ "customer_portal", "orders", "public" ], "summary": "Get Order Payment Status", "description": "Get the current payment status for an order.", "operationId": "customer_portal:orders:get_payment_status", "security": [ { "customer_session": [ "customer_portal:read", "customer_portal:write" ] }, { "member_session": [ "customer_portal:read", "customer_portal:write" ] } ], "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid4", "description": "The order ID.", "title": "Id" }, "description": "The order ID." } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CustomerOrderPaymentStatus" } } } }, "404": { "description": "Order not found.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ResourceNotFound" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "customer_portal.orders", "x-speakeasy-name-override": "get_payment_status", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"os\"\n\t\"github.com/polarsource/polar-go/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New()\n\n res, err := s.CustomerPortal.Orders.GetPaymentStatus(ctx, operations.CustomerPortalOrdersGetPaymentStatusSecurity{\n CustomerSession: polargo.Pointer(os.Getenv(\"POLAR_CUSTOMER_SESSION\")),\n }, \"\")\n if err != nil {\n log.Fatal(err)\n }\n if res.CustomerOrderPaymentStatus != nil {\n // handle response\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "import polar_sdk\nfrom polar_sdk import Polar\n\n\nwith Polar() as polar:\n\n res = polar.customer_portal.orders.get_payment_status(security=polar_sdk.CustomerPortalOrdersGetPaymentStatusSecurity(\n customer_session=\"\",\n ), id=\"\")\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar();\n\nasync function run() {\n const result = await polar.customerPortal.orders.getPaymentStatus({\n customerSession: process.env[\"POLAR_CUSTOMER_SESSION\"] ?? \"\",\n }, {\n id: \"\",\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Operations;\n\n$sdk = Polar\\Polar::builder()->build();\n\n\n$requestSecurity = new Operations\\CustomerPortalOrdersGetPaymentStatusSecurity(\n customerSession: '',\n);\n\n$response = $sdk->customerPortal->orders->getPaymentStatus(\n security: $requestSecurity,\n id: ''\n\n);\n\nif ($response->customerOrderPaymentStatus !== null) {\n // handle response\n}" } ] } }, "/v1/customer-portal/orders/{id}/confirm-payment": { "post": { "tags": [ "customer_portal", "orders", "public" ], "summary": "Confirm Retry Payment", "description": "Confirm a retry payment using a Stripe confirmation token.", "operationId": "customer_portal:orders:confirm_retry_payment", "security": [ { "customer_session": [ "customer_portal:write" ] }, { "member_session": [ "customer_portal:write" ] } ], "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid4", "description": "The order ID.", "title": "Id" }, "description": "The order ID." } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CustomerOrderConfirmPayment" } } } }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CustomerOrderPaymentConfirmation" } } } }, "404": { "description": "Order not found.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ResourceNotFound" } } } }, "409": { "description": "Payment already in progress.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PaymentAlreadyInProgress" } } } }, "422": { "description": "Order not eligible for retry or payment confirmation failed.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/OrderNotEligibleForRetry" } } } } }, "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "customer_portal.orders", "x-speakeasy-name-override": "confirm_retry_payment", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"os\"\n\t\"github.com/polarsource/polar-go/models/operations\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New()\n\n res, err := s.CustomerPortal.Orders.ConfirmRetryPayment(ctx, operations.CustomerPortalOrdersConfirmRetryPaymentSecurity{\n CustomerSession: polargo.Pointer(os.Getenv(\"POLAR_CUSTOMER_SESSION\")),\n }, \"\", components.CustomerOrderConfirmPayment{})\n if err != nil {\n log.Fatal(err)\n }\n if res.CustomerOrderPaymentConfirmation != nil {\n // handle response\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "import polar_sdk\nfrom polar_sdk import Polar\n\n\nwith Polar() as polar:\n\n res = polar.customer_portal.orders.confirm_retry_payment(security=polar_sdk.CustomerPortalOrdersConfirmRetryPaymentSecurity(\n customer_session=\"\",\n ), id=\"\", customer_order_confirm_payment={})\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar();\n\nasync function run() {\n const result = await polar.customerPortal.orders.confirmRetryPayment({\n customerSession: process.env[\"POLAR_CUSTOMER_SESSION\"] ?? \"\",\n }, {\n id: \"\",\n customerOrderConfirmPayment: {},\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Components;\nuse Polar\\Models\\Operations;\n\n$sdk = Polar\\Polar::builder()->build();\n\n$customerOrderConfirmPayment = new Components\\CustomerOrderConfirmPayment();\n$requestSecurity = new Operations\\CustomerPortalOrdersConfirmRetryPaymentSecurity(\n customerSession: '',\n);\n\n$response = $sdk->customerPortal->orders->confirmRetryPayment(\n security: $requestSecurity,\n id: '',\n customerOrderConfirmPayment: $customerOrderConfirmPayment\n\n);\n\nif ($response->customerOrderPaymentConfirmation !== null) {\n // handle response\n}" } ] } }, "/v1/customer-portal/organizations/{slug}": { "get": { "tags": [ "customer_portal", "organizations", "public" ], "summary": "Get Organization", "description": "Get a customer portal's organization by slug.", "operationId": "customer_portal:organizations:get", "parameters": [ { "name": "slug", "in": "path", "required": true, "schema": { "type": "string", "description": "The organization slug.", "title": "Slug" }, "description": "The organization slug." } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CustomerOrganizationData" } } } }, "404": { "description": "Organization not found.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ResourceNotFound" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "customer_portal.organizations", "x-speakeasy-name-override": "get", "security": [ {} ], "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New()\n\n res, err := s.CustomerPortal.Organizations.Get(ctx, \"\")\n if err != nil {\n log.Fatal(err)\n }\n if res.CustomerOrganizationData != nil {\n // handle response\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar() as polar:\n\n res = polar.customer_portal.organizations.get(slug=\"\")\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar();\n\nasync function run() {\n const result = await polar.customerPortal.organizations.get({\n slug: \"\",\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\n\n$sdk = Polar\\Polar::builder()->build();\n\n\n\n$response = $sdk->customerPortal->organizations->get(\n slug: ''\n);\n\nif ($response->customerOrganizationData !== null) {\n // handle response\n}" } ] } }, "/v1/customer-portal/subscriptions/": { "get": { "tags": [ "customer_portal", "subscriptions", "public" ], "summary": "List Subscriptions", "description": "List subscriptions of the authenticated customer.\n\n**Scopes**: `customer_portal:read` `customer_portal:write`", "operationId": "customer_portal:subscriptions:list", "security": [ { "customer_session": [ "customer_portal:read", "customer_portal:write" ] }, { "member_session": [ "customer_portal:read", "customer_portal:write" ] } ], "parameters": [ { "name": "product_id", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string", "format": "uuid4", "description": "The product ID.", "x-polar-selector-widget": { "resourceRoot": "/v1/products", "resourceName": "Product", "displayProperty": "name" } }, { "type": "array", "items": { "type": "string", "format": "uuid4", "description": "The product ID.", "x-polar-selector-widget": { "resourceRoot": "/v1/products", "resourceName": "Product", "displayProperty": "name" } } }, { "type": "null" } ], "title": "ProductID Filter", "description": "Filter by product ID." }, "description": "Filter by product ID." }, { "name": "active", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "description": "Filter by active or cancelled subscription.", "title": "Active" }, "description": "Filter by active or cancelled subscription." }, { "name": "query", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "description": "Search by product or organization name.", "title": "Query" }, "description": "Search by product or organization name." }, { "name": "page", "in": "query", "required": false, "schema": { "type": "integer", "exclusiveMinimum": 0, "description": "Page number, defaults to 1.", "default": 1, "title": "Page" }, "description": "Page number, defaults to 1." }, { "name": "limit", "in": "query", "required": false, "schema": { "type": "integer", "exclusiveMinimum": 0, "description": "Size of a page, defaults to 10. Maximum is 100.", "default": 10, "title": "Limit" }, "description": "Size of a page, defaults to 10. Maximum is 100." }, { "name": "sorting", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "array", "items": { "$ref": "#/components/schemas/CustomerSubscriptionSortProperty" } }, { "type": "null" } ], "description": "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.", "default": [ "-started_at" ], "title": "Sorting" }, "description": "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." } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ListResource_CustomerSubscription_" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Customer", "Member" ], "x-speakeasy-pagination": { "type": "offsetLimit", "inputs": [ { "name": "page", "in": "parameters", "type": "page" }, { "name": "limit", "in": "parameters", "type": "limit" } ], "outputs": { "results": "$.items", "numPages": "$.pagination.max_page" } }, "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "customer_portal.subscriptions", "x-speakeasy-name-override": "list", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/operations\"\n\t\"os\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New()\n\n res, err := s.CustomerPortal.Subscriptions.List(ctx, operations.CustomerPortalSubscriptionsListRequest{}, operations.CustomerPortalSubscriptionsListSecurity{\n CustomerSession: polargo.Pointer(os.Getenv(\"POLAR_CUSTOMER_SESSION\")),\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.ListResourceCustomerSubscription != nil {\n for {\n // handle items\n\n res, err = res.Next()\n\n if err != nil {\n // handle error\n }\n\n if res == nil {\n break\n }\n }\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "import polar_sdk\nfrom polar_sdk import Polar\n\n\nwith Polar() as polar:\n\n res = polar.customer_portal.subscriptions.list(security=polar_sdk.CustomerPortalSubscriptionsListSecurity(\n customer_session=\"\",\n ), page=1, limit=10)\n\n while res is not None:\n # Handle items\n\n res = res.next()" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar();\n\nasync function run() {\n const result = await polar.customerPortal.subscriptions.list({\n customerSession: process.env[\"POLAR_CUSTOMER_SESSION\"] ?? \"\",\n }, {});\n\n for await (const page of result) {\n console.log(page);\n }\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Operations;\n\n$sdk = Polar\\Polar::builder()->build();\n\n$request = new Operations\\CustomerPortalSubscriptionsListRequest();\n$requestSecurity = new Operations\\CustomerPortalSubscriptionsListSecurity(\n customerSession: '',\n);\n\n$responses = $sdk->customerPortal->subscriptions->list(\n request: $request,\n security: $requestSecurity\n);\n\n\nforeach ($responses as $response) {\n if ($response->statusCode === 200) {\n // handle response\n }\n}" } ] } }, "/v1/customer-portal/subscriptions/{id}": { "get": { "tags": [ "customer_portal", "subscriptions", "public" ], "summary": "Get Subscription", "description": "Get a subscription for the authenticated customer.\n\n**Scopes**: `customer_portal:read` `customer_portal:write`", "operationId": "customer_portal:subscriptions:get", "security": [ { "customer_session": [ "customer_portal:read", "customer_portal:write" ] }, { "member_session": [ "customer_portal:read", "customer_portal:write" ] } ], "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid4", "description": "The subscription ID.", "title": "Id" }, "description": "The subscription ID." } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CustomerSubscription" } } } }, "404": { "description": "Customer subscription was not found.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ResourceNotFound" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Customer", "Member" ], "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "customer_portal.subscriptions", "x-speakeasy-name-override": "get", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"os\"\n\t\"github.com/polarsource/polar-go/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New()\n\n res, err := s.CustomerPortal.Subscriptions.Get(ctx, operations.CustomerPortalSubscriptionsGetSecurity{\n CustomerSession: polargo.Pointer(os.Getenv(\"POLAR_CUSTOMER_SESSION\")),\n }, \"\")\n if err != nil {\n log.Fatal(err)\n }\n if res.CustomerSubscription != nil {\n // handle response\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "import polar_sdk\nfrom polar_sdk import Polar\n\n\nwith Polar() as polar:\n\n res = polar.customer_portal.subscriptions.get(security=polar_sdk.CustomerPortalSubscriptionsGetSecurity(\n customer_session=\"\",\n ), id=\"\")\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar();\n\nasync function run() {\n const result = await polar.customerPortal.subscriptions.get({\n customerSession: process.env[\"POLAR_CUSTOMER_SESSION\"] ?? \"\",\n }, {\n id: \"\",\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Operations;\n\n$sdk = Polar\\Polar::builder()->build();\n\n\n$requestSecurity = new Operations\\CustomerPortalSubscriptionsGetSecurity(\n customerSession: '',\n);\n\n$response = $sdk->customerPortal->subscriptions->get(\n security: $requestSecurity,\n id: ''\n\n);\n\nif ($response->customerSubscription !== null) {\n // handle response\n}" } ] }, "patch": { "tags": [ "customer_portal", "subscriptions", "public" ], "summary": "Update Subscription", "description": "Update a subscription of the authenticated customer.", "operationId": "customer_portal:subscriptions:update", "security": [ { "customer_session": [ "customer_portal:write" ] }, { "member_session": [ "customer_portal:write" ] } ], "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid4", "description": "The subscription ID.", "title": "Id" }, "description": "The subscription ID." } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CustomerSubscriptionUpdate" } } } }, "responses": { "200": { "description": "Customer subscription updated.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CustomerSubscription" } } } }, "403": { "description": "Customer subscription is already canceled or will be at the end of the period, or the user lacks billing permissions.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AlreadyCanceledSubscription" } } } }, "404": { "description": "Customer subscription was not found.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ResourceNotFound" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "customer_portal.subscriptions", "x-speakeasy-name-override": "update", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"os\"\n\t\"github.com/polarsource/polar-go/models/operations\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New()\n\n res, err := s.CustomerPortal.Subscriptions.Update(ctx, operations.CustomerPortalSubscriptionsUpdateSecurity{\n CustomerSession: polargo.Pointer(os.Getenv(\"POLAR_CUSTOMER_SESSION\")),\n }, \"\", components.CreateCustomerSubscriptionUpdateCustomerSubscriptionCancel(\n components.CustomerSubscriptionCancel{},\n ))\n if err != nil {\n log.Fatal(err)\n }\n if res.CustomerSubscription != nil {\n // handle response\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "import polar_sdk\nfrom polar_sdk import Polar\n\n\nwith Polar() as polar:\n\n res = polar.customer_portal.subscriptions.update(security=polar_sdk.CustomerPortalSubscriptionsUpdateSecurity(\n customer_session=\"\",\n ), id=\"\", customer_subscription_update={})\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar();\n\nasync function run() {\n const result = await polar.customerPortal.subscriptions.update({\n customerSession: process.env[\"POLAR_CUSTOMER_SESSION\"] ?? \"\",\n }, {\n id: \"\",\n customerSubscriptionUpdate: {},\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Components;\nuse Polar\\Models\\Operations;\n\n$sdk = Polar\\Polar::builder()->build();\n\n\n$requestSecurity = new Operations\\CustomerPortalSubscriptionsUpdateSecurity(\n customerSession: '',\n);\n\n$response = $sdk->customerPortal->subscriptions->update(\n security: $requestSecurity,\n id: '',\n customerSubscriptionUpdate: new Components\\CustomerSubscriptionCancel()\n\n);\n\nif ($response->customerSubscription !== null) {\n // handle response\n}" } ] }, "delete": { "tags": [ "customer_portal", "subscriptions", "public" ], "summary": "Cancel Subscription", "description": "Cancel a subscription of the authenticated customer.", "operationId": "customer_portal:subscriptions:cancel", "security": [ { "customer_session": [ "customer_portal:write" ] }, { "member_session": [ "customer_portal:write" ] } ], "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid4", "description": "The subscription ID.", "title": "Id" }, "description": "The subscription ID." } ], "responses": { "200": { "description": "Customer subscription is canceled.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CustomerSubscription" } } } }, "403": { "description": "Customer subscription is already canceled or will be at the end of the period, or the user lacks billing permissions.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AlreadyCanceledSubscription" } } } }, "404": { "description": "Customer subscription was not found.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ResourceNotFound" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "customer_portal.subscriptions", "x-speakeasy-name-override": "cancel", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"os\"\n\t\"github.com/polarsource/polar-go/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New()\n\n res, err := s.CustomerPortal.Subscriptions.Cancel(ctx, operations.CustomerPortalSubscriptionsCancelSecurity{\n CustomerSession: polargo.Pointer(os.Getenv(\"POLAR_CUSTOMER_SESSION\")),\n }, \"\")\n if err != nil {\n log.Fatal(err)\n }\n if res.CustomerSubscription != nil {\n // handle response\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "import polar_sdk\nfrom polar_sdk import Polar\n\n\nwith Polar() as polar:\n\n res = polar.customer_portal.subscriptions.cancel(security=polar_sdk.CustomerPortalSubscriptionsCancelSecurity(\n customer_session=\"\",\n ), id=\"\")\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar();\n\nasync function run() {\n const result = await polar.customerPortal.subscriptions.cancel({\n customerSession: process.env[\"POLAR_CUSTOMER_SESSION\"] ?? \"\",\n }, {\n id: \"\",\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Operations;\n\n$sdk = Polar\\Polar::builder()->build();\n\n\n$requestSecurity = new Operations\\CustomerPortalSubscriptionsCancelSecurity(\n customerSession: '',\n);\n\n$response = $sdk->customerPortal->subscriptions->cancel(\n security: $requestSecurity,\n id: ''\n\n);\n\nif ($response->customerSubscription !== null) {\n // handle response\n}" } ] } }, "/v1/customer-portal/wallets/": { "get": { "tags": [ "customer_portal", "wallets", "public" ], "summary": "List Wallets", "description": "List wallets of the authenticated customer.", "operationId": "customer_portal:wallets:list", "security": [ { "customer_session": [ "customer_portal:read", "customer_portal:write" ] }, { "member_session": [ "customer_portal:read", "customer_portal:write" ] } ], "parameters": [ { "name": "page", "in": "query", "required": false, "schema": { "type": "integer", "exclusiveMinimum": 0, "description": "Page number, defaults to 1.", "default": 1, "title": "Page" }, "description": "Page number, defaults to 1." }, { "name": "limit", "in": "query", "required": false, "schema": { "type": "integer", "exclusiveMinimum": 0, "description": "Size of a page, defaults to 10. Maximum is 100.", "default": 10, "title": "Limit" }, "description": "Size of a page, defaults to 10. Maximum is 100." }, { "name": "sorting", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "array", "items": { "$ref": "#/components/schemas/CustomerWalletSortProperty" } }, { "type": "null" } ], "description": "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.", "default": [ "-created_at" ], "title": "Sorting" }, "description": "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." } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ListResource_CustomerWallet_" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-speakeasy-pagination": { "type": "offsetLimit", "inputs": [ { "name": "page", "in": "parameters", "type": "page" }, { "name": "limit", "in": "parameters", "type": "limit" } ], "outputs": { "results": "$.items", "numPages": "$.pagination.max_page" } }, "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "customer_portal.wallets", "x-speakeasy-name-override": "list", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"os\"\n\t\"github.com/polarsource/polar-go/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New()\n\n res, err := s.CustomerPortal.Wallets.List(ctx, operations.CustomerPortalWalletsListSecurity{\n CustomerSession: polargo.Pointer(os.Getenv(\"POLAR_CUSTOMER_SESSION\")),\n }, polargo.Pointer[int64](1), polargo.Pointer[int64](10), nil)\n if err != nil {\n log.Fatal(err)\n }\n if res.ListResourceCustomerWallet != nil {\n for {\n // handle items\n\n res, err = res.Next()\n\n if err != nil {\n // handle error\n }\n\n if res == nil {\n break\n }\n }\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "import polar_sdk\nfrom polar_sdk import Polar\n\n\nwith Polar() as polar:\n\n res = polar.customer_portal.wallets.list(security=polar_sdk.CustomerPortalWalletsListSecurity(\n customer_session=\"\",\n ), page=1, limit=10)\n\n while res is not None:\n # Handle items\n\n res = res.next()" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar();\n\nasync function run() {\n const result = await polar.customerPortal.wallets.list({\n customerSession: process.env[\"POLAR_CUSTOMER_SESSION\"] ?? \"\",\n }, {});\n\n for await (const page of result) {\n console.log(page);\n }\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Operations;\n\n$sdk = Polar\\Polar::builder()->build();\n\n\n$requestSecurity = new Operations\\CustomerPortalWalletsListSecurity(\n customerSession: '',\n);\n\n$responses = $sdk->customerPortal->wallets->list(\n security: $requestSecurity,\n page: 1,\n limit: 10\n\n);\n\n\nforeach ($responses as $response) {\n if ($response->statusCode === 200) {\n // handle response\n }\n}" } ] } }, "/v1/customer-portal/wallets/{id}": { "get": { "tags": [ "customer_portal", "wallets", "public" ], "summary": "Get Wallet", "description": "Get a wallet by ID for the authenticated customer.", "operationId": "customer_portal:wallets:get", "security": [ { "customer_session": [ "customer_portal:read", "customer_portal:write" ] }, { "member_session": [ "customer_portal:read", "customer_portal:write" ] } ], "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid4", "description": "The wallet ID.", "title": "Id" }, "description": "The wallet ID." } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CustomerWallet" } } } }, "404": { "description": "Wallet not found.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ResourceNotFound" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "customer_portal.wallets", "x-speakeasy-name-override": "get", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"os\"\n\t\"github.com/polarsource/polar-go/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New()\n\n res, err := s.CustomerPortal.Wallets.Get(ctx, operations.CustomerPortalWalletsGetSecurity{\n CustomerSession: polargo.Pointer(os.Getenv(\"POLAR_CUSTOMER_SESSION\")),\n }, \"\")\n if err != nil {\n log.Fatal(err)\n }\n if res.CustomerWallet != nil {\n // handle response\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "import polar_sdk\nfrom polar_sdk import Polar\n\n\nwith Polar() as polar:\n\n res = polar.customer_portal.wallets.get(security=polar_sdk.CustomerPortalWalletsGetSecurity(\n customer_session=\"\",\n ), id=\"\")\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar();\n\nasync function run() {\n const result = await polar.customerPortal.wallets.get({\n customerSession: process.env[\"POLAR_CUSTOMER_SESSION\"] ?? \"\",\n }, {\n id: \"\",\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Operations;\n\n$sdk = Polar\\Polar::builder()->build();\n\n\n$requestSecurity = new Operations\\CustomerPortalWalletsGetSecurity(\n customerSession: '',\n);\n\n$response = $sdk->customerPortal->wallets->get(\n security: $requestSecurity,\n id: ''\n\n);\n\nif ($response->customerWallet !== null) {\n // handle response\n}" } ] } }, "/v1/customer-seats": { "post": { "tags": [ "customer-seats", "public" ], "summary": "Assign Seat", "description": "**Scopes**: `customer_seats:write`", "operationId": "customer-seats:assign_seat", "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SeatAssign" } } } }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CustomerSeat" } } } }, "400": { "description": "No available seats or customer already has a seat" }, "401": { "description": "Authentication required for direct subscription or order assignment" }, "403": { "description": "Not permitted or seat-based pricing not enabled" }, "404": { "description": "Subscription, order, checkout, or customer not found" }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Anonymous", "Organization", "User" ], "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "customer-seats", "x-speakeasy-name-override": "assign_seat", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.CustomerSeats.AssignSeat(ctx, components.SeatAssign{})\n if err != nil {\n log.Fatal(err)\n }\n if res.CustomerSeat != nil {\n // handle response\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.customer_seats.assign_seat(request={})\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.customerSeats.assignSeat({});\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Components;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n$request = new Components\\SeatAssign();\n\n$response = $sdk->customerSeats->assignSeat(\n request: $request\n);\n\nif ($response->customerSeat !== null) {\n // handle response\n}" } ] }, "get": { "tags": [ "customer-seats", "public" ], "summary": "List Seats", "description": "**Scopes**: `customer_seats:write`", "operationId": "customer-seats:list_seats", "parameters": [ { "name": "subscription_id", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Subscription Id" } }, { "name": "order_id", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Order Id" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SeatsList" } } } }, "401": { "description": "Authentication required" }, "403": { "description": "Not permitted or seat-based pricing not enabled" }, "404": { "description": "Subscription or order not found" }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Anonymous", "Organization", "User" ], "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "customer-seats", "x-speakeasy-name-override": "list_seats", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.CustomerSeats.ListSeats(ctx, nil, nil)\n if err != nil {\n log.Fatal(err)\n }\n if res.SeatsList != nil {\n // handle response\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.customer_seats.list_seats()\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.customerSeats.listSeats({});\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n\n\n$response = $sdk->customerSeats->listSeats(\n\n);\n\nif ($response->seatsList !== null) {\n // handle response\n}" } ] } }, "/v1/customer-seats/{seat_id}": { "delete": { "tags": [ "customer-seats", "public" ], "summary": "Revoke Seat", "description": "**Scopes**: `customer_seats:write`", "operationId": "customer-seats:revoke_seat", "parameters": [ { "name": "seat_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid4", "title": "Seat Id" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CustomerSeat" } } } }, "401": { "description": "Authentication required" }, "403": { "description": "Not permitted or seat-based pricing not enabled" }, "404": { "description": "Seat not found" }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Anonymous", "Organization", "User" ], "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "customer-seats", "x-speakeasy-name-override": "revoke_seat", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.CustomerSeats.RevokeSeat(ctx, \"\")\n if err != nil {\n log.Fatal(err)\n }\n if res.CustomerSeat != nil {\n // handle response\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.customer_seats.revoke_seat(seat_id=\"\")\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.customerSeats.revokeSeat({\n seatId: \"\",\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n\n\n$response = $sdk->customerSeats->revokeSeat(\n seatId: ''\n);\n\nif ($response->customerSeat !== null) {\n // handle response\n}" } ] } }, "/v1/customer-seats/{seat_id}/resend": { "post": { "tags": [ "customer-seats", "public" ], "summary": "Resend Invitation", "description": "**Scopes**: `customer_seats:write`", "operationId": "customer-seats:resend_invitation", "parameters": [ { "name": "seat_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid4", "title": "Seat Id" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CustomerSeat" } } } }, "400": { "description": "Seat is not pending or already claimed" }, "401": { "description": "Authentication required" }, "403": { "description": "Not permitted or seat-based pricing not enabled" }, "404": { "description": "Seat not found" }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Anonymous", "Organization", "User" ], "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "customer-seats", "x-speakeasy-name-override": "resend_invitation", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.CustomerSeats.ResendInvitation(ctx, \"\")\n if err != nil {\n log.Fatal(err)\n }\n if res.CustomerSeat != nil {\n // handle response\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.customer_seats.resend_invitation(seat_id=\"\")\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.customerSeats.resendInvitation({\n seatId: \"\",\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n\n\n$response = $sdk->customerSeats->resendInvitation(\n seatId: ''\n);\n\nif ($response->customerSeat !== null) {\n // handle response\n}" } ] } }, "/v1/customer-seats/claim/{invitation_token}": { "get": { "tags": [ "customer-seats", "public" ], "summary": "Get Claim Info", "operationId": "customer-seats:get_claim_info", "parameters": [ { "name": "invitation_token", "in": "path", "required": true, "schema": { "type": "string", "title": "Invitation Token" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SeatClaimInfo" } } } }, "400": { "description": "Invalid or expired invitation token" }, "403": { "description": "Seat-based pricing not enabled for organization" }, "404": { "description": "Seat not found" }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "customer-seats", "x-speakeasy-name-override": "get_claim_info", "security": [ {} ], "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New()\n\n res, err := s.CustomerSeats.GetClaimInfo(ctx, \"\")\n if err != nil {\n log.Fatal(err)\n }\n if res.SeatClaimInfo != nil {\n // handle response\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar() as polar:\n\n res = polar.customer_seats.get_claim_info(invitation_token=\"\")\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar();\n\nasync function run() {\n const result = await polar.customerSeats.getClaimInfo({\n invitationToken: \"\",\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\n\n$sdk = Polar\\Polar::builder()->build();\n\n\n\n$response = $sdk->customerSeats->getClaimInfo(\n invitationToken: ''\n);\n\nif ($response->seatClaimInfo !== null) {\n // handle response\n}" } ] } }, "/v1/customer-seats/claim": { "post": { "tags": [ "customer-seats", "public" ], "summary": "Claim Seat", "operationId": "customer-seats:claim_seat", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SeatClaim" } } }, "required": true }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CustomerSeatClaimResponse" } } } }, "400": { "description": "Invalid, expired, or already claimed token" }, "403": { "description": "Seat-based pricing not enabled for organization" }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "customer-seats", "x-speakeasy-name-override": "claim_seat", "security": [ {} ], "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New()\n\n res, err := s.CustomerSeats.ClaimSeat(ctx, components.SeatClaim{\n InvitationToken: \"\",\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.CustomerSeatClaimResponse != nil {\n // handle response\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar() as polar:\n\n res = polar.customer_seats.claim_seat(request={\n \"invitation_token\": \"\",\n })\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar();\n\nasync function run() {\n const result = await polar.customerSeats.claimSeat({\n invitationToken: \"\",\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Components;\n\n$sdk = Polar\\Polar::builder()->build();\n\n$request = new Components\\SeatClaim(\n invitationToken: '',\n);\n\n$response = $sdk->customerSeats->claimSeat(\n request: $request\n);\n\nif ($response->customerSeatClaimResponse !== null) {\n // handle response\n}" } ] } }, "/v1/customer-sessions/": { "post": { "tags": [ "customer-sessions", "public" ], "summary": "Create Customer Session", "description": "Create a customer session.\n\nFor organizations with `member_model_enabled`, this will automatically\ncreate a member session for the owner member of the customer.\n\n**Scopes**: `customer_sessions:write`", "operationId": "customer-sessions:create", "requestBody": { "content": { "application/json": { "schema": { "anyOf": [ { "$ref": "#/components/schemas/CustomerSessionCustomerIDCreate" }, { "$ref": "#/components/schemas/CustomerSessionCustomerExternalIDCreate" } ], "title": "Customer Session Create" } } }, "required": true }, "responses": { "201": { "description": "Customer session created.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CustomerSession" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "customer-sessions", "x-speakeasy-name-override": "create", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"github.com/polarsource/polar-go/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.CustomerSessions.Create(ctx, operations.CreateCustomerSessionsCreateCustomerSessionCreateCustomerSessionCustomerExternalIDCreate(\n components.CustomerSessionCustomerExternalIDCreate{\n ExternalCustomerID: \"\",\n },\n ))\n if err != nil {\n log.Fatal(err)\n }\n if res.CustomerSession != nil {\n // handle response\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.customer_sessions.create(request={\n \"return_url\": \"https://example.com/account\",\n \"external_customer_id\": \"\",\n })\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.customerSessions.create({\n externalCustomerId: \"\",\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Components;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n$request = new Components\\CustomerSessionCustomerExternalIDCreate(\n externalCustomerId: '',\n);\n\n$response = $sdk->customerSessions->create(\n request: $request\n);\n\nif ($response->customerSession !== null) {\n // handle response\n}" } ] } }, "/v1/events/": { "get": { "tags": [ "events", "public" ], "summary": "List Events", "description": "List events.\n\n**Scopes**: `events:read` `events:write`", "operationId": "events:list", "parameters": [ { "name": "filter", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "description": "Filter events following filter clauses. JSON string following the same schema a meter filter clause. ", "title": "Filter" }, "description": "Filter events following filter clauses. JSON string following the same schema a meter filter clause. " }, { "name": "start_timestamp", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "description": "Filter events after this timestamp.", "title": "Start Timestamp" }, "description": "Filter events after this timestamp." }, { "name": "end_timestamp", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "description": "Filter events before this timestamp.", "title": "End Timestamp" }, "description": "Filter events before this timestamp." }, { "name": "organization_id", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string", "format": "uuid4", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "description": "The organization ID.", "x-polar-selector-widget": { "resourceRoot": "/v1/organizations", "resourceName": "Organization", "displayProperty": "name" } }, { "type": "array", "items": { "type": "string", "format": "uuid4", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "description": "The organization ID.", "x-polar-selector-widget": { "resourceRoot": "/v1/organizations", "resourceName": "Organization", "displayProperty": "name" } } }, { "type": "null" } ], "title": "OrganizationID Filter", "description": "Filter by organization ID." }, "description": "Filter by organization ID." }, { "name": "customer_id", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string", "format": "uuid4", "description": "The customer ID." }, { "type": "array", "items": { "type": "string", "format": "uuid4", "description": "The customer ID." } }, { "type": "null" } ], "title": "CustomerID Filter", "description": "Filter by customer ID." }, "description": "Filter by customer ID." }, { "name": "external_customer_id", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string" }, { "type": "array", "items": { "type": "string" } }, { "type": "null" } ], "title": "ExternalCustomerID Filter", "description": "Filter by external customer ID." }, "description": "Filter by external customer ID." }, { "name": "meter_id", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string", "format": "uuid4", "description": "The meter ID." }, { "type": "null" } ], "title": "MeterID Filter", "description": "Filter by a meter filter clause." }, "description": "Filter by a meter filter clause." }, { "name": "name", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string" }, { "type": "array", "items": { "type": "string" } }, { "type": "null" } ], "title": "Name Filter", "description": "Filter by event name." }, "description": "Filter by event name." }, { "name": "source", "in": "query", "required": false, "schema": { "anyOf": [ { "$ref": "#/components/schemas/EventSource" }, { "type": "array", "items": { "$ref": "#/components/schemas/EventSource" } }, { "type": "null" } ], "title": "Source Filter", "description": "Filter by event source." }, "description": "Filter by event source." }, { "name": "query", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Query", "description": "Query to filter events." }, "description": "Query to filter events." }, { "name": "parent_id", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string", "format": "uuid4", "description": "The event ID." }, { "type": "null" } ], "description": "When combined with depth, use this event as the anchor instead of root events.", "title": "Parent Id" }, "description": "When combined with depth, use this event as the anchor instead of root events." }, { "name": "depth", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "integer", "maximum": 5, "minimum": 0 }, { "type": "null" } ], "description": "Fetch descendants up to this depth. When set: 0=root events only, 1=roots+children, etc. Max 5. When not set, returns all events.", "title": "Depth" }, "description": "Fetch descendants up to this depth. When set: 0=root events only, 1=roots+children, etc. Max 5. When not set, returns all events." }, { "name": "page", "in": "query", "required": false, "schema": { "type": "integer", "exclusiveMinimum": 0, "description": "Page number, defaults to 1.", "default": 1, "title": "Page" }, "description": "Page number, defaults to 1." }, { "name": "limit", "in": "query", "required": false, "schema": { "type": "integer", "exclusiveMinimum": 0, "description": "Size of a page, defaults to 10. Maximum is 100.", "default": 10, "title": "Limit" }, "description": "Size of a page, defaults to 10. Maximum is 100." }, { "name": "sorting", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "array", "items": { "$ref": "#/components/schemas/EventSortProperty" } }, { "type": "null" } ], "description": "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.", "default": [ "-timestamp" ], "title": "Sorting" }, "description": "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." }, { "name": "metadata", "in": "query", "required": false, "style": "deepObject", "schema": { "$ref": "#/components/schemas/MetadataQuery" }, "description": "Filter by metadata key-value pairs. It uses the `deepObject` style, e.g. `?metadata[key]=value`." } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "anyOf": [ { "$ref": "#/components/schemas/ListResource_Event_" }, { "$ref": "#/components/schemas/ListResourceWithCursorPagination_Event_" } ], "title": "Response Events:List" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "events", "x-speakeasy-name-override": "list", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Events.List(ctx, operations.EventsListRequest{\n OrganizationID: polargo.Pointer(operations.CreateEventsListQueryParamOrganizationIDFilterStr(\n \"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n )),\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.ResponseEventsList != nil {\n switch res.ResponseEventsList.Type {\n case operations.EventsListResponseEventsListTypeListResourceEvent:\n // res.ResponseEventsList.ListResourceEvent is populated\n case operations.EventsListResponseEventsListTypeListResourceWithCursorPaginationEvent:\n // res.ResponseEventsList.ListResourceWithCursorPaginationEvent is populated\n }\n\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.events.list(organization_id=\"1dbfc517-0bbf-4301-9ba8-555ca42b9737\", page=1, limit=10)\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.events.list({\n organizationId: \"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Operations;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n$request = new Operations\\EventsListRequest(\n organizationId: '1dbfc517-0bbf-4301-9ba8-555ca42b9737',\n);\n\n$response = $sdk->events->list(\n request: $request\n);\n\nif ($response->responseEventsList !== null) {\n // handle response\n}" } ] } }, "/v1/events/names": { "get": { "tags": [ "events", "public" ], "summary": "List Event Names", "description": "List event names.\n\n**Scopes**: `events:read` `events:write`", "operationId": "events:list_names", "parameters": [ { "name": "organization_id", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string", "format": "uuid4", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "description": "The organization ID.", "x-polar-selector-widget": { "resourceRoot": "/v1/organizations", "resourceName": "Organization", "displayProperty": "name" } }, { "type": "array", "items": { "type": "string", "format": "uuid4", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "description": "The organization ID.", "x-polar-selector-widget": { "resourceRoot": "/v1/organizations", "resourceName": "Organization", "displayProperty": "name" } } }, { "type": "null" } ], "title": "OrganizationID Filter", "description": "Filter by organization ID." }, "description": "Filter by organization ID." }, { "name": "customer_id", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string", "format": "uuid4", "description": "The customer ID." }, { "type": "array", "items": { "type": "string", "format": "uuid4", "description": "The customer ID." } }, { "type": "null" } ], "title": "CustomerID Filter", "description": "Filter by customer ID." }, "description": "Filter by customer ID." }, { "name": "external_customer_id", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string" }, { "type": "array", "items": { "type": "string" } }, { "type": "null" } ], "title": "ExternalCustomerID Filter", "description": "Filter by external customer ID." }, "description": "Filter by external customer ID." }, { "name": "source", "in": "query", "required": false, "schema": { "anyOf": [ { "$ref": "#/components/schemas/EventSource" }, { "type": "array", "items": { "$ref": "#/components/schemas/EventSource" } }, { "type": "null" } ], "title": "Source Filter", "description": "Filter by event source." }, "description": "Filter by event source." }, { "name": "query", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Query", "description": "Query to filter event names." }, "description": "Query to filter event names." }, { "name": "page", "in": "query", "required": false, "schema": { "type": "integer", "exclusiveMinimum": 0, "description": "Page number, defaults to 1.", "default": 1, "title": "Page" }, "description": "Page number, defaults to 1." }, { "name": "limit", "in": "query", "required": false, "schema": { "type": "integer", "exclusiveMinimum": 0, "description": "Size of a page, defaults to 10. Maximum is 100.", "default": 10, "title": "Limit" }, "description": "Size of a page, defaults to 10. Maximum is 100." }, { "name": "sorting", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "array", "items": { "$ref": "#/components/schemas/EventNamesSortProperty" } }, { "type": "null" } ], "description": "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.", "default": [ "-last_seen" ], "title": "Sorting" }, "description": "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." } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ListResource_EventName_" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-pagination": { "type": "offsetLimit", "inputs": [ { "name": "page", "in": "parameters", "type": "page" }, { "name": "limit", "in": "parameters", "type": "limit" } ], "outputs": { "results": "$.items", "numPages": "$.pagination.max_page" } }, "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "events", "x-speakeasy-name-override": "list_names", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Events.ListNames(ctx, operations.EventsListNamesRequest{\n OrganizationID: polargo.Pointer(operations.CreateEventsListNamesQueryParamOrganizationIDFilterStr(\n \"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n )),\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.ListResourceEventName != nil {\n for {\n // handle items\n\n res, err = res.Next()\n\n if err != nil {\n // handle error\n }\n\n if res == nil {\n break\n }\n }\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.events.list_names(organization_id=\"1dbfc517-0bbf-4301-9ba8-555ca42b9737\", page=1, limit=10)\n\n while res is not None:\n # Handle items\n\n res = res.next()" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.events.listNames({\n organizationId: \"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n });\n\n for await (const page of result) {\n console.log(page);\n }\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Operations;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n$request = new Operations\\EventsListNamesRequest(\n organizationId: '1dbfc517-0bbf-4301-9ba8-555ca42b9737',\n);\n\n$responses = $sdk->events->listNames(\n request: $request\n);\n\n\nforeach ($responses as $response) {\n if ($response->statusCode === 200) {\n // handle response\n }\n}" } ] } }, "/v1/events/{id}": { "get": { "tags": [ "events", "public" ], "summary": "Get Event", "description": "Get an event by ID.\n\n**Scopes**: `events:read` `events:write`", "operationId": "events:get", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid4", "description": "The event ID.", "title": "Id" }, "description": "The event ID." } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Event" } } } }, "404": { "description": "Event not found.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ResourceNotFound" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "events", "x-speakeasy-name-override": "get", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"log\"\n\t\"github.com/polarsource/polar-go/models/components\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Events.Get(ctx, \"\")\n if err != nil {\n log.Fatal(err)\n }\n if res.Event != nil {\n switch res.Event.Type {\n case components.EventUnionTypeSystemEvent:\n // res.Event.SystemEvent is populated\n case components.EventUnionTypeUserEvent:\n // res.Event.UserEvent is populated\n }\n\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.events.get(id=\"\")\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.events.get({\n id: \"\",\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n\n\n$response = $sdk->events->get(\n id: ''\n);\n\nif ($response->event !== null) {\n // handle response\n}" } ] } }, "/v1/events/ingest": { "post": { "tags": [ "events", "public" ], "summary": "Ingest Events", "description": "Ingest batch of events.\n\n**Scopes**: `events:write`", "operationId": "events:ingest", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/EventsIngest" } } }, "required": true }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/EventsIngestResponse" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "events", "x-speakeasy-name-override": "ingest", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Events.Ingest(ctx, components.EventsIngest{\n Events: []components.Events{},\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.EventsIngestResponse != nil {\n // handle response\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.events.ingest(request={\n \"events\": [],\n })\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.events.ingest({\n events: [],\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Components;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n$request = new Components\\EventsIngest(\n events: [],\n);\n\n$response = $sdk->events->ingest(\n request: $request\n);\n\nif ($response->eventsIngestResponse !== null) {\n // handle response\n}" } ] } }, "/v1/event-types/": { "get": { "tags": [ "event-types", "public" ], "summary": "List Event Types", "description": "List event types with aggregated statistics.\n\n**Scopes**: `events:read` `events:write`", "operationId": "event-types:list", "parameters": [ { "name": "organization_id", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string", "format": "uuid4", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "description": "The organization ID.", "x-polar-selector-widget": { "resourceRoot": "/v1/organizations", "resourceName": "Organization", "displayProperty": "name" } }, { "type": "array", "items": { "type": "string", "format": "uuid4", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "description": "The organization ID.", "x-polar-selector-widget": { "resourceRoot": "/v1/organizations", "resourceName": "Organization", "displayProperty": "name" } } }, { "type": "null" } ], "title": "OrganizationID Filter", "description": "Filter by organization ID." }, "description": "Filter by organization ID." }, { "name": "customer_id", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string", "format": "uuid4", "description": "The customer ID." }, { "type": "array", "items": { "type": "string", "format": "uuid4", "description": "The customer ID." } }, { "type": "null" } ], "title": "CustomerID Filter", "description": "Filter by customer ID." }, "description": "Filter by customer ID." }, { "name": "external_customer_id", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string" }, { "type": "array", "items": { "type": "string" } }, { "type": "null" } ], "title": "ExternalCustomerID Filter", "description": "Filter by external customer ID." }, "description": "Filter by external customer ID." }, { "name": "query", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Query", "description": "Query to filter event types by name or label." }, "description": "Query to filter event types by name or label." }, { "name": "root_events", "in": "query", "required": false, "schema": { "type": "boolean", "title": "Root Events Filter", "description": "When true, only return event types with root events (parent_id IS NULL).", "default": false }, "description": "When true, only return event types with root events (parent_id IS NULL)." }, { "name": "parent_id", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string", "format": "uuid" }, { "type": "null" } ], "title": "ParentID Filter", "description": "Filter by specific parent event ID." }, "description": "Filter by specific parent event ID." }, { "name": "source", "in": "query", "required": false, "schema": { "anyOf": [ { "$ref": "#/components/schemas/EventSource" }, { "type": "null" } ], "title": "EventSource Filter", "description": "Filter by event source (system or user)." }, "description": "Filter by event source (system or user)." }, { "name": "page", "in": "query", "required": false, "schema": { "type": "integer", "exclusiveMinimum": 0, "description": "Page number, defaults to 1.", "default": 1, "title": "Page" }, "description": "Page number, defaults to 1." }, { "name": "limit", "in": "query", "required": false, "schema": { "type": "integer", "exclusiveMinimum": 0, "description": "Size of a page, defaults to 10. Maximum is 100.", "default": 10, "title": "Limit" }, "description": "Size of a page, defaults to 10. Maximum is 100." }, { "name": "sorting", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "array", "items": { "$ref": "#/components/schemas/EventTypesSortProperty" } }, { "type": "null" } ], "description": "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.", "default": [ "-last_seen" ], "title": "Sorting" }, "description": "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." } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ListResource_EventTypeWithStats_" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-pagination": { "type": "offsetLimit", "inputs": [ { "name": "page", "in": "parameters", "type": "page" }, { "name": "limit", "in": "parameters", "type": "limit" } ], "outputs": { "results": "$.items", "numPages": "$.pagination.max_page" } }, "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "event-types", "x-speakeasy-name-override": "list", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.EventTypes.List(ctx, operations.EventTypesListRequest{\n OrganizationID: polargo.Pointer(operations.CreateEventTypesListQueryParamOrganizationIDFilterStr(\n \"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n )),\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.ListResourceEventTypeWithStats != nil {\n for {\n // handle items\n\n res, err = res.Next()\n\n if err != nil {\n // handle error\n }\n\n if res == nil {\n break\n }\n }\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.event_types.list(organization_id=\"1dbfc517-0bbf-4301-9ba8-555ca42b9737\", root_events=False, page=1, limit=10)\n\n while res is not None:\n # Handle items\n\n res = res.next()" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.eventTypes.list({\n organizationId: \"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n });\n\n for await (const page of result) {\n console.log(page);\n }\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Operations;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n$request = new Operations\\EventTypesListRequest(\n organizationId: '1dbfc517-0bbf-4301-9ba8-555ca42b9737',\n);\n\n$responses = $sdk->eventTypes->list(\n request: $request\n);\n\n\nforeach ($responses as $response) {\n if ($response->statusCode === 200) {\n // handle response\n }\n}" } ] } }, "/v1/event-types/{id}": { "patch": { "tags": [ "event-types", "public" ], "summary": "Update Event Type", "description": "Update an event type's label.", "operationId": "event-types:update", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid4", "description": "The event type ID.", "title": "Id" }, "description": "The event type ID." } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/EventTypeUpdate" } } } }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/EventType" } } } }, "404": { "description": "Not Found" }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "event-types", "x-speakeasy-name-override": "update", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.EventTypes.Update(ctx, \"\", components.EventTypeUpdate{\n Label: \"\",\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.EventType != nil {\n // handle response\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.event_types.update(id=\"\", event_type_update={\n \"label\": \"\",\n })\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.eventTypes.update({\n id: \"\",\n eventTypeUpdate: {\n label: \"\",\n },\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Components;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n$eventTypeUpdate = new Components\\EventTypeUpdate(\n label: '',\n);\n\n$response = $sdk->eventTypes->update(\n id: '',\n eventTypeUpdate: $eventTypeUpdate\n\n);\n\nif ($response->eventType !== null) {\n // handle response\n}" } ] } }, "/v1/meters/": { "get": { "tags": [ "meters", "public" ], "summary": "List Meters", "description": "List meters.\n\n**Scopes**: `meters:read` `meters:write`", "operationId": "meters:list", "parameters": [ { "name": "organization_id", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string", "format": "uuid4", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "description": "The organization ID.", "x-polar-selector-widget": { "resourceRoot": "/v1/organizations", "resourceName": "Organization", "displayProperty": "name" } }, { "type": "array", "items": { "type": "string", "format": "uuid4", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "description": "The organization ID.", "x-polar-selector-widget": { "resourceRoot": "/v1/organizations", "resourceName": "Organization", "displayProperty": "name" } } }, { "type": "null" } ], "title": "OrganizationID Filter", "description": "Filter by organization ID." }, "description": "Filter by organization ID." }, { "name": "query", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "description": "Filter by name.", "title": "Query" }, "description": "Filter by name." }, { "name": "is_archived", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "description": "Filter on archived meters.", "title": "Is Archived" }, "description": "Filter on archived meters." }, { "name": "page", "in": "query", "required": false, "schema": { "type": "integer", "exclusiveMinimum": 0, "description": "Page number, defaults to 1.", "default": 1, "title": "Page" }, "description": "Page number, defaults to 1." }, { "name": "limit", "in": "query", "required": false, "schema": { "type": "integer", "exclusiveMinimum": 0, "description": "Size of a page, defaults to 10. Maximum is 100.", "default": 10, "title": "Limit" }, "description": "Size of a page, defaults to 10. Maximum is 100." }, { "name": "sorting", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "array", "items": { "$ref": "#/components/schemas/MeterSortProperty" } }, { "type": "null" } ], "description": "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.", "default": [ "name" ], "title": "Sorting" }, "description": "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." }, { "name": "metadata", "in": "query", "required": false, "style": "deepObject", "schema": { "$ref": "#/components/schemas/MetadataQuery" }, "description": "Filter by metadata key-value pairs. It uses the `deepObject` style, e.g. `?metadata[key]=value`." } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ListResource_Meter_" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-pagination": { "type": "offsetLimit", "inputs": [ { "name": "page", "in": "parameters", "type": "page" }, { "name": "limit", "in": "parameters", "type": "limit" } ], "outputs": { "results": "$.items", "numPages": "$.pagination.max_page" } }, "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "meters", "x-speakeasy-name-override": "list", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Meters.List(ctx, operations.MetersListRequest{\n OrganizationID: polargo.Pointer(operations.CreateMetersListQueryParamOrganizationIDFilterStr(\n \"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n )),\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.ListResourceMeter != nil {\n for {\n // handle items\n\n res, err = res.Next()\n\n if err != nil {\n // handle error\n }\n\n if res == nil {\n break\n }\n }\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.meters.list(organization_id=\"1dbfc517-0bbf-4301-9ba8-555ca42b9737\", page=1, limit=10)\n\n while res is not None:\n # Handle items\n\n res = res.next()" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.meters.list({\n organizationId: \"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n });\n\n for await (const page of result) {\n console.log(page);\n }\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Operations;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n$request = new Operations\\MetersListRequest(\n organizationId: '1dbfc517-0bbf-4301-9ba8-555ca42b9737',\n);\n\n$responses = $sdk->meters->list(\n request: $request\n);\n\n\nforeach ($responses as $response) {\n if ($response->statusCode === 200) {\n // handle response\n }\n}" } ] }, "post": { "tags": [ "meters", "public" ], "summary": "Create Meter", "description": "Create a meter.\n\n**Scopes**: `meters:write`", "operationId": "meters:create", "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/MeterCreate" } } } }, "responses": { "201": { "description": "Meter created.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Meter" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "meters", "x-speakeasy-name-override": "create", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Meters.Create(ctx, components.MeterCreate{\n Name: \"\",\n Filter: components.Filter{\n Conjunction: components.FilterConjunctionOr,\n Clauses: []components.Clauses{\n components.CreateClausesFilterClause(\n components.FilterClause{\n Property: \"\",\n Operator: components.FilterOperatorNe,\n Value: components.CreateValueStr(\n \"\",\n ),\n },\n ),\n },\n },\n Aggregation: components.CreateMeterCreateAggregationAvg(\n components.PropertyAggregation{\n Func: components.FuncMax,\n Property: \"\",\n },\n ),\n OrganizationID: polargo.Pointer(\"1dbfc517-0bbf-4301-9ba8-555ca42b9737\"),\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.Meter != nil {\n switch res.Meter.Aggregation.Type {\n case components.MeterAggregationTypeAvg:\n // res.Meter.Aggregation.PropertyAggregation is populated\n case components.MeterAggregationTypeCount:\n // res.Meter.Aggregation.CountAggregation is populated\n case components.MeterAggregationTypeMax:\n // res.Meter.Aggregation.PropertyAggregation is populated\n case components.MeterAggregationTypeMin:\n // res.Meter.Aggregation.PropertyAggregation is populated\n case components.MeterAggregationTypeSum:\n // res.Meter.Aggregation.PropertyAggregation is populated\n case components.MeterAggregationTypeUnique:\n // res.Meter.Aggregation.UniqueAggregation is populated\n }\n\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "import polar_sdk\nfrom polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.meters.create(request={\n \"name\": \"\",\n \"filter_\": {\n \"conjunction\": polar_sdk.FilterConjunction.OR,\n \"clauses\": [],\n },\n \"aggregation\": {\n \"func\": \"count\",\n },\n \"organization_id\": \"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n })\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.meters.create({\n name: \"\",\n filter: {\n conjunction: \"or\",\n clauses: [\n {\n property: \"\",\n operator: \"ne\",\n value: \"\",\n },\n ],\n },\n aggregation: {\n func: \"max\",\n property: \"\",\n },\n organizationId: \"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Components;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n$request = new Components\\MeterCreate(\n name: '',\n filter: new Components\\Filter(\n conjunction: Components\\FilterConjunction::Or,\n clauses: [\n new Components\\FilterClause(\n property: '',\n operator: Components\\FilterOperator::Ne,\n value: '',\n ),\n ],\n ),\n aggregation: new Components\\PropertyAggregation(\n func: Components\\Func::Max,\n property: '',\n ),\n organizationId: '1dbfc517-0bbf-4301-9ba8-555ca42b9737',\n);\n\n$response = $sdk->meters->create(\n request: $request\n);\n\nif ($response->meter !== null) {\n // handle response\n}" } ] } }, "/v1/meters/{id}": { "get": { "tags": [ "meters", "public" ], "summary": "Get Meter", "description": "Get a meter by ID.\n\n**Scopes**: `meters:read` `meters:write`", "operationId": "meters:get", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid4", "description": "The meter ID.", "title": "Id" }, "description": "The meter ID." } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Meter" } } } }, "404": { "description": "Meter not found.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ResourceNotFound" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "meters", "x-speakeasy-name-override": "get", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"log\"\n\t\"github.com/polarsource/polar-go/models/components\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Meters.Get(ctx, \"\")\n if err != nil {\n log.Fatal(err)\n }\n if res.Meter != nil {\n switch res.Meter.Aggregation.Type {\n case components.MeterAggregationTypeAvg:\n // res.Meter.Aggregation.PropertyAggregation is populated\n case components.MeterAggregationTypeCount:\n // res.Meter.Aggregation.CountAggregation is populated\n case components.MeterAggregationTypeMax:\n // res.Meter.Aggregation.PropertyAggregation is populated\n case components.MeterAggregationTypeMin:\n // res.Meter.Aggregation.PropertyAggregation is populated\n case components.MeterAggregationTypeSum:\n // res.Meter.Aggregation.PropertyAggregation is populated\n case components.MeterAggregationTypeUnique:\n // res.Meter.Aggregation.UniqueAggregation is populated\n }\n\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.meters.get(id=\"\")\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.meters.get({\n id: \"\",\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n\n\n$response = $sdk->meters->get(\n id: ''\n);\n\nif ($response->meter !== null) {\n // handle response\n}" } ] }, "patch": { "tags": [ "meters", "public" ], "summary": "Update Meter", "description": "Update a meter.\n\n**Scopes**: `meters:write`", "operationId": "meters:update", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid4", "description": "The meter ID.", "title": "Id" }, "description": "The meter ID." } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/MeterUpdate" } } } }, "responses": { "200": { "description": "Meter updated.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Meter" } } } }, "404": { "description": "Meter not found.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ResourceNotFound" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "meters", "x-speakeasy-name-override": "update", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Meters.Update(ctx, \"\", components.MeterUpdate{})\n if err != nil {\n log.Fatal(err)\n }\n if res.Meter != nil {\n switch res.Meter.Aggregation.Type {\n case components.MeterAggregationTypeAvg:\n // res.Meter.Aggregation.PropertyAggregation is populated\n case components.MeterAggregationTypeCount:\n // res.Meter.Aggregation.CountAggregation is populated\n case components.MeterAggregationTypeMax:\n // res.Meter.Aggregation.PropertyAggregation is populated\n case components.MeterAggregationTypeMin:\n // res.Meter.Aggregation.PropertyAggregation is populated\n case components.MeterAggregationTypeSum:\n // res.Meter.Aggregation.PropertyAggregation is populated\n case components.MeterAggregationTypeUnique:\n // res.Meter.Aggregation.UniqueAggregation is populated\n }\n\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.meters.update(id=\"\", meter_update={})\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.meters.update({\n id: \"\",\n meterUpdate: {},\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Components;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n$meterUpdate = new Components\\MeterUpdate();\n\n$response = $sdk->meters->update(\n id: '',\n meterUpdate: $meterUpdate\n\n);\n\nif ($response->meter !== null) {\n // handle response\n}" } ] } }, "/v1/meters/{id}/quantities": { "get": { "tags": [ "meters", "public" ], "summary": "Get Meter Quantities", "description": "Get quantities of a meter over a time period.\n\n**Scopes**: `meters:read` `meters:write`", "operationId": "meters:quantities", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid4", "description": "The meter ID.", "title": "Id" }, "description": "The meter ID." }, { "name": "start_timestamp", "in": "query", "required": true, "schema": { "type": "string", "format": "date-time", "description": "Start timestamp.", "title": "Start Timestamp" }, "description": "Start timestamp." }, { "name": "end_timestamp", "in": "query", "required": true, "schema": { "type": "string", "format": "date-time", "description": "End timestamp.", "title": "End Timestamp" }, "description": "End timestamp." }, { "name": "interval", "in": "query", "required": true, "schema": { "$ref": "#/components/schemas/TimeInterval", "description": "Interval between two timestamps." }, "description": "Interval between two timestamps." }, { "name": "timezone", "in": "query", "required": false, "schema": { "type": "string", "minLength": 1, "description": "Timezone to use for the timestamps. Default is UTC.", "default": "UTC", "title": "Timezone" }, "description": "Timezone to use for the timestamps. Default is UTC." }, { "name": "customer_id", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string", "format": "uuid4", "description": "The customer ID." }, { "type": "array", "items": { "type": "string", "format": "uuid4", "description": "The customer ID." } }, { "type": "null" } ], "title": "CustomerID Filter", "description": "Filter by customer ID." }, "description": "Filter by customer ID." }, { "name": "external_customer_id", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string" }, { "type": "array", "items": { "type": "string" } }, { "type": "null" } ], "title": "ExternalCustomerID Filter", "description": "Filter by external customer ID." }, "description": "Filter by external customer ID." }, { "name": "customer_aggregation_function", "in": "query", "required": false, "schema": { "anyOf": [ { "$ref": "#/components/schemas/AggregationFunction" }, { "type": "null" } ], "description": "If set, will first compute the quantities per customer before aggregating them using the given function. If not set, the quantities will be aggregated across all events.", "title": "Customer Aggregation Function" }, "description": "If set, will first compute the quantities per customer before aggregating them using the given function. If not set, the quantities will be aggregated across all events." }, { "name": "metadata", "in": "query", "required": false, "style": "deepObject", "schema": { "$ref": "#/components/schemas/MetadataQuery" }, "description": "Filter by metadata key-value pairs. It uses the `deepObject` style, e.g. `?metadata[key]=value`." } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/MeterQuantities" } } } }, "404": { "description": "Meter not found.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ResourceNotFound" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-mcp": { "disabled": true }, "x-speakeasy-group": "meters", "x-speakeasy-name-override": "quantities", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/types\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"github.com/polarsource/polar-go/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Meters.Quantities(ctx, operations.MetersQuantitiesRequest{\n ID: \"\",\n StartTimestamp: types.MustTimeFromString(\"2025-11-25T04:37:16.823Z\"),\n EndTimestamp: types.MustTimeFromString(\"2025-11-26T17:06:00.727Z\"),\n Interval: components.TimeIntervalDay,\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.MeterQuantities != nil {\n // handle response\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "import polar_sdk\nfrom polar_sdk import Polar\nfrom polar_sdk.utils import parse_datetime\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.meters.quantities(id=\"\", start_timestamp=parse_datetime(\"2026-11-25T04:37:16.823Z\"), end_timestamp=parse_datetime(\"2026-11-26T17:06:00.727Z\"), interval=polar_sdk.TimeInterval.DAY, timezone=\"UTC\")\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.meters.quantities({\n id: \"\",\n startTimestamp: new Date(\"2025-11-25T04:37:16.823Z\"),\n endTimestamp: new Date(\"2025-11-26T17:06:00.727Z\"),\n interval: \"day\",\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Components;\nuse Polar\\Models\\Operations;\nuse Polar\\Utils;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n$request = new Operations\\MetersQuantitiesRequest(\n id: '',\n startTimestamp: Utils\\Utils::parseDateTime('2025-11-25T04:37:16.823Z'),\n endTimestamp: Utils\\Utils::parseDateTime('2025-11-26T17:06:00.727Z'),\n interval: Components\\TimeInterval::Day,\n);\n\n$response = $sdk->meters->quantities(\n request: $request\n);\n\nif ($response->meterQuantities !== null) {\n // handle response\n}" } ] } }, "/v1/organization-access-tokens/": { "get": { "tags": [ "organization_access_tokens", "public", "mcp" ], "summary": "List", "description": "List organization access tokens.\n\n**Scopes**: `organization_access_tokens:read` `organization_access_tokens:write`", "operationId": "organization_access_tokens:list", "parameters": [ { "name": "organization_id", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string", "format": "uuid4", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "description": "The organization ID.", "x-polar-selector-widget": { "resourceRoot": "/v1/organizations", "resourceName": "Organization", "displayProperty": "name" } }, { "type": "array", "items": { "type": "string", "format": "uuid4", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "description": "The organization ID.", "x-polar-selector-widget": { "resourceRoot": "/v1/organizations", "resourceName": "Organization", "displayProperty": "name" } } }, { "type": "null" } ], "title": "OrganizationID Filter", "description": "Filter by organization ID." }, "description": "Filter by organization ID." }, { "name": "page", "in": "query", "required": false, "schema": { "type": "integer", "exclusiveMinimum": 0, "description": "Page number, defaults to 1.", "default": 1, "title": "Page" }, "description": "Page number, defaults to 1." }, { "name": "limit", "in": "query", "required": false, "schema": { "type": "integer", "exclusiveMinimum": 0, "description": "Size of a page, defaults to 10. Maximum is 100.", "default": 10, "title": "Limit" }, "description": "Size of a page, defaults to 10. Maximum is 100." }, { "name": "sorting", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "array", "items": { "$ref": "#/components/schemas/OrganizationAccessTokenSortProperty" } }, { "type": "null" } ], "description": "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.", "default": [ "created_at" ], "title": "Sorting" }, "description": "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." } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ListResource_OrganizationAccessToken_" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-pagination": { "type": "offsetLimit", "inputs": [ { "name": "page", "in": "parameters", "type": "page" }, { "name": "limit", "in": "parameters", "type": "limit" } ], "outputs": { "results": "$.items", "numPages": "$.pagination.max_page" } }, "x-speakeasy-mcp": { "disabled": false, "scopes": [ "read", "organization_access_tokens" ] }, "x-speakeasy-group": "organization_access_tokens", "x-speakeasy-name-override": "list", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.OrganizationAccessTokens.List(ctx, polargo.Pointer(operations.CreateOrganizationAccessTokensListQueryParamOrganizationIDFilterStr(\n \"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n )), polargo.Pointer[int64](1), polargo.Pointer[int64](10), nil)\n if err != nil {\n log.Fatal(err)\n }\n if res.ListResourceOrganizationAccessToken != nil {\n for {\n // handle items\n\n res, err = res.Next()\n\n if err != nil {\n // handle error\n }\n\n if res == nil {\n break\n }\n }\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.organization_access_tokens.list(organization_id=\"1dbfc517-0bbf-4301-9ba8-555ca42b9737\", page=1, limit=10)\n\n while res is not None:\n # Handle items\n\n res = res.next()" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.organizationAccessTokens.list({\n organizationId: \"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n });\n\n for await (const page of result) {\n console.log(page);\n }\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n\n\n$responses = $sdk->organizationAccessTokens->list(\n organizationId: '1dbfc517-0bbf-4301-9ba8-555ca42b9737',\n page: 1,\n limit: 10\n\n);\n\n\nforeach ($responses as $response) {\n if ($response->statusCode === 200) {\n // handle response\n }\n}" } ] }, "post": { "tags": [ "organization_access_tokens", "public", "mcp" ], "summary": "Create", "description": "**Scopes**: `organization_access_tokens:write`", "operationId": "organization_access_tokens:create", "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/OrganizationAccessTokenCreate" } } } }, "responses": { "201": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/OrganizationAccessTokenCreateResponse" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-mcp": { "disabled": false, "scopes": [ "write", "organization_access_tokens" ] }, "x-speakeasy-group": "organization_access_tokens", "x-speakeasy-name-override": "create", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.OrganizationAccessTokens.Create(ctx, components.OrganizationAccessTokenCreate{\n Comment: \"The Football Is Good For Training And Recreational Purposes\",\n Scopes: []components.AvailableScope{},\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.OrganizationAccessTokenCreateResponse != nil {\n // handle response\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.organization_access_tokens.create(request={\n \"comment\": \"The Football Is Good For Training And Recreational Purposes\",\n \"scopes\": [],\n })\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.organizationAccessTokens.create({\n comment: \"The Football Is Good For Training And Recreational Purposes\",\n scopes: [],\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Components;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n$request = new Components\\OrganizationAccessTokenCreate(\n comment: 'The Football Is Good For Training And Recreational Purposes',\n scopes: [],\n);\n\n$response = $sdk->organizationAccessTokens->create(\n request: $request\n);\n\nif ($response->organizationAccessTokenCreateResponse !== null) {\n // handle response\n}" } ] } }, "/v1/organization-access-tokens/{id}": { "patch": { "tags": [ "organization_access_tokens", "public", "mcp" ], "summary": "Update", "description": "**Scopes**: `organization_access_tokens:write`", "operationId": "organization_access_tokens:update", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid4", "title": "Id" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/OrganizationAccessTokenUpdate" } } } }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/OrganizationAccessToken" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-mcp": { "disabled": false, "scopes": [ "write", "organization_access_tokens" ] }, "x-speakeasy-group": "organization_access_tokens", "x-speakeasy-name-override": "update", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.OrganizationAccessTokens.Update(ctx, \"\", components.OrganizationAccessTokenUpdate{})\n if err != nil {\n log.Fatal(err)\n }\n if res.OrganizationAccessToken != nil {\n // handle response\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.organization_access_tokens.update(id=\"\", organization_access_token_update={})\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.organizationAccessTokens.update({\n id: \"\",\n organizationAccessTokenUpdate: {},\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Components;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n$organizationAccessTokenUpdate = new Components\\OrganizationAccessTokenUpdate();\n\n$response = $sdk->organizationAccessTokens->update(\n id: '',\n organizationAccessTokenUpdate: $organizationAccessTokenUpdate\n\n);\n\nif ($response->organizationAccessToken !== null) {\n // handle response\n}" } ] }, "delete": { "tags": [ "organization_access_tokens", "public", "mcp" ], "summary": "Delete", "description": "**Scopes**: `organization_access_tokens:write`", "operationId": "organization_access_tokens:delete", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid4", "title": "Id" } } ], "responses": { "204": { "description": "Successful Response" }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-mcp": { "disabled": false, "scopes": [ "write", "organization_access_tokens" ] }, "x-speakeasy-group": "organization_access_tokens", "x-speakeasy-name-override": "delete", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.OrganizationAccessTokens.Delete(ctx, \"\")\n if err != nil {\n log.Fatal(err)\n }\n if res != nil {\n // handle response\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n polar.organization_access_tokens.delete(id=\"\")\n\n # Use the SDK ..." }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n await polar.organizationAccessTokens.delete({\n id: \"\",\n });\n\n\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n\n\n$response = $sdk->organizationAccessTokens->delete(\n id: ''\n);\n\nif ($response->statusCode === 200) {\n // handle response\n}" } ] } }, "/v1/customer-meters/": { "get": { "tags": [ "customer_meters", "public", "mcp" ], "summary": "List Customer Meters", "description": "List customer meters.\n\n**Scopes**: `customer_meters:read`", "operationId": "customer_meters:list", "parameters": [ { "name": "organization_id", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string", "format": "uuid4", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "description": "The organization ID.", "x-polar-selector-widget": { "resourceRoot": "/v1/organizations", "resourceName": "Organization", "displayProperty": "name" } }, { "type": "array", "items": { "type": "string", "format": "uuid4", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "description": "The organization ID.", "x-polar-selector-widget": { "resourceRoot": "/v1/organizations", "resourceName": "Organization", "displayProperty": "name" } } }, { "type": "null" } ], "title": "OrganizationID Filter", "description": "Filter by organization ID." }, "description": "Filter by organization ID." }, { "name": "customer_id", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string", "format": "uuid4", "description": "The customer ID." }, { "type": "array", "items": { "type": "string", "format": "uuid4", "description": "The customer ID." } }, { "type": "null" } ], "title": "CustomerID Filter", "description": "Filter by customer ID." }, "description": "Filter by customer ID." }, { "name": "external_customer_id", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string" }, { "type": "array", "items": { "type": "string" } }, { "type": "null" } ], "title": "ExternalCustomerID Filter", "description": "Filter by external customer ID." }, "description": "Filter by external customer ID." }, { "name": "meter_id", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string", "format": "uuid4", "description": "The meter ID." }, { "type": "array", "items": { "type": "string", "format": "uuid4", "description": "The meter ID." } }, { "type": "null" } ], "title": "MeterID Filter", "description": "Filter by meter ID." }, "description": "Filter by meter ID." }, { "name": "page", "in": "query", "required": false, "schema": { "type": "integer", "exclusiveMinimum": 0, "description": "Page number, defaults to 1.", "default": 1, "title": "Page" }, "description": "Page number, defaults to 1." }, { "name": "limit", "in": "query", "required": false, "schema": { "type": "integer", "exclusiveMinimum": 0, "description": "Size of a page, defaults to 10. Maximum is 100.", "default": 10, "title": "Limit" }, "description": "Size of a page, defaults to 10. Maximum is 100." }, { "name": "sorting", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "array", "items": { "$ref": "#/components/schemas/CustomerMeterSortProperty" } }, { "type": "null" } ], "description": "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.", "default": [ "-modified_at" ], "title": "Sorting" }, "description": "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." } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ListResource_CustomerMeter_" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-pagination": { "type": "offsetLimit", "inputs": [ { "name": "page", "in": "parameters", "type": "page" }, { "name": "limit", "in": "parameters", "type": "limit" } ], "outputs": { "results": "$.items", "numPages": "$.pagination.max_page" } }, "x-speakeasy-mcp": { "disabled": false, "scopes": [ "read", "customer_meters" ] }, "x-speakeasy-group": "customer_meters", "x-speakeasy-name-override": "list", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.CustomerMeters.List(ctx, operations.CustomerMetersListRequest{\n OrganizationID: polargo.Pointer(operations.CreateCustomerMetersListQueryParamOrganizationIDFilterStr(\n \"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n )),\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.ListResourceCustomerMeter != nil {\n for {\n // handle items\n\n res, err = res.Next()\n\n if err != nil {\n // handle error\n }\n\n if res == nil {\n break\n }\n }\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.customer_meters.list(organization_id=\"1dbfc517-0bbf-4301-9ba8-555ca42b9737\", page=1, limit=10)\n\n while res is not None:\n # Handle items\n\n res = res.next()" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.customerMeters.list({\n organizationId: \"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n });\n\n for await (const page of result) {\n console.log(page);\n }\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Operations;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n$request = new Operations\\CustomerMetersListRequest(\n organizationId: '1dbfc517-0bbf-4301-9ba8-555ca42b9737',\n);\n\n$responses = $sdk->customerMeters->list(\n request: $request\n);\n\n\nforeach ($responses as $response) {\n if ($response->statusCode === 200) {\n // handle response\n }\n}" } ] } }, "/v1/customer-meters/{id}": { "get": { "tags": [ "customer_meters", "public", "mcp" ], "summary": "Get Customer Meter", "description": "Get a customer meter by ID.\n\n**Scopes**: `customer_meters:read`", "operationId": "customer_meters:get", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid4", "description": "The customer meter ID.", "title": "Id" }, "description": "The customer meter ID." } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CustomerMeter" } } } }, "404": { "description": "Customer meter not found.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ResourceNotFound" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-mcp": { "disabled": false, "scopes": [ "read", "customer_meters" ] }, "x-speakeasy-group": "customer_meters", "x-speakeasy-name-override": "get", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.CustomerMeters.Get(ctx, \"\")\n if err != nil {\n log.Fatal(err)\n }\n if res.CustomerMeter != nil {\n // handle response\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.customer_meters.get(id=\"\")\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.customerMeters.get({\n id: \"\",\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n\n\n$response = $sdk->customerMeters->get(\n id: ''\n);\n\nif ($response->customerMeter !== null) {\n // handle response\n}" } ] } }, "/v1/payments/": { "get": { "tags": [ "payments", "public", "mcp" ], "summary": "List Payments", "description": "List payments.\n\n**Scopes**: `payments:read`", "operationId": "payments:list", "parameters": [ { "name": "organization_id", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string", "format": "uuid4", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "description": "The organization ID.", "x-polar-selector-widget": { "resourceRoot": "/v1/organizations", "resourceName": "Organization", "displayProperty": "name" } }, { "type": "array", "items": { "type": "string", "format": "uuid4", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "description": "The organization ID.", "x-polar-selector-widget": { "resourceRoot": "/v1/organizations", "resourceName": "Organization", "displayProperty": "name" } } }, { "type": "null" } ], "title": "OrganizationID Filter", "description": "Filter by organization ID." }, "description": "Filter by organization ID." }, { "name": "checkout_id", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "array", "items": { "type": "string", "format": "uuid4" } }, { "type": "null" } ], "title": "CheckoutID Filter", "description": "Filter by checkout ID." }, "description": "Filter by checkout ID." }, { "name": "order_id", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "array", "items": { "type": "string", "format": "uuid4" } }, { "type": "null" } ], "title": "OrderID Filter", "description": "Filter by order ID." }, "description": "Filter by order ID." }, { "name": "status", "in": "query", "required": false, "schema": { "anyOf": [ { "$ref": "#/components/schemas/PaymentStatus" }, { "type": "array", "items": { "$ref": "#/components/schemas/PaymentStatus" } }, { "type": "null" } ], "title": "Status Filter", "description": "Filter by payment status." }, "description": "Filter by payment status." }, { "name": "method", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string" }, { "type": "array", "items": { "type": "string" } }, { "type": "null" } ], "title": "Method Filter", "description": "Filter by payment method." }, "description": "Filter by payment method." }, { "name": "customer_email", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string" }, { "type": "array", "items": { "type": "string" } }, { "type": "null" } ], "title": "CustomerEmail Filter", "description": "Filter by customer email." }, "description": "Filter by customer email." }, { "name": "page", "in": "query", "required": false, "schema": { "type": "integer", "exclusiveMinimum": 0, "description": "Page number, defaults to 1.", "default": 1, "title": "Page" }, "description": "Page number, defaults to 1." }, { "name": "limit", "in": "query", "required": false, "schema": { "type": "integer", "exclusiveMinimum": 0, "description": "Size of a page, defaults to 10. Maximum is 100.", "default": 10, "title": "Limit" }, "description": "Size of a page, defaults to 10. Maximum is 100." }, { "name": "sorting", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "array", "items": { "$ref": "#/components/schemas/PaymentSortProperty" } }, { "type": "null" } ], "description": "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.", "default": [ "-created_at" ], "title": "Sorting" }, "description": "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." } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ListResource__" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-pagination": { "type": "offsetLimit", "inputs": [ { "name": "page", "in": "parameters", "type": "page" }, { "name": "limit", "in": "parameters", "type": "limit" } ], "outputs": { "results": "$.items", "numPages": "$.pagination.max_page" } }, "x-speakeasy-mcp": { "disabled": false, "scopes": [ "read", "payments" ] }, "x-speakeasy-group": "payments", "x-speakeasy-name-override": "list", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"github.com/polarsource/polar-go/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Payments.List(ctx, operations.PaymentsListRequest{\n OrganizationID: polargo.Pointer(operations.CreatePaymentsListQueryParamOrganizationIDFilterStr(\n \"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n )),\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.ListResource != nil {\n for {\n // handle items\n\n res, err = res.Next()\n\n if err != nil {\n // handle error\n }\n\n if res == nil {\n break\n }\n }\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.payments.list(organization_id=\"1dbfc517-0bbf-4301-9ba8-555ca42b9737\", page=1, limit=10)\n\n while res is not None:\n # Handle items\n\n res = res.next()" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.payments.list({\n organizationId: \"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n });\n\n for await (const page of result) {\n console.log(page);\n }\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\nuse Polar\\Models\\Operations;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n$request = new Operations\\PaymentsListRequest(\n organizationId: '1dbfc517-0bbf-4301-9ba8-555ca42b9737',\n);\n\n$responses = $sdk->payments->list(\n request: $request\n);\n\n\nforeach ($responses as $response) {\n if ($response->statusCode === 200) {\n // handle response\n }\n}" } ] } }, "/v1/payments/{id}": { "get": { "tags": [ "payments", "public", "mcp" ], "summary": "Get Payment", "description": "Get a payment by ID.\n\n**Scopes**: `payments:read`", "operationId": "payments:get", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid4", "description": "The payment ID.", "title": "Id" }, "description": "The payment ID." } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Payment" } } } }, "404": { "description": "Payment not found.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ResourceNotFound" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "x-polar-allowed-subjects": [ "Organization", "User" ], "x-speakeasy-mcp": { "disabled": false, "scopes": [ "read", "payments" ] }, "x-speakeasy-group": "payments", "x-speakeasy-name-override": "get", "x-codeSamples": [ { "lang": "go", "label": "Go (SDK)", "source": "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tpolargo \"github.com/polarsource/polar-go\"\n\t\"log\"\n\t\"github.com/polarsource/polar-go/models/components\"\n)\n\nfunc main() {\n ctx := context.Background()\n\n s := polargo.New(\n polargo.WithSecurity(os.Getenv(\"POLAR_ACCESS_TOKEN\")),\n )\n\n res, err := s.Payments.Get(ctx, \"\")\n if err != nil {\n log.Fatal(err)\n }\n if res.Payment != nil {\n switch res.Payment.Type {\n case components.PaymentTypeCardPayment:\n // res.Payment.CardPayment is populated\n case components.PaymentTypeGenericPayment:\n // res.Payment.GenericPayment is populated\n }\n\n }\n}" }, { "lang": "python", "label": "Python (SDK)", "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.payments.get(id=\"\")\n\n # Handle response\n print(res)" }, { "lang": "typescript", "label": "Typescript (SDK)", "source": "import { Polar } from \"@polar-sh/sdk\";\n\nconst polar = new Polar({\n accessToken: process.env[\"POLAR_ACCESS_TOKEN\"] ?? \"\",\n});\n\nasync function run() {\n const result = await polar.payments.get({\n id: \"\",\n });\n\n console.log(result);\n}\n\nrun();" }, { "lang": "php", "label": "PHP (SDK)", "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Polar;\n\n$sdk = Polar\\Polar::builder()\n ->setSecurity(\n ''\n )\n ->build();\n\n\n\n$response = $sdk->payments->get(\n id: ''\n);\n\nif ($response->payment !== null) {\n // handle response\n}" } ] } } }, "webhooks": { "checkout.created": { "post": { "summary": "checkout.created", "description": "Sent when a new checkout is created.\n\n**Discord & Slack support:** Basic", "operationId": "_endpointcheckout_created_post", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/WebhookCheckoutCreatedPayload" } } }, "required": true }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "checkout.updated": { "post": { "summary": "checkout.updated", "description": "Sent when a checkout is updated.\n\n**Discord & Slack support:** Basic", "operationId": "_endpointcheckout_updated_post", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/WebhookCheckoutUpdatedPayload" } } }, "required": true }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "checkout.expired": { "post": { "summary": "checkout.expired", "description": "Sent when a checkout expires.\n\nThis event fires when a checkout reaches its expiration time without being completed.\nDevelopers can use this to send reminder emails or track checkout abandonment.\n\n**Discord & Slack support:** Basic", "operationId": "_endpointcheckout_expired_post", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/WebhookCheckoutExpiredPayload" } } }, "required": true }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "customer.created": { "post": { "summary": "customer.created", "description": "Sent when a new customer is created.\n\nA customer can be created:\n\n* After a successful checkout.\n* Programmatically via the API.\n\n**Discord & Slack support:** Basic", "operationId": "_endpointcustomer_created_post", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/WebhookCustomerCreatedPayload" } } }, "required": true }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "customer.updated": { "post": { "summary": "customer.updated", "description": "Sent when a customer is updated.\n\nThis event is fired when the customer details are updated.\n\nIf you want to be notified when a customer subscription or benefit state changes, you should listen to the `customer_state_changed` event.\n\n**Discord & Slack support:** Basic", "operationId": "_endpointcustomer_updated_post", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/WebhookCustomerUpdatedPayload" } } }, "required": true }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "customer.deleted": { "post": { "summary": "customer.deleted", "description": "Sent when a customer is deleted.\n\n**Discord & Slack support:** Basic", "operationId": "_endpointcustomer_deleted_post", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/WebhookCustomerDeletedPayload" } } }, "required": true }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "customer.state_changed": { "post": { "summary": "customer.state_changed", "description": "Sent when a customer state has changed.\n\nIt's triggered when:\n\n* Customer is created, updated or deleted.\n* A subscription is created or updated.\n* A benefit is granted or revoked.\n\n**Discord & Slack support:** Basic", "operationId": "_endpointcustomer_state_changed_post", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/WebhookCustomerStateChangedPayload" } } }, "required": true }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "customer_seat.assigned": { "post": { "summary": "customer_seat.assigned", "description": "Sent when a new customer seat is assigned.\n\nThis event is triggered when a seat is assigned to a customer by the organization.\nThe customer will receive an invitation email to claim the seat.", "operationId": "_endpointcustomer_seat_assigned_post", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/WebhookCustomerSeatAssignedPayload" } } }, "required": true }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "customer_seat.claimed": { "post": { "summary": "customer_seat.claimed", "description": "Sent when a customer seat is claimed.\n\nThis event is triggered when a customer accepts the seat invitation and claims their access.", "operationId": "_endpointcustomer_seat_claimed_post", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/WebhookCustomerSeatClaimedPayload" } } }, "required": true }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "customer_seat.revoked": { "post": { "summary": "customer_seat.revoked", "description": "Sent when a customer seat is revoked.\n\nThis event is triggered when access to a seat is revoked, either manually by the organization or automatically when a subscription is canceled.", "operationId": "_endpointcustomer_seat_revoked_post", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/WebhookCustomerSeatRevokedPayload" } } }, "required": true }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "member.created": { "post": { "summary": "member.created", "description": "Sent when a new member is created.\n\nA member represents an individual within a customer (team).\nThis event is triggered when a member is added to a customer,\neither programmatically via the API or when an owner is automatically\ncreated for a new customer.\n\n**Discord & Slack support:** Basic", "operationId": "_endpointmember_created_post", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/WebhookMemberCreatedPayload" } } }, "required": true }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "member.updated": { "post": { "summary": "member.updated", "description": "Sent when a member is updated.\n\nThis event is triggered when member details are updated,\nsuch as their name or role within the customer.\n\n**Discord & Slack support:** Basic", "operationId": "_endpointmember_updated_post", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/WebhookMemberUpdatedPayload" } } }, "required": true }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "member.deleted": { "post": { "summary": "member.deleted", "description": "Sent when a member is deleted.\n\nThis event is triggered when a member is removed from a customer.\nAny active seats assigned to the member will be automatically revoked.\n\n**Discord & Slack support:** Basic", "operationId": "_endpointmember_deleted_post", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/WebhookMemberDeletedPayload" } } }, "required": true }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "order.created": { "post": { "summary": "order.created", "description": "Sent when a new order is created.\n\nA new order is created when:\n\n* A customer purchases a one-time product. In this case, `billing_reason` is set to `purchase`.\n* A customer starts a subscription. In this case, `billing_reason` is set to `subscription_create`.\n* A subscription is renewed. In this case, `billing_reason` is set to `subscription_cycle`.\n* A subscription is upgraded or downgraded with an immediate proration invoice. In this case, `billing_reason` is set to `subscription_update`.\n\n> [!WARNING]\n> The order might not be paid yet, so the `status` field might be `pending`.\n\n**Discord & Slack support:** Full", "operationId": "_endpointorder_created_post", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/WebhookOrderCreatedPayload" } } }, "required": true }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "order.updated": { "post": { "summary": "order.updated", "description": "Sent when an order is updated.\n\nAn order is updated when:\n\n* Its status changes, e.g. from `pending` to `paid`.\n* It's refunded, partially or fully.\n\n**Discord & Slack support:** Full", "operationId": "_endpointorder_updated_post", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/WebhookOrderUpdatedPayload" } } }, "required": true }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "order.paid": { "post": { "summary": "order.paid", "description": "Sent when an order is paid.\n\nWhen you receive this event, the order is fully processed and payment has been received.\n\n**Discord & Slack support:** Full", "operationId": "_endpointorder_paid_post", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/WebhookOrderPaidPayload" } } }, "required": true }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "order.refunded": { "post": { "summary": "order.refunded", "description": "Sent when an order is fully or partially refunded.\n\n**Discord & Slack support:** Full", "operationId": "_endpointorder_refunded_post", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/WebhookOrderRefundedPayload" } } }, "required": true }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "subscription.created": { "post": { "summary": "subscription.created", "description": "Sent when a new subscription is created.\n\nWhen this event occurs, the subscription `status` might not be `active` yet, as we can still have to wait for the first payment to be processed.\n\n**Discord & Slack support:** Full", "operationId": "_endpointsubscription_created_post", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/WebhookSubscriptionCreatedPayload" } } }, "required": true }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "subscription.updated": { "post": { "summary": "subscription.updated", "description": "Sent when a subscription is updated. This event fires for all changes to the subscription, including renewals.\n\nIf you want more specific events, you can listen to `subscription.active`, `subscription.canceled`, `subscription.past_due`, and `subscription.revoked`.\n\nTo listen specifically for renewals, you can listen to `order.created` events and check the `billing_reason` field.\n\n**Discord & Slack support:** On cancellation, past due, and revocation. Renewals are skipped.", "operationId": "_endpointsubscription_updated_post", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/WebhookSubscriptionUpdatedPayload" } } }, "required": true }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "subscription.active": { "post": { "summary": "subscription.active", "description": "Sent when a subscription becomes active,\nwhether because it's a new paid subscription or because payment was recovered.\n\n**Discord & Slack support:** Full", "operationId": "_endpointsubscription_active_post", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/WebhookSubscriptionActivePayload" } } }, "required": true }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "subscription.canceled": { "post": { "summary": "subscription.canceled", "description": "Sent when a subscription is canceled.\nCustomers might still have access until the end of the current period.\n\n**Discord & Slack support:** Full", "operationId": "_endpointsubscription_canceled_post", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/WebhookSubscriptionCanceledPayload" } } }, "required": true }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "subscription.uncanceled": { "post": { "summary": "subscription.uncanceled", "description": "Sent when a customer revokes a pending cancellation.\n\nWhen a customer cancels with \"at period end\", they retain access until the\nsubscription would renew. During this time, they can change their mind and\nundo the cancellation. This event is triggered when they do so.\n\n**Discord & Slack support:** Full", "operationId": "_endpointsubscription_uncanceled_post", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/WebhookSubscriptionUncanceledPayload" } } }, "required": true }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "subscription.revoked": { "post": { "summary": "subscription.revoked", "description": "Sent when a subscription is revoked and the user loses access immediately.\nHappens when the subscription is canceled or payment retries are exhausted (status becomes `unpaid`).\n\nFor payment failures that can still be recovered, see `subscription.past_due`.\n\n**Discord & Slack support:** Full", "operationId": "_endpointsubscription_revoked_post", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/WebhookSubscriptionRevokedPayload" } } }, "required": true }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "subscription.past_due": { "post": { "summary": "subscription.past_due", "description": "Sent when a subscription payment fails and the subscription enters `past_due` status.\n\nThis is a recoverable state - the customer can update their payment method to restore the subscription.\nBenefits may be revoked depending on the organization's grace period settings.\n\nIf payment retries are exhausted, a `subscription.revoked` event will be sent.\n\n**Discord & Slack support:** Full", "operationId": "_endpointsubscription_past_due_post", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/WebhookSubscriptionPastDuePayload" } } }, "required": true }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "refund.created": { "post": { "summary": "refund.created", "description": "Sent when a refund is created regardless of status.\n\n**Discord & Slack support:** Full", "operationId": "_endpointrefund_created_post", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/WebhookRefundCreatedPayload" } } }, "required": true }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "refund.updated": { "post": { "summary": "refund.updated", "description": "Sent when a refund is updated.\n\n**Discord & Slack support:** Full", "operationId": "_endpointrefund_updated_post", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/WebhookRefundUpdatedPayload" } } }, "required": true }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "product.created": { "post": { "summary": "product.created", "description": "Sent when a new product is created.\n\n**Discord & Slack support:** Basic", "operationId": "_endpointproduct_created_post", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/WebhookProductCreatedPayload" } } }, "required": true }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "product.updated": { "post": { "summary": "product.updated", "description": "Sent when a product is updated.\n\n**Discord & Slack support:** Basic", "operationId": "_endpointproduct_updated_post", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/WebhookProductUpdatedPayload" } } }, "required": true }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "organization.updated": { "post": { "summary": "organization.updated", "description": "Sent when a organization is updated.\n\n**Discord & Slack support:** Basic", "operationId": "_endpointorganization_updated_post", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/WebhookOrganizationUpdatedPayload" } } }, "required": true }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "benefit.created": { "post": { "summary": "benefit.created", "description": "Sent when a new benefit is created.\n\n**Discord & Slack support:** Basic", "operationId": "_endpointbenefit_created_post", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/WebhookBenefitCreatedPayload" } } }, "required": true }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "benefit.updated": { "post": { "summary": "benefit.updated", "description": "Sent when a benefit is updated.\n\n**Discord & Slack support:** Basic", "operationId": "_endpointbenefit_updated_post", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/WebhookBenefitUpdatedPayload" } } }, "required": true }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "benefit_grant.created": { "post": { "summary": "benefit_grant.created", "description": "Sent when a new benefit grant is created.\n\n**Discord & Slack support:** Basic", "operationId": "_endpointbenefit_grant_created_post", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/WebhookBenefitGrantCreatedPayload" } } }, "required": true }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "benefit_grant.updated": { "post": { "summary": "benefit_grant.updated", "description": "Sent when a benefit grant is updated.\n\n**Discord & Slack support:** Basic", "operationId": "_endpointbenefit_grant_updated_post", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/WebhookBenefitGrantUpdatedPayload" } } }, "required": true }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "benefit_grant.cycled": { "post": { "summary": "benefit_grant.cycled", "description": "Sent when a benefit grant is cycled,\nmeaning the related subscription has been renewed for another period.\n\n**Discord & Slack support:** Basic", "operationId": "_endpointbenefit_grant_cycled_post", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/WebhookBenefitGrantCycledPayload" } } }, "required": true }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "benefit_grant.revoked": { "post": { "summary": "benefit_grant.revoked", "description": "Sent when a benefit grant is revoked.\n\n**Discord & Slack support:** Basic", "operationId": "_endpointbenefit_grant_revoked_post", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/WebhookBenefitGrantRevokedPayload" } } }, "required": true }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } } }, "components": { "schemas": { "Address": { "properties": { "line1": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Line1" }, "line2": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Line2" }, "postal_code": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Postal Code" }, "city": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "City" }, "state": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "State" }, "country": { "type": "string", "enum": [ "AD", "AE", "AF", "AG", "AI", "AL", "AM", "AO", "AQ", "AR", "AS", "AT", "AU", "AW", "AX", "AZ", "BA", "BB", "BD", "BE", "BF", "BG", "BH", "BI", "BJ", "BL", "BM", "BN", "BO", "BQ", "BR", "BS", "BT", "BV", "BW", "BY", "BZ", "CA", "CC", "CD", "CF", "CG", "CH", "CI", "CK", "CL", "CM", "CN", "CO", "CR", "CU", "CV", "CW", "CX", "CY", "CZ", "DE", "DJ", "DK", "DM", "DO", "DZ", "EC", "EE", "EG", "EH", "ER", "ES", "ET", "FI", "FJ", "FK", "FM", "FO", "FR", "GA", "GB", "GD", "GE", "GF", "GG", "GH", "GI", "GL", "GM", "GN", "GP", "GQ", "GR", "GS", "GT", "GU", "GW", "GY", "HK", "HM", "HN", "HR", "HT", "HU", "ID", "IE", "IL", "IM", "IN", "IO", "IQ", "IR", "IS", "IT", "JE", "JM", "JO", "JP", "KE", "KG", "KH", "KI", "KM", "KN", "KP", "KR", "KW", "KY", "KZ", "LA", "LB", "LC", "LI", "LK", "LR", "LS", "LT", "LU", "LV", "LY", "MA", "MC", "MD", "ME", "MF", "MG", "MH", "MK", "ML", "MM", "MN", "MO", "MP", "MQ", "MR", "MS", "MT", "MU", "MV", "MW", "MX", "MY", "MZ", "NA", "NC", "NE", "NF", "NG", "NI", "NL", "NO", "NP", "NR", "NU", "NZ", "OM", "PA", "PE", "PF", "PG", "PH", "PK", "PL", "PM", "PN", "PR", "PS", "PT", "PW", "PY", "QA", "RE", "RO", "RS", "RU", "RW", "SA", "SB", "SC", "SD", "SE", "SG", "SH", "SI", "SJ", "SK", "SL", "SM", "SN", "SO", "SR", "SS", "ST", "SV", "SX", "SY", "SZ", "TC", "TD", "TF", "TG", "TH", "TJ", "TK", "TL", "TM", "TN", "TO", "TR", "TT", "TV", "TW", "TZ", "UA", "UG", "UM", "US", "UY", "UZ", "VA", "VC", "VE", "VG", "VI", "VN", "VU", "WF", "WS", "YE", "YT", "ZA", "ZM", "ZW" ], "title": "CountryAlpha2", "examples": [ "US", "SE", "FR" ], "x-speakeasy-enums": [ "AD", "AE", "AF", "AG", "AI", "AL", "AM", "AO", "AQ", "AR", "AS", "AT", "AU", "AW", "AX", "AZ", "BA", "BB", "BD", "BE", "BF", "BG", "BH", "BI", "BJ", "BL", "BM", "BN", "BO", "BQ", "BR", "BS", "BT", "BV", "BW", "BY", "BZ", "CA", "CC", "CD", "CF", "CG", "CH", "CI", "CK", "CL", "CM", "CN", "CO", "CR", "CU", "CV", "CW", "CX", "CY", "CZ", "DE", "DJ", "DK", "DM", "DO", "DZ", "EC", "EE", "EG", "EH", "ER", "ES", "ET", "FI", "FJ", "FK", "FM", "FO", "FR", "GA", "GB", "GD", "GE", "GF", "GG", "GH", "GI", "GL", "GM", "GN", "GP", "GQ", "GR", "GS", "GT", "GU", "GW", "GY", "HK", "HM", "HN", "HR", "HT", "HU", "ID", "IE", "IL", "IM", "IN", "IO", "IQ", "IR", "IS", "IT", "JE", "JM", "JO", "JP", "KE", "KG", "KH", "KI", "KM", "KN", "KP", "KR", "KW", "KY", "KZ", "LA", "LB", "LC", "LI", "LK", "LR", "LS", "LT", "LU", "LV", "LY", "MA", "MC", "MD", "ME", "MF", "MG", "MH", "MK", "ML", "MM", "MN", "MO", "MP", "MQ", "MR", "MS", "MT", "MU", "MV", "MW", "MX", "MY", "MZ", "NA", "NC", "NE", "NF", "NG", "NI", "NL", "NO", "NP", "NR", "NU", "NZ", "OM", "PA", "PE", "PF", "PG", "PH", "PK", "PL", "PM", "PN", "PR", "PS", "PT", "PW", "PY", "QA", "RE", "RO", "RS", "RU", "RW", "SA", "SB", "SC", "SD", "SE", "SG", "SH", "SI", "SJ", "SK", "SL", "SM", "SN", "SO", "SR", "SS", "ST", "SV", "SX", "SY", "SZ", "TC", "TD", "TF", "TG", "TH", "TJ", "TK", "TL", "TM", "TN", "TO", "TR", "TT", "TV", "TW", "TZ", "UA", "UG", "UM", "US", "UY", "UZ", "VA", "VC", "VE", "VG", "VI", "VN", "VU", "WF", "WS", "YE", "YT", "ZA", "ZM", "ZW" ] } }, "type": "object", "required": [ "country" ], "title": "Address" }, "AddressDict": { "properties": { "line1": { "type": "string", "title": "Line1" }, "line2": { "type": "string", "title": "Line2" }, "postal_code": { "type": "string", "title": "Postal Code" }, "city": { "type": "string", "title": "City" }, "state": { "type": "string", "title": "State" }, "country": { "type": "string", "title": "Country" } }, "type": "object", "required": [ "country" ], "title": "AddressDict" }, "AddressInput": { "properties": { "line1": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Line1" }, "line2": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Line2" }, "postal_code": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Postal Code" }, "city": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "City" }, "state": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "State" }, "country": { "type": "string", "enum": [ "AD", "AE", "AF", "AG", "AI", "AL", "AM", "AO", "AQ", "AR", "AS", "AT", "AU", "AW", "AX", "AZ", "BA", "BB", "BD", "BE", "BF", "BG", "BH", "BI", "BJ", "BL", "BM", "BN", "BO", "BQ", "BR", "BS", "BT", "BV", "BW", "BY", "BZ", "CA", "CC", "CD", "CF", "CG", "CH", "CI", "CK", "CL", "CM", "CN", "CO", "CR", "CV", "CW", "CX", "CY", "CZ", "DE", "DJ", "DK", "DM", "DO", "DZ", "EC", "EE", "EG", "EH", "ER", "ES", "ET", "FI", "FJ", "FK", "FM", "FO", "FR", "GA", "GB", "GD", "GE", "GF", "GG", "GH", "GI", "GL", "GM", "GN", "GP", "GQ", "GR", "GS", "GT", "GU", "GW", "GY", "HK", "HM", "HN", "HR", "HT", "HU", "ID", "IE", "IL", "IM", "IN", "IO", "IQ", "IS", "IT", "JE", "JM", "JO", "JP", "KE", "KG", "KH", "KI", "KM", "KN", "KR", "KW", "KY", "KZ", "LA", "LB", "LC", "LI", "LK", "LR", "LS", "LT", "LU", "LV", "LY", "MA", "MC", "MD", "ME", "MF", "MG", "MH", "MK", "ML", "MM", "MN", "MO", "MP", "MQ", "MR", "MS", "MT", "MU", "MV", "MW", "MX", "MY", "MZ", "NA", "NC", "NE", "NF", "NG", "NI", "NL", "NO", "NP", "NR", "NU", "NZ", "OM", "PA", "PE", "PF", "PG", "PH", "PK", "PL", "PM", "PN", "PR", "PS", "PT", "PW", "PY", "QA", "RE", "RO", "RS", "RW", "SA", "SB", "SC", "SD", "SE", "SG", "SH", "SI", "SJ", "SK", "SL", "SM", "SN", "SO", "SR", "SS", "ST", "SV", "SX", "SZ", "TC", "TD", "TF", "TG", "TH", "TJ", "TK", "TL", "TM", "TN", "TO", "TR", "TT", "TV", "TW", "TZ", "UA", "UG", "UM", "US", "UY", "UZ", "VA", "VC", "VE", "VG", "VI", "VN", "VU", "WF", "WS", "YE", "YT", "ZA", "ZM", "ZW" ], "title": "CountryAlpha2Input", "examples": [ "US", "SE", "FR" ], "x-speakeasy-enums": [ "AD", "AE", "AF", "AG", "AI", "AL", "AM", "AO", "AQ", "AR", "AS", "AT", "AU", "AW", "AX", "AZ", "BA", "BB", "BD", "BE", "BF", "BG", "BH", "BI", "BJ", "BL", "BM", "BN", "BO", "BQ", "BR", "BS", "BT", "BV", "BW", "BY", "BZ", "CA", "CC", "CD", "CF", "CG", "CH", "CI", "CK", "CL", "CM", "CN", "CO", "CR", "CV", "CW", "CX", "CY", "CZ", "DE", "DJ", "DK", "DM", "DO", "DZ", "EC", "EE", "EG", "EH", "ER", "ES", "ET", "FI", "FJ", "FK", "FM", "FO", "FR", "GA", "GB", "GD", "GE", "GF", "GG", "GH", "GI", "GL", "GM", "GN", "GP", "GQ", "GR", "GS", "GT", "GU", "GW", "GY", "HK", "HM", "HN", "HR", "HT", "HU", "ID", "IE", "IL", "IM", "IN", "IO", "IQ", "IS", "IT", "JE", "JM", "JO", "JP", "KE", "KG", "KH", "KI", "KM", "KN", "KR", "KW", "KY", "KZ", "LA", "LB", "LC", "LI", "LK", "LR", "LS", "LT", "LU", "LV", "LY", "MA", "MC", "MD", "ME", "MF", "MG", "MH", "MK", "ML", "MM", "MN", "MO", "MP", "MQ", "MR", "MS", "MT", "MU", "MV", "MW", "MX", "MY", "MZ", "NA", "NC", "NE", "NF", "NG", "NI", "NL", "NO", "NP", "NR", "NU", "NZ", "OM", "PA", "PE", "PF", "PG", "PH", "PK", "PL", "PM", "PN", "PR", "PS", "PT", "PW", "PY", "QA", "RE", "RO", "RS", "RW", "SA", "SB", "SC", "SD", "SE", "SG", "SH", "SI", "SJ", "SK", "SL", "SM", "SN", "SO", "SR", "SS", "ST", "SV", "SX", "SZ", "TC", "TD", "TF", "TG", "TH", "TJ", "TK", "TL", "TM", "TN", "TO", "TR", "TT", "TV", "TW", "TZ", "UA", "UG", "UM", "US", "UY", "UZ", "VA", "VC", "VE", "VG", "VI", "VN", "VU", "WF", "WS", "YE", "YT", "ZA", "ZM", "ZW" ] } }, "type": "object", "required": [ "country" ], "title": "AddressInput" }, "AggregateField": { "type": "string", "maxLength": 255, "minLength": 1 }, "AggregationFunction": { "type": "string", "enum": [ "count", "sum", "max", "min", "avg", "unique" ], "title": "AggregationFunction" }, "AlreadyActiveSubscriptionError": { "properties": { "error": { "type": "string", "const": "AlreadyActiveSubscriptionError", "title": "Error", "examples": [ "AlreadyActiveSubscriptionError" ] }, "detail": { "type": "string", "title": "Detail" } }, "type": "object", "required": [ "error", "detail" ], "title": "AlreadyActiveSubscriptionError" }, "AlreadyCanceledSubscription": { "properties": { "error": { "type": "string", "const": "AlreadyCanceledSubscription", "title": "Error", "examples": [ "AlreadyCanceledSubscription" ] }, "detail": { "type": "string", "title": "Detail" } }, "type": "object", "required": [ "error", "detail" ], "title": "AlreadyCanceledSubscription" }, "AttachedCustomField": { "properties": { "custom_field_id": { "type": "string", "format": "uuid4", "title": "Custom Field Id", "description": "ID of the custom field." }, "custom_field": { "$ref": "#/components/schemas/CustomField", "title": "CustomField" }, "order": { "type": "integer", "title": "Order", "description": "Order of the custom field in the resource." }, "required": { "type": "boolean", "title": "Required", "description": "Whether the value is required for this custom field." } }, "type": "object", "required": [ "custom_field_id", "custom_field", "order", "required" ], "title": "AttachedCustomField", "description": "Schema of a custom field attached to a resource." }, "AttachedCustomFieldCreate": { "properties": { "custom_field_id": { "type": "string", "format": "uuid4", "title": "Custom Field Id", "description": "ID of the custom field to attach." }, "required": { "type": "boolean", "title": "Required", "description": "Whether the value is required for this custom field." } }, "type": "object", "required": [ "custom_field_id", "required" ], "title": "AttachedCustomFieldCreate", "description": "Schema to attach a custom field to a resource." }, "AuthorizeOrganization": { "properties": { "id": { "type": "string", "format": "uuid4", "title": "Id" }, "slug": { "type": "string", "title": "Slug" }, "avatar_url": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Avatar Url" } }, "type": "object", "required": [ "id", "slug", "avatar_url" ], "title": "AuthorizeOrganization" }, "AuthorizeResponseOrganization": { "properties": { "client": { "$ref": "#/components/schemas/OAuth2ClientPublic" }, "sub_type": { "type": "string", "const": "organization", "title": "Sub Type" }, "sub": { "anyOf": [ { "$ref": "#/components/schemas/AuthorizeOrganization" }, { "type": "null" } ] }, "scopes": { "items": { "$ref": "#/components/schemas/Scope" }, "type": "array", "title": "Scopes" }, "scope_display_names": { "additionalProperties": { "type": "string" }, "type": "object", "title": "Scope Display Names", "default": { "openid": "OpenID", "profile": "Read your profile", "email": "Read your email address", "web:read": "Web Read Access", "web:write": "Web Write Access", "user:read": "User Read", "user:write": "Delete your user account", "organizations:read": "Read your organizations", "organizations:write": "Create or modify organizations", "custom_fields:read": "Read custom fields", "custom_fields:write": "Create or modify custom fields", "discounts:read": "Read discounts", "discounts:write": "Create or modify discounts", "checkout_links:read": "Read checkout links", "checkout_links:write": "Create or modify checkout links", "checkouts:read": "Read checkout sessions", "checkouts:write": "Create or modify checkout sessions", "transactions:read": "Read transactions", "transactions:write": "Create or modify transactions", "payouts:read": "Read payouts", "payouts:write": "Create or modify payouts", "products:read": "Read products", "products:write": "Create or modify products", "benefits:read": "Read benefits", "benefits:write": "Create or modify benefits", "events:read": "Read events", "events:write": "Create events", "meters:read": "Read meters", "meters:write": "Create or modify meters", "files:read": "Read file uploads", "files:write": "Create or modify file uploads", "subscriptions:read": "Read subscriptions made on your organizations", "subscriptions:write": "Create or modify subscriptions made on your organizations", "customers:read": "Read customers", "customers:write": "Create or modify customers", "members:read": "Read members", "members:write": "Create or modify members", "wallets:read": "Read wallets", "wallets:write": "Create or modify wallets", "disputes:read": "Read disputes", "customer_meters:read": "Read customer meters", "customer_sessions:write": "Create or modify customer sessions", "member_sessions:write": "Create or modify member sessions", "customer_seats:read": "Read customer seats", "customer_seats:write": "Create or modify customer seats", "orders:read": "Read orders made on your organizations", "orders:write": "Modify orders made on your organizations", "refunds:read": "Read refunds made on your organizations", "refunds:write": "Create or modify refunds", "payments:read": "Read payments made on your organizations", "metrics:read": "Read metrics", "webhooks:read": "Read webhooks", "webhooks:write": "Create or modify webhooks", "license_keys:read": "Read license keys", "license_keys:write": "Modify license keys", "customer_portal:read": "Read your orders, subscriptions and benefits", "customer_portal:write": "Create or modify your orders, subscriptions and benefits", "notifications:read": "Read notifications", "notifications:write": "Mark notifications as read", "notification_recipients:read": "Read notification recipients", "notification_recipients:write": "Create or modify notification recipients", "organization_access_tokens:read": "Read organization access tokens", "organization_access_tokens:write": "Create or modify organization access tokens" } }, "organizations": { "items": { "$ref": "#/components/schemas/AuthorizeOrganization" }, "type": "array", "title": "Organizations" } }, "type": "object", "required": [ "client", "sub_type", "sub", "scopes", "organizations" ], "title": "AuthorizeResponseOrganization" }, "AuthorizeResponseUser": { "properties": { "client": { "$ref": "#/components/schemas/OAuth2ClientPublic" }, "sub_type": { "type": "string", "const": "user", "title": "Sub Type" }, "sub": { "anyOf": [ { "$ref": "#/components/schemas/AuthorizeUser" }, { "type": "null" } ] }, "scopes": { "items": { "$ref": "#/components/schemas/Scope" }, "type": "array", "title": "Scopes" }, "scope_display_names": { "additionalProperties": { "type": "string" }, "type": "object", "title": "Scope Display Names", "default": { "openid": "OpenID", "profile": "Read your profile", "email": "Read your email address", "web:read": "Web Read Access", "web:write": "Web Write Access", "user:read": "User Read", "user:write": "Delete your user account", "organizations:read": "Read your organizations", "organizations:write": "Create or modify organizations", "custom_fields:read": "Read custom fields", "custom_fields:write": "Create or modify custom fields", "discounts:read": "Read discounts", "discounts:write": "Create or modify discounts", "checkout_links:read": "Read checkout links", "checkout_links:write": "Create or modify checkout links", "checkouts:read": "Read checkout sessions", "checkouts:write": "Create or modify checkout sessions", "transactions:read": "Read transactions", "transactions:write": "Create or modify transactions", "payouts:read": "Read payouts", "payouts:write": "Create or modify payouts", "products:read": "Read products", "products:write": "Create or modify products", "benefits:read": "Read benefits", "benefits:write": "Create or modify benefits", "events:read": "Read events", "events:write": "Create events", "meters:read": "Read meters", "meters:write": "Create or modify meters", "files:read": "Read file uploads", "files:write": "Create or modify file uploads", "subscriptions:read": "Read subscriptions made on your organizations", "subscriptions:write": "Create or modify subscriptions made on your organizations", "customers:read": "Read customers", "customers:write": "Create or modify customers", "members:read": "Read members", "members:write": "Create or modify members", "wallets:read": "Read wallets", "wallets:write": "Create or modify wallets", "disputes:read": "Read disputes", "customer_meters:read": "Read customer meters", "customer_sessions:write": "Create or modify customer sessions", "member_sessions:write": "Create or modify member sessions", "customer_seats:read": "Read customer seats", "customer_seats:write": "Create or modify customer seats", "orders:read": "Read orders made on your organizations", "orders:write": "Modify orders made on your organizations", "refunds:read": "Read refunds made on your organizations", "refunds:write": "Create or modify refunds", "payments:read": "Read payments made on your organizations", "metrics:read": "Read metrics", "webhooks:read": "Read webhooks", "webhooks:write": "Create or modify webhooks", "license_keys:read": "Read license keys", "license_keys:write": "Modify license keys", "customer_portal:read": "Read your orders, subscriptions and benefits", "customer_portal:write": "Create or modify your orders, subscriptions and benefits", "notifications:read": "Read notifications", "notifications:write": "Mark notifications as read", "notification_recipients:read": "Read notification recipients", "notification_recipients:write": "Create or modify notification recipients", "organization_access_tokens:read": "Read organization access tokens", "organization_access_tokens:write": "Create or modify organization access tokens" } } }, "type": "object", "required": [ "client", "sub_type", "sub", "scopes" ], "title": "AuthorizeResponseUser" }, "AuthorizeUser": { "properties": { "id": { "type": "string", "format": "uuid4", "title": "Id" }, "email": { "type": "string", "format": "email", "title": "Email" }, "avatar_url": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Avatar Url" } }, "type": "object", "required": [ "id", "email", "avatar_url" ], "title": "AuthorizeUser" }, "AvailableScope": { "type": "string", "enum": [ "openid", "profile", "email", "user:read", "user:write", "organizations:read", "organizations:write", "custom_fields:read", "custom_fields:write", "discounts:read", "discounts:write", "checkout_links:read", "checkout_links:write", "checkouts:read", "checkouts:write", "transactions:read", "transactions:write", "payouts:read", "payouts:write", "products:read", "products:write", "benefits:read", "benefits:write", "events:read", "events:write", "meters:read", "meters:write", "files:read", "files:write", "subscriptions:read", "subscriptions:write", "customers:read", "customers:write", "members:read", "members:write", "wallets:read", "wallets:write", "disputes:read", "customer_meters:read", "customer_sessions:write", "member_sessions:write", "customer_seats:read", "customer_seats:write", "orders:read", "orders:write", "refunds:read", "refunds:write", "payments:read", "metrics:read", "webhooks:read", "webhooks:write", "license_keys:read", "license_keys:write", "customer_portal:read", "customer_portal:write", "notifications:read", "notifications:write", "notification_recipients:read", "notification_recipients:write", "organization_access_tokens:read", "organization_access_tokens:write" ], "title": "AvailableScope" }, "BalanceCreditOrderEvent": { "properties": { "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "timestamp": { "type": "string", "format": "date-time", "title": "Timestamp", "description": "The timestamp of the event." }, "organization_id": { "type": "string", "format": "uuid4", "title": "Organization Id", "description": "The ID of the organization owning the event.", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "x-polar-selector-widget": { "displayProperty": "name", "resourceName": "Organization", "resourceRoot": "/v1/organizations" } }, "customer_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Customer Id", "description": "ID of the customer in your Polar organization associated with the event." }, "customer": { "anyOf": [ { "$ref": "#/components/schemas/Customer" }, { "type": "null" } ], "description": "The customer associated with the event." }, "external_customer_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "External Customer Id", "description": "ID of the customer in your system associated with the event." }, "member_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Member Id", "description": "ID of the member within the customer's organization who performed the action inside B2B." }, "external_member_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "External Member Id", "description": "ID of the member in your system within the customer's organization who performed the action inside B2B." }, "child_count": { "type": "integer", "title": "Child Count", "description": "Number of direct child events linked to this event.", "default": 0 }, "parent_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Parent Id", "description": "The ID of the parent event." }, "label": { "type": "string", "title": "Label", "description": "Human readable label of the event type." }, "source": { "type": "string", "const": "system", "title": "Source", "description": "The source of the event. `system` events are created by Polar. `user` events are the one you create through our ingestion API." }, "name": { "type": "string", "const": "balance.credit_order", "title": "Name", "description": "The name of the event." }, "metadata": { "$ref": "#/components/schemas/BalanceCreditOrderMetadata" } }, "type": "object", "required": [ "id", "timestamp", "organization_id", "customer_id", "customer", "external_customer_id", "label", "source", "name", "metadata" ], "title": "BalanceCreditOrderEvent", "description": "An event created by Polar when an order is paid via customer balance." }, "BalanceCreditOrderMetadata": { "properties": { "order_id": { "type": "string", "title": "Order Id" }, "product_id": { "type": "string", "title": "Product Id" }, "subscription_id": { "type": "string", "title": "Subscription Id" }, "amount": { "type": "integer", "title": "Amount" }, "currency": { "type": "string", "title": "Currency" }, "tax_amount": { "type": "integer", "title": "Tax Amount" }, "tax_state": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Tax State" }, "tax_country": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Tax Country" }, "fee": { "type": "integer", "title": "Fee" } }, "type": "object", "required": [ "order_id", "amount", "currency", "tax_amount", "fee" ], "title": "BalanceCreditOrderMetadata" }, "BalanceDisputeEvent": { "properties": { "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "timestamp": { "type": "string", "format": "date-time", "title": "Timestamp", "description": "The timestamp of the event." }, "organization_id": { "type": "string", "format": "uuid4", "title": "Organization Id", "description": "The ID of the organization owning the event.", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "x-polar-selector-widget": { "displayProperty": "name", "resourceName": "Organization", "resourceRoot": "/v1/organizations" } }, "customer_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Customer Id", "description": "ID of the customer in your Polar organization associated with the event." }, "customer": { "anyOf": [ { "$ref": "#/components/schemas/Customer" }, { "type": "null" } ], "description": "The customer associated with the event." }, "external_customer_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "External Customer Id", "description": "ID of the customer in your system associated with the event." }, "member_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Member Id", "description": "ID of the member within the customer's organization who performed the action inside B2B." }, "external_member_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "External Member Id", "description": "ID of the member in your system within the customer's organization who performed the action inside B2B." }, "child_count": { "type": "integer", "title": "Child Count", "description": "Number of direct child events linked to this event.", "default": 0 }, "parent_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Parent Id", "description": "The ID of the parent event." }, "label": { "type": "string", "title": "Label", "description": "Human readable label of the event type." }, "source": { "type": "string", "const": "system", "title": "Source", "description": "The source of the event. `system` events are created by Polar. `user` events are the one you create through our ingestion API." }, "name": { "type": "string", "const": "balance.dispute", "title": "Name", "description": "The name of the event." }, "metadata": { "$ref": "#/components/schemas/BalanceDisputeMetadata" } }, "type": "object", "required": [ "id", "timestamp", "organization_id", "customer_id", "customer", "external_customer_id", "label", "source", "name", "metadata" ], "title": "BalanceDisputeEvent", "description": "An event created by Polar when an order is disputed." }, "BalanceDisputeMetadata": { "properties": { "transaction_id": { "type": "string", "title": "Transaction Id" }, "dispute_id": { "type": "string", "title": "Dispute Id" }, "order_id": { "type": "string", "title": "Order Id" }, "order_created_at": { "type": "string", "title": "Order Created At" }, "product_id": { "type": "string", "title": "Product Id" }, "subscription_id": { "type": "string", "title": "Subscription Id" }, "amount": { "type": "integer", "title": "Amount" }, "currency": { "type": "string", "title": "Currency" }, "presentment_amount": { "type": "integer", "title": "Presentment Amount" }, "presentment_currency": { "type": "string", "title": "Presentment Currency" }, "tax_amount": { "type": "integer", "title": "Tax Amount" }, "tax_state": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Tax State" }, "tax_country": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Tax Country" }, "fee": { "type": "integer", "title": "Fee" }, "exchange_rate": { "type": "number", "title": "Exchange Rate" } }, "type": "object", "required": [ "transaction_id", "dispute_id", "amount", "currency", "presentment_amount", "presentment_currency", "tax_amount", "fee" ], "title": "BalanceDisputeMetadata" }, "BalanceDisputeReversalEvent": { "properties": { "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "timestamp": { "type": "string", "format": "date-time", "title": "Timestamp", "description": "The timestamp of the event." }, "organization_id": { "type": "string", "format": "uuid4", "title": "Organization Id", "description": "The ID of the organization owning the event.", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "x-polar-selector-widget": { "displayProperty": "name", "resourceName": "Organization", "resourceRoot": "/v1/organizations" } }, "customer_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Customer Id", "description": "ID of the customer in your Polar organization associated with the event." }, "customer": { "anyOf": [ { "$ref": "#/components/schemas/Customer" }, { "type": "null" } ], "description": "The customer associated with the event." }, "external_customer_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "External Customer Id", "description": "ID of the customer in your system associated with the event." }, "member_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Member Id", "description": "ID of the member within the customer's organization who performed the action inside B2B." }, "external_member_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "External Member Id", "description": "ID of the member in your system within the customer's organization who performed the action inside B2B." }, "child_count": { "type": "integer", "title": "Child Count", "description": "Number of direct child events linked to this event.", "default": 0 }, "parent_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Parent Id", "description": "The ID of the parent event." }, "label": { "type": "string", "title": "Label", "description": "Human readable label of the event type." }, "source": { "type": "string", "const": "system", "title": "Source", "description": "The source of the event. `system` events are created by Polar. `user` events are the one you create through our ingestion API." }, "name": { "type": "string", "const": "balance.dispute_reversal", "title": "Name", "description": "The name of the event." }, "metadata": { "$ref": "#/components/schemas/BalanceDisputeMetadata" } }, "type": "object", "required": [ "id", "timestamp", "organization_id", "customer_id", "customer", "external_customer_id", "label", "source", "name", "metadata" ], "title": "BalanceDisputeReversalEvent", "description": "An event created by Polar when a dispute is won and funds are reinstated." }, "BalanceOrderEvent": { "properties": { "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "timestamp": { "type": "string", "format": "date-time", "title": "Timestamp", "description": "The timestamp of the event." }, "organization_id": { "type": "string", "format": "uuid4", "title": "Organization Id", "description": "The ID of the organization owning the event.", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "x-polar-selector-widget": { "displayProperty": "name", "resourceName": "Organization", "resourceRoot": "/v1/organizations" } }, "customer_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Customer Id", "description": "ID of the customer in your Polar organization associated with the event." }, "customer": { "anyOf": [ { "$ref": "#/components/schemas/Customer" }, { "type": "null" } ], "description": "The customer associated with the event." }, "external_customer_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "External Customer Id", "description": "ID of the customer in your system associated with the event." }, "member_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Member Id", "description": "ID of the member within the customer's organization who performed the action inside B2B." }, "external_member_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "External Member Id", "description": "ID of the member in your system within the customer's organization who performed the action inside B2B." }, "child_count": { "type": "integer", "title": "Child Count", "description": "Number of direct child events linked to this event.", "default": 0 }, "parent_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Parent Id", "description": "The ID of the parent event." }, "label": { "type": "string", "title": "Label", "description": "Human readable label of the event type." }, "source": { "type": "string", "const": "system", "title": "Source", "description": "The source of the event. `system` events are created by Polar. `user` events are the one you create through our ingestion API." }, "name": { "type": "string", "const": "balance.order", "title": "Name", "description": "The name of the event." }, "metadata": { "$ref": "#/components/schemas/BalanceOrderMetadata" } }, "type": "object", "required": [ "id", "timestamp", "organization_id", "customer_id", "customer", "external_customer_id", "label", "source", "name", "metadata" ], "title": "BalanceOrderEvent", "description": "An event created by Polar when an order is paid." }, "BalanceOrderMetadata": { "properties": { "transaction_id": { "type": "string", "title": "Transaction Id" }, "order_id": { "type": "string", "title": "Order Id" }, "product_id": { "type": "string", "title": "Product Id" }, "subscription_id": { "type": "string", "title": "Subscription Id" }, "amount": { "type": "integer", "title": "Amount" }, "net_amount": { "type": "integer", "title": "Net Amount" }, "currency": { "type": "string", "title": "Currency" }, "presentment_amount": { "type": "integer", "title": "Presentment Amount" }, "presentment_currency": { "type": "string", "title": "Presentment Currency" }, "tax_amount": { "type": "integer", "title": "Tax Amount" }, "tax_state": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Tax State" }, "tax_country": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Tax Country" }, "fee": { "type": "integer", "title": "Fee" }, "exchange_rate": { "type": "number", "title": "Exchange Rate" } }, "type": "object", "required": [ "transaction_id", "order_id", "amount", "currency", "presentment_amount", "presentment_currency", "tax_amount", "fee" ], "title": "BalanceOrderMetadata" }, "BalanceRefundEvent": { "properties": { "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "timestamp": { "type": "string", "format": "date-time", "title": "Timestamp", "description": "The timestamp of the event." }, "organization_id": { "type": "string", "format": "uuid4", "title": "Organization Id", "description": "The ID of the organization owning the event.", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "x-polar-selector-widget": { "displayProperty": "name", "resourceName": "Organization", "resourceRoot": "/v1/organizations" } }, "customer_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Customer Id", "description": "ID of the customer in your Polar organization associated with the event." }, "customer": { "anyOf": [ { "$ref": "#/components/schemas/Customer" }, { "type": "null" } ], "description": "The customer associated with the event." }, "external_customer_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "External Customer Id", "description": "ID of the customer in your system associated with the event." }, "member_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Member Id", "description": "ID of the member within the customer's organization who performed the action inside B2B." }, "external_member_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "External Member Id", "description": "ID of the member in your system within the customer's organization who performed the action inside B2B." }, "child_count": { "type": "integer", "title": "Child Count", "description": "Number of direct child events linked to this event.", "default": 0 }, "parent_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Parent Id", "description": "The ID of the parent event." }, "label": { "type": "string", "title": "Label", "description": "Human readable label of the event type." }, "source": { "type": "string", "const": "system", "title": "Source", "description": "The source of the event. `system` events are created by Polar. `user` events are the one you create through our ingestion API." }, "name": { "type": "string", "const": "balance.refund", "title": "Name", "description": "The name of the event." }, "metadata": { "$ref": "#/components/schemas/BalanceRefundMetadata" } }, "type": "object", "required": [ "id", "timestamp", "organization_id", "customer_id", "customer", "external_customer_id", "label", "source", "name", "metadata" ], "title": "BalanceRefundEvent", "description": "An event created by Polar when an order is refunded." }, "BalanceRefundMetadata": { "properties": { "transaction_id": { "type": "string", "title": "Transaction Id" }, "refund_id": { "type": "string", "title": "Refund Id" }, "order_id": { "type": "string", "title": "Order Id" }, "order_created_at": { "type": "string", "title": "Order Created At" }, "product_id": { "type": "string", "title": "Product Id" }, "subscription_id": { "type": "string", "title": "Subscription Id" }, "amount": { "type": "integer", "title": "Amount" }, "currency": { "type": "string", "title": "Currency" }, "presentment_amount": { "type": "integer", "title": "Presentment Amount" }, "presentment_currency": { "type": "string", "title": "Presentment Currency" }, "refundable_amount": { "type": "integer", "title": "Refundable Amount" }, "tax_amount": { "type": "integer", "title": "Tax Amount" }, "tax_state": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Tax State" }, "tax_country": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Tax Country" }, "fee": { "type": "integer", "title": "Fee" }, "exchange_rate": { "type": "number", "title": "Exchange Rate" } }, "type": "object", "required": [ "transaction_id", "refund_id", "amount", "currency", "presentment_amount", "presentment_currency", "tax_amount", "fee" ], "title": "BalanceRefundMetadata" }, "BalanceRefundReversalEvent": { "properties": { "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "timestamp": { "type": "string", "format": "date-time", "title": "Timestamp", "description": "The timestamp of the event." }, "organization_id": { "type": "string", "format": "uuid4", "title": "Organization Id", "description": "The ID of the organization owning the event.", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "x-polar-selector-widget": { "displayProperty": "name", "resourceName": "Organization", "resourceRoot": "/v1/organizations" } }, "customer_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Customer Id", "description": "ID of the customer in your Polar organization associated with the event." }, "customer": { "anyOf": [ { "$ref": "#/components/schemas/Customer" }, { "type": "null" } ], "description": "The customer associated with the event." }, "external_customer_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "External Customer Id", "description": "ID of the customer in your system associated with the event." }, "member_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Member Id", "description": "ID of the member within the customer's organization who performed the action inside B2B." }, "external_member_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "External Member Id", "description": "ID of the member in your system within the customer's organization who performed the action inside B2B." }, "child_count": { "type": "integer", "title": "Child Count", "description": "Number of direct child events linked to this event.", "default": 0 }, "parent_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Parent Id", "description": "The ID of the parent event." }, "label": { "type": "string", "title": "Label", "description": "Human readable label of the event type." }, "source": { "type": "string", "const": "system", "title": "Source", "description": "The source of the event. `system` events are created by Polar. `user` events are the one you create through our ingestion API." }, "name": { "type": "string", "const": "balance.refund_reversal", "title": "Name", "description": "The name of the event." }, "metadata": { "$ref": "#/components/schemas/BalanceRefundMetadata" } }, "type": "object", "required": [ "id", "timestamp", "organization_id", "customer_id", "customer", "external_customer_id", "label", "source", "name", "metadata" ], "title": "BalanceRefundReversalEvent", "description": "An event created by Polar when a refund is reverted." }, "Benefit": { "oneOf": [ { "$ref": "#/components/schemas/BenefitCustom" }, { "$ref": "#/components/schemas/BenefitDiscord" }, { "$ref": "#/components/schemas/BenefitGitHubRepository" }, { "$ref": "#/components/schemas/BenefitDownloadables" }, { "$ref": "#/components/schemas/BenefitLicenseKeys" }, { "$ref": "#/components/schemas/BenefitMeterCredit" }, { "$ref": "#/components/schemas/BenefitFeatureFlag" } ], "discriminator": { "propertyName": "type", "mapping": { "custom": "#/components/schemas/BenefitCustom", "discord": "#/components/schemas/BenefitDiscord", "downloadables": "#/components/schemas/BenefitDownloadables", "feature_flag": "#/components/schemas/BenefitFeatureFlag", "github_repository": "#/components/schemas/BenefitGitHubRepository", "license_keys": "#/components/schemas/BenefitLicenseKeys", "meter_credit": "#/components/schemas/BenefitMeterCredit" } } }, "BenefitCreate": { "oneOf": [ { "$ref": "#/components/schemas/BenefitCustomCreate" }, { "$ref": "#/components/schemas/BenefitDiscordCreate" }, { "$ref": "#/components/schemas/BenefitGitHubRepositoryCreate" }, { "$ref": "#/components/schemas/BenefitDownloadablesCreate" }, { "$ref": "#/components/schemas/BenefitLicenseKeysCreate" }, { "$ref": "#/components/schemas/BenefitMeterCreditCreate" }, { "$ref": "#/components/schemas/BenefitFeatureFlagCreate" } ], "discriminator": { "propertyName": "type", "mapping": { "custom": "#/components/schemas/BenefitCustomCreate", "discord": "#/components/schemas/BenefitDiscordCreate", "downloadables": "#/components/schemas/BenefitDownloadablesCreate", "feature_flag": "#/components/schemas/BenefitFeatureFlagCreate", "github_repository": "#/components/schemas/BenefitGitHubRepositoryCreate", "license_keys": "#/components/schemas/BenefitLicenseKeysCreate", "meter_credit": "#/components/schemas/BenefitMeterCreditCreate" } } }, "BenefitCustom": { "properties": { "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the benefit." }, "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "type": { "type": "string", "const": "custom", "title": "Type" }, "description": { "type": "string", "title": "Description", "description": "The description of the benefit." }, "selectable": { "type": "boolean", "title": "Selectable", "description": "Whether the benefit is selectable when creating a product." }, "deletable": { "type": "boolean", "title": "Deletable", "description": "Whether the benefit is deletable." }, "organization_id": { "type": "string", "format": "uuid4", "title": "Organization Id", "description": "The ID of the organization owning the benefit." }, "metadata": { "$ref": "#/components/schemas/MetadataOutputType" }, "properties": { "$ref": "#/components/schemas/BenefitCustomProperties" } }, "type": "object", "required": [ "id", "created_at", "modified_at", "type", "description", "selectable", "deletable", "organization_id", "metadata", "properties" ], "title": "BenefitCustom", "description": "A benefit of type `custom`.\n\nUse it to grant any kind of benefit that doesn't fit in the other types." }, "BenefitCustomCreate": { "properties": { "metadata": { "additionalProperties": { "anyOf": [ { "type": "string", "maxLength": 500, "minLength": 1 }, { "type": "integer" }, { "type": "number" }, { "type": "boolean" } ] }, "propertyNames": { "maxLength": 40, "minLength": 1 }, "type": "object", "maxProperties": 50, "title": "Metadata", "description": "Key-value object allowing you to store additional information.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**." }, "type": { "type": "string", "const": "custom", "title": "Type" }, "description": { "type": "string", "maxLength": 42, "minLength": 3, "title": "Description", "description": "The description of the benefit. Will be displayed on products having this benefit." }, "organization_id": { "anyOf": [ { "type": "string", "format": "uuid4", "description": "The organization ID.", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "x-polar-selector-widget": { "displayProperty": "name", "resourceName": "Organization", "resourceRoot": "/v1/organizations" } }, { "type": "null" } ], "title": "Organization Id", "description": "The ID of the organization owning the benefit. **Required unless you use an organization token.**" }, "properties": { "$ref": "#/components/schemas/BenefitCustomCreateProperties" } }, "type": "object", "required": [ "type", "description", "properties" ], "title": "BenefitCustomCreate", "description": "Schema to create a benefit of type `custom`." }, "BenefitCustomCreateProperties": { "properties": { "note": { "anyOf": [ { "anyOf": [ { "type": "string" }, { "type": "null" } ], "description": "Private note to be shared with customers who have this benefit granted." }, { "type": "null" } ], "title": "Note" } }, "type": "object", "title": "BenefitCustomCreateProperties", "description": "Properties for creating a benefit of type `custom`." }, "BenefitCustomProperties": { "properties": { "note": { "anyOf": [ { "anyOf": [ { "type": "string" }, { "type": "null" } ], "description": "Private note to be shared with customers who have this benefit granted." }, { "type": "null" } ], "title": "Note" } }, "type": "object", "required": [ "note" ], "title": "BenefitCustomProperties", "description": "Properties for a benefit of type `custom`." }, "BenefitCustomSubscriber": { "properties": { "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the benefit." }, "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "type": { "type": "string", "const": "custom", "title": "Type" }, "description": { "type": "string", "title": "Description", "description": "The description of the benefit." }, "selectable": { "type": "boolean", "title": "Selectable", "description": "Whether the benefit is selectable when creating a product." }, "deletable": { "type": "boolean", "title": "Deletable", "description": "Whether the benefit is deletable." }, "organization_id": { "type": "string", "format": "uuid4", "title": "Organization Id", "description": "The ID of the organization owning the benefit." }, "metadata": { "$ref": "#/components/schemas/MetadataOutputType" }, "organization": { "$ref": "#/components/schemas/BenefitSubscriberOrganization" }, "properties": { "$ref": "#/components/schemas/BenefitCustomSubscriberProperties" } }, "type": "object", "required": [ "id", "created_at", "modified_at", "type", "description", "selectable", "deletable", "organization_id", "metadata", "organization", "properties" ], "title": "BenefitCustomSubscriber" }, "BenefitCustomSubscriberProperties": { "properties": { "note": { "anyOf": [ { "anyOf": [ { "type": "string" }, { "type": "null" } ], "description": "Private note to be shared with customers who have this benefit granted." }, { "type": "null" } ], "title": "Note" } }, "type": "object", "required": [ "note" ], "title": "BenefitCustomSubscriberProperties", "description": "Properties available to subscribers for a benefit of type `custom`." }, "BenefitCustomUpdate": { "properties": { "metadata": { "additionalProperties": { "anyOf": [ { "type": "string", "maxLength": 500, "minLength": 1 }, { "type": "integer" }, { "type": "number" }, { "type": "boolean" } ] }, "propertyNames": { "maxLength": 40, "minLength": 1 }, "type": "object", "maxProperties": 50, "title": "Metadata", "description": "Key-value object allowing you to store additional information.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**." }, "description": { "anyOf": [ { "type": "string", "maxLength": 42, "minLength": 3 }, { "type": "null" } ], "title": "Description", "description": "The description of the benefit. Will be displayed on products having this benefit." }, "type": { "type": "string", "const": "custom", "title": "Type" }, "properties": { "anyOf": [ { "$ref": "#/components/schemas/BenefitCustomProperties" }, { "type": "null" } ] } }, "type": "object", "required": [ "type" ], "title": "BenefitCustomUpdate" }, "BenefitCycledEvent": { "properties": { "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "timestamp": { "type": "string", "format": "date-time", "title": "Timestamp", "description": "The timestamp of the event." }, "organization_id": { "type": "string", "format": "uuid4", "title": "Organization Id", "description": "The ID of the organization owning the event.", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "x-polar-selector-widget": { "displayProperty": "name", "resourceName": "Organization", "resourceRoot": "/v1/organizations" } }, "customer_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Customer Id", "description": "ID of the customer in your Polar organization associated with the event." }, "customer": { "anyOf": [ { "$ref": "#/components/schemas/Customer" }, { "type": "null" } ], "description": "The customer associated with the event." }, "external_customer_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "External Customer Id", "description": "ID of the customer in your system associated with the event." }, "member_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Member Id", "description": "ID of the member within the customer's organization who performed the action inside B2B." }, "external_member_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "External Member Id", "description": "ID of the member in your system within the customer's organization who performed the action inside B2B." }, "child_count": { "type": "integer", "title": "Child Count", "description": "Number of direct child events linked to this event.", "default": 0 }, "parent_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Parent Id", "description": "The ID of the parent event." }, "label": { "type": "string", "title": "Label", "description": "Human readable label of the event type." }, "source": { "type": "string", "const": "system", "title": "Source", "description": "The source of the event. `system` events are created by Polar. `user` events are the one you create through our ingestion API." }, "name": { "type": "string", "const": "benefit.cycled", "title": "Name", "description": "The name of the event." }, "metadata": { "$ref": "#/components/schemas/BenefitGrantMetadata" } }, "type": "object", "required": [ "id", "timestamp", "organization_id", "customer_id", "customer", "external_customer_id", "label", "source", "name", "metadata" ], "title": "BenefitCycledEvent", "description": "An event created by Polar when a benefit is cycled." }, "BenefitDiscord": { "properties": { "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the benefit." }, "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "type": { "type": "string", "const": "discord", "title": "Type" }, "description": { "type": "string", "title": "Description", "description": "The description of the benefit." }, "selectable": { "type": "boolean", "title": "Selectable", "description": "Whether the benefit is selectable when creating a product." }, "deletable": { "type": "boolean", "title": "Deletable", "description": "Whether the benefit is deletable." }, "organization_id": { "type": "string", "format": "uuid4", "title": "Organization Id", "description": "The ID of the organization owning the benefit." }, "metadata": { "$ref": "#/components/schemas/MetadataOutputType" }, "properties": { "$ref": "#/components/schemas/BenefitDiscordProperties" } }, "type": "object", "required": [ "id", "created_at", "modified_at", "type", "description", "selectable", "deletable", "organization_id", "metadata", "properties" ], "title": "BenefitDiscord", "description": "A benefit of type `discord`.\n\nUse it to automatically invite your backers to a Discord server." }, "BenefitDiscordCreate": { "properties": { "metadata": { "additionalProperties": { "anyOf": [ { "type": "string", "maxLength": 500, "minLength": 1 }, { "type": "integer" }, { "type": "number" }, { "type": "boolean" } ] }, "propertyNames": { "maxLength": 40, "minLength": 1 }, "type": "object", "maxProperties": 50, "title": "Metadata", "description": "Key-value object allowing you to store additional information.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**." }, "type": { "type": "string", "const": "discord", "title": "Type" }, "description": { "type": "string", "maxLength": 42, "minLength": 3, "title": "Description", "description": "The description of the benefit. Will be displayed on products having this benefit." }, "organization_id": { "anyOf": [ { "type": "string", "format": "uuid4", "description": "The organization ID.", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "x-polar-selector-widget": { "displayProperty": "name", "resourceName": "Organization", "resourceRoot": "/v1/organizations" } }, { "type": "null" } ], "title": "Organization Id", "description": "The ID of the organization owning the benefit. **Required unless you use an organization token.**" }, "properties": { "$ref": "#/components/schemas/BenefitDiscordCreateProperties" } }, "type": "object", "required": [ "type", "description", "properties" ], "title": "BenefitDiscordCreate" }, "BenefitDiscordCreateProperties": { "properties": { "guild_token": { "type": "string", "title": "Guild Token" }, "role_id": { "type": "string", "title": "Role Id", "description": "The ID of the Discord role to grant." }, "kick_member": { "type": "boolean", "title": "Kick Member", "description": "Whether to kick the member from the Discord server on revocation." } }, "type": "object", "required": [ "guild_token", "role_id", "kick_member" ], "title": "BenefitDiscordCreateProperties", "description": "Properties to create a benefit of type `discord`." }, "BenefitDiscordProperties": { "properties": { "guild_id": { "type": "string", "title": "Guild Id", "description": "The ID of the Discord server." }, "role_id": { "type": "string", "title": "Role Id", "description": "The ID of the Discord role to grant." }, "kick_member": { "type": "boolean", "title": "Kick Member", "description": "Whether to kick the member from the Discord server on revocation." }, "guild_token": { "type": "string", "title": "Guild Token" } }, "type": "object", "required": [ "guild_id", "role_id", "kick_member", "guild_token" ], "title": "BenefitDiscordProperties", "description": "Properties for a benefit of type `discord`." }, "BenefitDiscordSubscriber": { "properties": { "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the benefit." }, "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "type": { "type": "string", "const": "discord", "title": "Type" }, "description": { "type": "string", "title": "Description", "description": "The description of the benefit." }, "selectable": { "type": "boolean", "title": "Selectable", "description": "Whether the benefit is selectable when creating a product." }, "deletable": { "type": "boolean", "title": "Deletable", "description": "Whether the benefit is deletable." }, "organization_id": { "type": "string", "format": "uuid4", "title": "Organization Id", "description": "The ID of the organization owning the benefit." }, "metadata": { "$ref": "#/components/schemas/MetadataOutputType" }, "organization": { "$ref": "#/components/schemas/BenefitSubscriberOrganization" }, "properties": { "$ref": "#/components/schemas/BenefitDiscordSubscriberProperties" } }, "type": "object", "required": [ "id", "created_at", "modified_at", "type", "description", "selectable", "deletable", "organization_id", "metadata", "organization", "properties" ], "title": "BenefitDiscordSubscriber" }, "BenefitDiscordSubscriberProperties": { "properties": { "guild_id": { "type": "string", "title": "Guild Id", "description": "The ID of the Discord server." } }, "type": "object", "required": [ "guild_id" ], "title": "BenefitDiscordSubscriberProperties", "description": "Properties available to subscribers for a benefit of type `discord`." }, "BenefitDiscordUpdate": { "properties": { "metadata": { "additionalProperties": { "anyOf": [ { "type": "string", "maxLength": 500, "minLength": 1 }, { "type": "integer" }, { "type": "number" }, { "type": "boolean" } ] }, "propertyNames": { "maxLength": 40, "minLength": 1 }, "type": "object", "maxProperties": 50, "title": "Metadata", "description": "Key-value object allowing you to store additional information.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**." }, "description": { "anyOf": [ { "type": "string", "maxLength": 42, "minLength": 3 }, { "type": "null" } ], "title": "Description", "description": "The description of the benefit. Will be displayed on products having this benefit." }, "type": { "type": "string", "const": "discord", "title": "Type" }, "properties": { "anyOf": [ { "$ref": "#/components/schemas/BenefitDiscordCreateProperties" }, { "type": "null" } ] } }, "type": "object", "required": [ "type" ], "title": "BenefitDiscordUpdate" }, "BenefitDownloadables": { "properties": { "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the benefit." }, "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "type": { "type": "string", "const": "downloadables", "title": "Type" }, "description": { "type": "string", "title": "Description", "description": "The description of the benefit." }, "selectable": { "type": "boolean", "title": "Selectable", "description": "Whether the benefit is selectable when creating a product." }, "deletable": { "type": "boolean", "title": "Deletable", "description": "Whether the benefit is deletable." }, "organization_id": { "type": "string", "format": "uuid4", "title": "Organization Id", "description": "The ID of the organization owning the benefit." }, "metadata": { "$ref": "#/components/schemas/MetadataOutputType" }, "properties": { "$ref": "#/components/schemas/BenefitDownloadablesProperties" } }, "type": "object", "required": [ "id", "created_at", "modified_at", "type", "description", "selectable", "deletable", "organization_id", "metadata", "properties" ], "title": "BenefitDownloadables" }, "BenefitDownloadablesCreate": { "properties": { "metadata": { "additionalProperties": { "anyOf": [ { "type": "string", "maxLength": 500, "minLength": 1 }, { "type": "integer" }, { "type": "number" }, { "type": "boolean" } ] }, "propertyNames": { "maxLength": 40, "minLength": 1 }, "type": "object", "maxProperties": 50, "title": "Metadata", "description": "Key-value object allowing you to store additional information.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**." }, "type": { "type": "string", "const": "downloadables", "title": "Type" }, "description": { "type": "string", "maxLength": 42, "minLength": 3, "title": "Description", "description": "The description of the benefit. Will be displayed on products having this benefit." }, "organization_id": { "anyOf": [ { "type": "string", "format": "uuid4", "description": "The organization ID.", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "x-polar-selector-widget": { "displayProperty": "name", "resourceName": "Organization", "resourceRoot": "/v1/organizations" } }, { "type": "null" } ], "title": "Organization Id", "description": "The ID of the organization owning the benefit. **Required unless you use an organization token.**" }, "properties": { "$ref": "#/components/schemas/BenefitDownloadablesCreateProperties" } }, "type": "object", "required": [ "type", "description", "properties" ], "title": "BenefitDownloadablesCreate" }, "BenefitDownloadablesCreateProperties": { "properties": { "archived": { "additionalProperties": { "type": "boolean" }, "propertyNames": { "format": "uuid4" }, "type": "object", "title": "Archived", "default": {} }, "files": { "items": { "type": "string", "format": "uuid4" }, "type": "array", "minItems": 1, "title": "Files" } }, "type": "object", "required": [ "files" ], "title": "BenefitDownloadablesCreateProperties" }, "BenefitDownloadablesProperties": { "properties": { "archived": { "additionalProperties": { "type": "boolean" }, "propertyNames": { "format": "uuid4" }, "type": "object", "title": "Archived" }, "files": { "items": { "type": "string", "format": "uuid4" }, "type": "array", "title": "Files" } }, "type": "object", "required": [ "archived", "files" ], "title": "BenefitDownloadablesProperties" }, "BenefitDownloadablesSubscriber": { "properties": { "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the benefit." }, "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "type": { "type": "string", "const": "downloadables", "title": "Type" }, "description": { "type": "string", "title": "Description", "description": "The description of the benefit." }, "selectable": { "type": "boolean", "title": "Selectable", "description": "Whether the benefit is selectable when creating a product." }, "deletable": { "type": "boolean", "title": "Deletable", "description": "Whether the benefit is deletable." }, "organization_id": { "type": "string", "format": "uuid4", "title": "Organization Id", "description": "The ID of the organization owning the benefit." }, "metadata": { "$ref": "#/components/schemas/MetadataOutputType" }, "organization": { "$ref": "#/components/schemas/BenefitSubscriberOrganization" }, "properties": { "$ref": "#/components/schemas/BenefitDownloadablesSubscriberProperties" } }, "type": "object", "required": [ "id", "created_at", "modified_at", "type", "description", "selectable", "deletable", "organization_id", "metadata", "organization", "properties" ], "title": "BenefitDownloadablesSubscriber" }, "BenefitDownloadablesSubscriberProperties": { "properties": { "active_files": { "items": { "type": "string", "format": "uuid4" }, "type": "array", "title": "Active Files" } }, "type": "object", "required": [ "active_files" ], "title": "BenefitDownloadablesSubscriberProperties" }, "BenefitDownloadablesUpdate": { "properties": { "metadata": { "additionalProperties": { "anyOf": [ { "type": "string", "maxLength": 500, "minLength": 1 }, { "type": "integer" }, { "type": "number" }, { "type": "boolean" } ] }, "propertyNames": { "maxLength": 40, "minLength": 1 }, "type": "object", "maxProperties": 50, "title": "Metadata", "description": "Key-value object allowing you to store additional information.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**." }, "description": { "anyOf": [ { "type": "string", "maxLength": 42, "minLength": 3 }, { "type": "null" } ], "title": "Description", "description": "The description of the benefit. Will be displayed on products having this benefit." }, "type": { "type": "string", "const": "downloadables", "title": "Type" }, "properties": { "anyOf": [ { "$ref": "#/components/schemas/BenefitDownloadablesCreateProperties" }, { "type": "null" } ] } }, "type": "object", "required": [ "type" ], "title": "BenefitDownloadablesUpdate" }, "BenefitFeatureFlag": { "properties": { "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the benefit." }, "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "type": { "type": "string", "const": "feature_flag", "title": "Type" }, "description": { "type": "string", "title": "Description", "description": "The description of the benefit." }, "selectable": { "type": "boolean", "title": "Selectable", "description": "Whether the benefit is selectable when creating a product." }, "deletable": { "type": "boolean", "title": "Deletable", "description": "Whether the benefit is deletable." }, "organization_id": { "type": "string", "format": "uuid4", "title": "Organization Id", "description": "The ID of the organization owning the benefit." }, "metadata": { "$ref": "#/components/schemas/MetadataOutputType" }, "properties": { "$ref": "#/components/schemas/BenefitFeatureFlagProperties" } }, "type": "object", "required": [ "id", "created_at", "modified_at", "type", "description", "selectable", "deletable", "organization_id", "metadata", "properties" ], "title": "BenefitFeatureFlag", "description": "A benefit of type `feature_flag`.\n\nUse it to grant feature flags with key-value metadata\nthat can be queried via the API and webhooks." }, "BenefitFeatureFlagCreate": { "properties": { "metadata": { "additionalProperties": { "anyOf": [ { "type": "string", "maxLength": 500, "minLength": 1 }, { "type": "integer" }, { "type": "number" }, { "type": "boolean" } ] }, "propertyNames": { "maxLength": 40, "minLength": 1 }, "type": "object", "maxProperties": 50, "title": "Metadata", "description": "Key-value object allowing you to store additional information.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**." }, "type": { "type": "string", "const": "feature_flag", "title": "Type" }, "description": { "type": "string", "maxLength": 42, "minLength": 3, "title": "Description", "description": "The description of the benefit. Will be displayed on products having this benefit." }, "organization_id": { "anyOf": [ { "type": "string", "format": "uuid4", "description": "The organization ID.", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "x-polar-selector-widget": { "displayProperty": "name", "resourceName": "Organization", "resourceRoot": "/v1/organizations" } }, { "type": "null" } ], "title": "Organization Id", "description": "The ID of the organization owning the benefit. **Required unless you use an organization token.**" }, "properties": { "$ref": "#/components/schemas/BenefitFeatureFlagCreateProperties" } }, "type": "object", "required": [ "type", "description", "properties" ], "title": "BenefitFeatureFlagCreate", "description": "Schema to create a benefit of type `feature_flag`." }, "BenefitFeatureFlagCreateProperties": { "properties": {}, "type": "object", "title": "BenefitFeatureFlagCreateProperties", "description": "Properties for creating a benefit of type `feature_flag`." }, "BenefitFeatureFlagProperties": { "properties": {}, "type": "object", "title": "BenefitFeatureFlagProperties", "description": "Properties for a benefit of type `feature_flag`." }, "BenefitFeatureFlagSubscriber": { "properties": { "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the benefit." }, "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "type": { "type": "string", "const": "feature_flag", "title": "Type" }, "description": { "type": "string", "title": "Description", "description": "The description of the benefit." }, "selectable": { "type": "boolean", "title": "Selectable", "description": "Whether the benefit is selectable when creating a product." }, "deletable": { "type": "boolean", "title": "Deletable", "description": "Whether the benefit is deletable." }, "organization_id": { "type": "string", "format": "uuid4", "title": "Organization Id", "description": "The ID of the organization owning the benefit." }, "metadata": { "$ref": "#/components/schemas/MetadataOutputType" }, "organization": { "$ref": "#/components/schemas/BenefitSubscriberOrganization" }, "properties": { "$ref": "#/components/schemas/BenefitFeatureFlagSubscriberProperties" } }, "type": "object", "required": [ "id", "created_at", "modified_at", "type", "description", "selectable", "deletable", "organization_id", "metadata", "organization", "properties" ], "title": "BenefitFeatureFlagSubscriber" }, "BenefitFeatureFlagSubscriberProperties": { "properties": {}, "type": "object", "title": "BenefitFeatureFlagSubscriberProperties", "description": "Properties available to subscribers for a benefit of type `feature_flag`." }, "BenefitFeatureFlagUpdate": { "properties": { "metadata": { "additionalProperties": { "anyOf": [ { "type": "string", "maxLength": 500, "minLength": 1 }, { "type": "integer" }, { "type": "number" }, { "type": "boolean" } ] }, "propertyNames": { "maxLength": 40, "minLength": 1 }, "type": "object", "maxProperties": 50, "title": "Metadata", "description": "Key-value object allowing you to store additional information.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**." }, "description": { "anyOf": [ { "type": "string", "maxLength": 42, "minLength": 3 }, { "type": "null" } ], "title": "Description", "description": "The description of the benefit. Will be displayed on products having this benefit." }, "type": { "type": "string", "const": "feature_flag", "title": "Type" }, "properties": { "anyOf": [ { "$ref": "#/components/schemas/BenefitFeatureFlagProperties" }, { "type": "null" } ] } }, "type": "object", "required": [ "type" ], "title": "BenefitFeatureFlagUpdate" }, "BenefitGitHubRepository": { "properties": { "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the benefit." }, "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "type": { "type": "string", "const": "github_repository", "title": "Type" }, "description": { "type": "string", "title": "Description", "description": "The description of the benefit." }, "selectable": { "type": "boolean", "title": "Selectable", "description": "Whether the benefit is selectable when creating a product." }, "deletable": { "type": "boolean", "title": "Deletable", "description": "Whether the benefit is deletable." }, "organization_id": { "type": "string", "format": "uuid4", "title": "Organization Id", "description": "The ID of the organization owning the benefit." }, "metadata": { "$ref": "#/components/schemas/MetadataOutputType" }, "properties": { "$ref": "#/components/schemas/BenefitGitHubRepositoryProperties" } }, "type": "object", "required": [ "id", "created_at", "modified_at", "type", "description", "selectable", "deletable", "organization_id", "metadata", "properties" ], "title": "BenefitGitHubRepository", "description": "A benefit of type `github_repository`.\n\nUse it to automatically invite your backers to a private GitHub repository." }, "BenefitGitHubRepositoryCreate": { "properties": { "metadata": { "additionalProperties": { "anyOf": [ { "type": "string", "maxLength": 500, "minLength": 1 }, { "type": "integer" }, { "type": "number" }, { "type": "boolean" } ] }, "propertyNames": { "maxLength": 40, "minLength": 1 }, "type": "object", "maxProperties": 50, "title": "Metadata", "description": "Key-value object allowing you to store additional information.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**." }, "type": { "type": "string", "const": "github_repository", "title": "Type" }, "description": { "type": "string", "maxLength": 42, "minLength": 3, "title": "Description", "description": "The description of the benefit. Will be displayed on products having this benefit." }, "organization_id": { "anyOf": [ { "type": "string", "format": "uuid4", "description": "The organization ID.", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "x-polar-selector-widget": { "displayProperty": "name", "resourceName": "Organization", "resourceRoot": "/v1/organizations" } }, { "type": "null" } ], "title": "Organization Id", "description": "The ID of the organization owning the benefit. **Required unless you use an organization token.**" }, "properties": { "$ref": "#/components/schemas/BenefitGitHubRepositoryCreateProperties" } }, "type": "object", "required": [ "type", "description", "properties" ], "title": "BenefitGitHubRepositoryCreate" }, "BenefitGitHubRepositoryCreateProperties": { "properties": { "repository_owner": { "type": "string", "title": "Repository Owner", "description": "The owner of the repository.", "examples": [ "polarsource" ] }, "repository_name": { "type": "string", "title": "Repository Name", "description": "The name of the repository.", "examples": [ "private_repo" ] }, "permission": { "type": "string", "enum": [ "pull", "triage", "push", "maintain", "admin" ], "title": "Permission", "description": "The permission level to grant. Read more about roles and their permissions on [GitHub documentation](https://docs.github.com/en/organizations/managing-user-access-to-your-organizations-repositories/managing-repository-roles/repository-roles-for-an-organization#permissions-for-each-role)." } }, "type": "object", "required": [ "repository_owner", "repository_name", "permission" ], "title": "BenefitGitHubRepositoryCreateProperties", "description": "Properties to create a benefit of type `github_repository`." }, "BenefitGitHubRepositoryProperties": { "properties": { "repository_owner": { "type": "string", "title": "Repository Owner", "description": "The owner of the repository.", "examples": [ "polarsource" ] }, "repository_name": { "type": "string", "title": "Repository Name", "description": "The name of the repository.", "examples": [ "private_repo" ] }, "permission": { "type": "string", "enum": [ "pull", "triage", "push", "maintain", "admin" ], "title": "Permission", "description": "The permission level to grant. Read more about roles and their permissions on [GitHub documentation](https://docs.github.com/en/organizations/managing-user-access-to-your-organizations-repositories/managing-repository-roles/repository-roles-for-an-organization#permissions-for-each-role)." } }, "type": "object", "required": [ "repository_owner", "repository_name", "permission" ], "title": "BenefitGitHubRepositoryProperties", "description": "Properties for a benefit of type `github_repository`." }, "BenefitGitHubRepositorySubscriber": { "properties": { "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the benefit." }, "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "type": { "type": "string", "const": "github_repository", "title": "Type" }, "description": { "type": "string", "title": "Description", "description": "The description of the benefit." }, "selectable": { "type": "boolean", "title": "Selectable", "description": "Whether the benefit is selectable when creating a product." }, "deletable": { "type": "boolean", "title": "Deletable", "description": "Whether the benefit is deletable." }, "organization_id": { "type": "string", "format": "uuid4", "title": "Organization Id", "description": "The ID of the organization owning the benefit." }, "metadata": { "$ref": "#/components/schemas/MetadataOutputType" }, "organization": { "$ref": "#/components/schemas/BenefitSubscriberOrganization" }, "properties": { "$ref": "#/components/schemas/BenefitGitHubRepositorySubscriberProperties" } }, "type": "object", "required": [ "id", "created_at", "modified_at", "type", "description", "selectable", "deletable", "organization_id", "metadata", "organization", "properties" ], "title": "BenefitGitHubRepositorySubscriber" }, "BenefitGitHubRepositorySubscriberProperties": { "properties": { "repository_owner": { "type": "string", "title": "Repository Owner", "description": "The owner of the repository.", "examples": [ "polarsource" ] }, "repository_name": { "type": "string", "title": "Repository Name", "description": "The name of the repository.", "examples": [ "private_repo" ] } }, "type": "object", "required": [ "repository_owner", "repository_name" ], "title": "BenefitGitHubRepositorySubscriberProperties", "description": "Properties available to subscribers for a benefit of type `github_repository`." }, "BenefitGitHubRepositoryUpdate": { "properties": { "metadata": { "additionalProperties": { "anyOf": [ { "type": "string", "maxLength": 500, "minLength": 1 }, { "type": "integer" }, { "type": "number" }, { "type": "boolean" } ] }, "propertyNames": { "maxLength": 40, "minLength": 1 }, "type": "object", "maxProperties": 50, "title": "Metadata", "description": "Key-value object allowing you to store additional information.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**." }, "description": { "anyOf": [ { "type": "string", "maxLength": 42, "minLength": 3 }, { "type": "null" } ], "title": "Description", "description": "The description of the benefit. Will be displayed on products having this benefit." }, "type": { "type": "string", "const": "github_repository", "title": "Type" }, "properties": { "anyOf": [ { "$ref": "#/components/schemas/BenefitGitHubRepositoryCreateProperties" }, { "type": "null" } ] } }, "type": "object", "required": [ "type" ], "title": "BenefitGitHubRepositoryUpdate" }, "BenefitGrant": { "properties": { "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the grant." }, "granted_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Granted At", "description": "The timestamp when the benefit was granted. If `None`, the benefit is not granted." }, "is_granted": { "type": "boolean", "title": "Is Granted", "description": "Whether the benefit is granted." }, "revoked_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Revoked At", "description": "The timestamp when the benefit was revoked. If `None`, the benefit is not revoked." }, "is_revoked": { "type": "boolean", "title": "Is Revoked", "description": "Whether the benefit is revoked." }, "subscription_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Subscription Id", "description": "The ID of the subscription that granted this benefit." }, "order_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Order Id", "description": "The ID of the order that granted this benefit." }, "customer_id": { "type": "string", "format": "uuid4", "title": "Customer Id", "description": "The ID of the customer concerned by this grant." }, "member_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Member Id", "description": "The ID of the member concerned by this grant." }, "benefit_id": { "type": "string", "format": "uuid4", "title": "Benefit Id", "description": "The ID of the benefit concerned by this grant." }, "error": { "anyOf": [ { "$ref": "#/components/schemas/BenefitGrantError" }, { "type": "null" } ], "description": "The error information if the benefit grant failed with an unrecoverable error." }, "customer": { "$ref": "#/components/schemas/Customer" }, "member": { "anyOf": [ { "$ref": "#/components/schemas/Member" }, { "type": "null" } ] }, "benefit": { "$ref": "#/components/schemas/Benefit", "title": "Benefit" }, "properties": { "anyOf": [ { "$ref": "#/components/schemas/BenefitGrantDiscordProperties" }, { "$ref": "#/components/schemas/BenefitGrantGitHubRepositoryProperties" }, { "$ref": "#/components/schemas/BenefitGrantDownloadablesProperties" }, { "$ref": "#/components/schemas/BenefitGrantLicenseKeysProperties" }, { "$ref": "#/components/schemas/BenefitGrantCustomProperties" }, { "$ref": "#/components/schemas/BenefitGrantFeatureFlagProperties" } ], "title": "Properties" } }, "type": "object", "required": [ "created_at", "modified_at", "id", "is_granted", "is_revoked", "subscription_id", "order_id", "customer_id", "benefit_id", "customer", "benefit", "properties" ], "title": "BenefitGrant" }, "BenefitGrantCustomProperties": { "properties": {}, "type": "object", "title": "BenefitGrantCustomProperties" }, "BenefitGrantCustomWebhook": { "properties": { "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the grant." }, "granted_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Granted At", "description": "The timestamp when the benefit was granted. If `None`, the benefit is not granted." }, "is_granted": { "type": "boolean", "title": "Is Granted", "description": "Whether the benefit is granted." }, "revoked_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Revoked At", "description": "The timestamp when the benefit was revoked. If `None`, the benefit is not revoked." }, "is_revoked": { "type": "boolean", "title": "Is Revoked", "description": "Whether the benefit is revoked." }, "subscription_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Subscription Id", "description": "The ID of the subscription that granted this benefit." }, "order_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Order Id", "description": "The ID of the order that granted this benefit." }, "customer_id": { "type": "string", "format": "uuid4", "title": "Customer Id", "description": "The ID of the customer concerned by this grant." }, "member_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Member Id", "description": "The ID of the member concerned by this grant." }, "benefit_id": { "type": "string", "format": "uuid4", "title": "Benefit Id", "description": "The ID of the benefit concerned by this grant." }, "error": { "anyOf": [ { "$ref": "#/components/schemas/BenefitGrantError" }, { "type": "null" } ], "description": "The error information if the benefit grant failed with an unrecoverable error." }, "customer": { "$ref": "#/components/schemas/Customer" }, "member": { "anyOf": [ { "$ref": "#/components/schemas/Member" }, { "type": "null" } ] }, "benefit": { "$ref": "#/components/schemas/BenefitCustom" }, "properties": { "$ref": "#/components/schemas/BenefitGrantCustomProperties" }, "previous_properties": { "anyOf": [ { "$ref": "#/components/schemas/BenefitGrantCustomProperties" }, { "type": "null" } ] } }, "type": "object", "required": [ "created_at", "modified_at", "id", "is_granted", "is_revoked", "subscription_id", "order_id", "customer_id", "benefit_id", "customer", "benefit", "properties" ], "title": "BenefitGrantCustomWebhook" }, "BenefitGrantDiscordProperties": { "properties": { "account_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Account Id" }, "guild_id": { "type": "string", "title": "Guild Id" }, "role_id": { "type": "string", "title": "Role Id" }, "granted_account_id": { "type": "string", "title": "Granted Account Id" } }, "type": "object", "title": "BenefitGrantDiscordProperties" }, "BenefitGrantDiscordWebhook": { "properties": { "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the grant." }, "granted_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Granted At", "description": "The timestamp when the benefit was granted. If `None`, the benefit is not granted." }, "is_granted": { "type": "boolean", "title": "Is Granted", "description": "Whether the benefit is granted." }, "revoked_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Revoked At", "description": "The timestamp when the benefit was revoked. If `None`, the benefit is not revoked." }, "is_revoked": { "type": "boolean", "title": "Is Revoked", "description": "Whether the benefit is revoked." }, "subscription_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Subscription Id", "description": "The ID of the subscription that granted this benefit." }, "order_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Order Id", "description": "The ID of the order that granted this benefit." }, "customer_id": { "type": "string", "format": "uuid4", "title": "Customer Id", "description": "The ID of the customer concerned by this grant." }, "member_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Member Id", "description": "The ID of the member concerned by this grant." }, "benefit_id": { "type": "string", "format": "uuid4", "title": "Benefit Id", "description": "The ID of the benefit concerned by this grant." }, "error": { "anyOf": [ { "$ref": "#/components/schemas/BenefitGrantError" }, { "type": "null" } ], "description": "The error information if the benefit grant failed with an unrecoverable error." }, "customer": { "$ref": "#/components/schemas/Customer" }, "member": { "anyOf": [ { "$ref": "#/components/schemas/Member" }, { "type": "null" } ] }, "benefit": { "$ref": "#/components/schemas/BenefitDiscord" }, "properties": { "$ref": "#/components/schemas/BenefitGrantDiscordProperties" }, "previous_properties": { "anyOf": [ { "$ref": "#/components/schemas/BenefitGrantDiscordProperties" }, { "type": "null" } ] } }, "type": "object", "required": [ "created_at", "modified_at", "id", "is_granted", "is_revoked", "subscription_id", "order_id", "customer_id", "benefit_id", "customer", "benefit", "properties" ], "title": "BenefitGrantDiscordWebhook" }, "BenefitGrantDownloadablesProperties": { "properties": { "files": { "items": { "type": "string" }, "type": "array", "title": "Files" } }, "type": "object", "title": "BenefitGrantDownloadablesProperties" }, "BenefitGrantDownloadablesWebhook": { "properties": { "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the grant." }, "granted_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Granted At", "description": "The timestamp when the benefit was granted. If `None`, the benefit is not granted." }, "is_granted": { "type": "boolean", "title": "Is Granted", "description": "Whether the benefit is granted." }, "revoked_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Revoked At", "description": "The timestamp when the benefit was revoked. If `None`, the benefit is not revoked." }, "is_revoked": { "type": "boolean", "title": "Is Revoked", "description": "Whether the benefit is revoked." }, "subscription_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Subscription Id", "description": "The ID of the subscription that granted this benefit." }, "order_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Order Id", "description": "The ID of the order that granted this benefit." }, "customer_id": { "type": "string", "format": "uuid4", "title": "Customer Id", "description": "The ID of the customer concerned by this grant." }, "member_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Member Id", "description": "The ID of the member concerned by this grant." }, "benefit_id": { "type": "string", "format": "uuid4", "title": "Benefit Id", "description": "The ID of the benefit concerned by this grant." }, "error": { "anyOf": [ { "$ref": "#/components/schemas/BenefitGrantError" }, { "type": "null" } ], "description": "The error information if the benefit grant failed with an unrecoverable error." }, "customer": { "$ref": "#/components/schemas/Customer" }, "member": { "anyOf": [ { "$ref": "#/components/schemas/Member" }, { "type": "null" } ] }, "benefit": { "$ref": "#/components/schemas/BenefitDownloadables" }, "properties": { "$ref": "#/components/schemas/BenefitGrantDownloadablesProperties" }, "previous_properties": { "anyOf": [ { "$ref": "#/components/schemas/BenefitGrantDownloadablesProperties" }, { "type": "null" } ] } }, "type": "object", "required": [ "created_at", "modified_at", "id", "is_granted", "is_revoked", "subscription_id", "order_id", "customer_id", "benefit_id", "customer", "benefit", "properties" ], "title": "BenefitGrantDownloadablesWebhook" }, "BenefitGrantError": { "properties": { "message": { "type": "string", "title": "Message" }, "type": { "type": "string", "title": "Type" }, "timestamp": { "type": "string", "title": "Timestamp" } }, "type": "object", "required": [ "message", "type", "timestamp" ], "title": "BenefitGrantError" }, "BenefitGrantFeatureFlagProperties": { "properties": {}, "type": "object", "title": "BenefitGrantFeatureFlagProperties" }, "BenefitGrantFeatureFlagWebhook": { "properties": { "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the grant." }, "granted_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Granted At", "description": "The timestamp when the benefit was granted. If `None`, the benefit is not granted." }, "is_granted": { "type": "boolean", "title": "Is Granted", "description": "Whether the benefit is granted." }, "revoked_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Revoked At", "description": "The timestamp when the benefit was revoked. If `None`, the benefit is not revoked." }, "is_revoked": { "type": "boolean", "title": "Is Revoked", "description": "Whether the benefit is revoked." }, "subscription_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Subscription Id", "description": "The ID of the subscription that granted this benefit." }, "order_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Order Id", "description": "The ID of the order that granted this benefit." }, "customer_id": { "type": "string", "format": "uuid4", "title": "Customer Id", "description": "The ID of the customer concerned by this grant." }, "member_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Member Id", "description": "The ID of the member concerned by this grant." }, "benefit_id": { "type": "string", "format": "uuid4", "title": "Benefit Id", "description": "The ID of the benefit concerned by this grant." }, "error": { "anyOf": [ { "$ref": "#/components/schemas/BenefitGrantError" }, { "type": "null" } ], "description": "The error information if the benefit grant failed with an unrecoverable error." }, "customer": { "$ref": "#/components/schemas/Customer" }, "member": { "anyOf": [ { "$ref": "#/components/schemas/Member" }, { "type": "null" } ] }, "benefit": { "$ref": "#/components/schemas/BenefitFeatureFlag" }, "properties": { "$ref": "#/components/schemas/BenefitGrantFeatureFlagProperties" }, "previous_properties": { "anyOf": [ { "$ref": "#/components/schemas/BenefitGrantFeatureFlagProperties" }, { "type": "null" } ] } }, "type": "object", "required": [ "created_at", "modified_at", "id", "is_granted", "is_revoked", "subscription_id", "order_id", "customer_id", "benefit_id", "customer", "benefit", "properties" ], "title": "BenefitGrantFeatureFlagWebhook" }, "BenefitGrantGitHubRepositoryProperties": { "properties": { "account_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Account Id" }, "repository_owner": { "type": "string", "title": "Repository Owner" }, "repository_name": { "type": "string", "title": "Repository Name" }, "permission": { "type": "string", "enum": [ "pull", "triage", "push", "maintain", "admin" ], "title": "Permission" }, "granted_account_id": { "type": "string", "title": "Granted Account Id" } }, "type": "object", "title": "BenefitGrantGitHubRepositoryProperties" }, "BenefitGrantGitHubRepositoryWebhook": { "properties": { "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the grant." }, "granted_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Granted At", "description": "The timestamp when the benefit was granted. If `None`, the benefit is not granted." }, "is_granted": { "type": "boolean", "title": "Is Granted", "description": "Whether the benefit is granted." }, "revoked_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Revoked At", "description": "The timestamp when the benefit was revoked. If `None`, the benefit is not revoked." }, "is_revoked": { "type": "boolean", "title": "Is Revoked", "description": "Whether the benefit is revoked." }, "subscription_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Subscription Id", "description": "The ID of the subscription that granted this benefit." }, "order_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Order Id", "description": "The ID of the order that granted this benefit." }, "customer_id": { "type": "string", "format": "uuid4", "title": "Customer Id", "description": "The ID of the customer concerned by this grant." }, "member_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Member Id", "description": "The ID of the member concerned by this grant." }, "benefit_id": { "type": "string", "format": "uuid4", "title": "Benefit Id", "description": "The ID of the benefit concerned by this grant." }, "error": { "anyOf": [ { "$ref": "#/components/schemas/BenefitGrantError" }, { "type": "null" } ], "description": "The error information if the benefit grant failed with an unrecoverable error." }, "customer": { "$ref": "#/components/schemas/Customer" }, "member": { "anyOf": [ { "$ref": "#/components/schemas/Member" }, { "type": "null" } ] }, "benefit": { "$ref": "#/components/schemas/BenefitGitHubRepository" }, "properties": { "$ref": "#/components/schemas/BenefitGrantGitHubRepositoryProperties" }, "previous_properties": { "anyOf": [ { "$ref": "#/components/schemas/BenefitGrantGitHubRepositoryProperties" }, { "type": "null" } ] } }, "type": "object", "required": [ "created_at", "modified_at", "id", "is_granted", "is_revoked", "subscription_id", "order_id", "customer_id", "benefit_id", "customer", "benefit", "properties" ], "title": "BenefitGrantGitHubRepositoryWebhook" }, "BenefitGrantLicenseKeysProperties": { "properties": { "user_provided_key": { "type": "string", "title": "User Provided Key" }, "license_key_id": { "type": "string", "title": "License Key Id" }, "display_key": { "type": "string", "title": "Display Key" } }, "type": "object", "title": "BenefitGrantLicenseKeysProperties" }, "BenefitGrantLicenseKeysWebhook": { "properties": { "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the grant." }, "granted_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Granted At", "description": "The timestamp when the benefit was granted. If `None`, the benefit is not granted." }, "is_granted": { "type": "boolean", "title": "Is Granted", "description": "Whether the benefit is granted." }, "revoked_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Revoked At", "description": "The timestamp when the benefit was revoked. If `None`, the benefit is not revoked." }, "is_revoked": { "type": "boolean", "title": "Is Revoked", "description": "Whether the benefit is revoked." }, "subscription_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Subscription Id", "description": "The ID of the subscription that granted this benefit." }, "order_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Order Id", "description": "The ID of the order that granted this benefit." }, "customer_id": { "type": "string", "format": "uuid4", "title": "Customer Id", "description": "The ID of the customer concerned by this grant." }, "member_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Member Id", "description": "The ID of the member concerned by this grant." }, "benefit_id": { "type": "string", "format": "uuid4", "title": "Benefit Id", "description": "The ID of the benefit concerned by this grant." }, "error": { "anyOf": [ { "$ref": "#/components/schemas/BenefitGrantError" }, { "type": "null" } ], "description": "The error information if the benefit grant failed with an unrecoverable error." }, "customer": { "$ref": "#/components/schemas/Customer" }, "member": { "anyOf": [ { "$ref": "#/components/schemas/Member" }, { "type": "null" } ] }, "benefit": { "$ref": "#/components/schemas/BenefitLicenseKeys" }, "properties": { "$ref": "#/components/schemas/BenefitGrantLicenseKeysProperties" }, "previous_properties": { "anyOf": [ { "$ref": "#/components/schemas/BenefitGrantLicenseKeysProperties" }, { "type": "null" } ] } }, "type": "object", "required": [ "created_at", "modified_at", "id", "is_granted", "is_revoked", "subscription_id", "order_id", "customer_id", "benefit_id", "customer", "benefit", "properties" ], "title": "BenefitGrantLicenseKeysWebhook" }, "BenefitGrantMetadata": { "properties": { "benefit_id": { "type": "string", "title": "Benefit Id" }, "benefit_grant_id": { "type": "string", "title": "Benefit Grant Id" }, "benefit_type": { "$ref": "#/components/schemas/BenefitType" }, "member_id": { "type": "string", "title": "Member Id" } }, "type": "object", "required": [ "benefit_id", "benefit_grant_id", "benefit_type" ], "title": "BenefitGrantMetadata" }, "BenefitGrantMeterCreditProperties": { "properties": { "last_credited_meter_id": { "type": "string", "title": "Last Credited Meter Id" }, "last_credited_units": { "type": "integer", "title": "Last Credited Units" }, "last_credited_at": { "type": "string", "title": "Last Credited At" } }, "type": "object", "title": "BenefitGrantMeterCreditProperties" }, "BenefitGrantMeterCreditWebhook": { "properties": { "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the grant." }, "granted_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Granted At", "description": "The timestamp when the benefit was granted. If `None`, the benefit is not granted." }, "is_granted": { "type": "boolean", "title": "Is Granted", "description": "Whether the benefit is granted." }, "revoked_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Revoked At", "description": "The timestamp when the benefit was revoked. If `None`, the benefit is not revoked." }, "is_revoked": { "type": "boolean", "title": "Is Revoked", "description": "Whether the benefit is revoked." }, "subscription_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Subscription Id", "description": "The ID of the subscription that granted this benefit." }, "order_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Order Id", "description": "The ID of the order that granted this benefit." }, "customer_id": { "type": "string", "format": "uuid4", "title": "Customer Id", "description": "The ID of the customer concerned by this grant." }, "member_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Member Id", "description": "The ID of the member concerned by this grant." }, "benefit_id": { "type": "string", "format": "uuid4", "title": "Benefit Id", "description": "The ID of the benefit concerned by this grant." }, "error": { "anyOf": [ { "$ref": "#/components/schemas/BenefitGrantError" }, { "type": "null" } ], "description": "The error information if the benefit grant failed with an unrecoverable error." }, "customer": { "$ref": "#/components/schemas/Customer" }, "member": { "anyOf": [ { "$ref": "#/components/schemas/Member" }, { "type": "null" } ] }, "benefit": { "$ref": "#/components/schemas/BenefitMeterCredit" }, "properties": { "$ref": "#/components/schemas/BenefitGrantMeterCreditProperties" }, "previous_properties": { "anyOf": [ { "$ref": "#/components/schemas/BenefitGrantMeterCreditProperties" }, { "type": "null" } ] } }, "type": "object", "required": [ "created_at", "modified_at", "id", "is_granted", "is_revoked", "subscription_id", "order_id", "customer_id", "benefit_id", "customer", "benefit", "properties" ], "title": "BenefitGrantMeterCreditWebhook" }, "BenefitGrantSortProperty": { "type": "string", "enum": [ "created_at", "-created_at", "granted_at", "-granted_at", "revoked_at", "-revoked_at" ], "title": "BenefitGrantSortProperty" }, "BenefitGrantWebhook": { "anyOf": [ { "$ref": "#/components/schemas/BenefitGrantDiscordWebhook" }, { "$ref": "#/components/schemas/BenefitGrantCustomWebhook" }, { "$ref": "#/components/schemas/BenefitGrantGitHubRepositoryWebhook" }, { "$ref": "#/components/schemas/BenefitGrantDownloadablesWebhook" }, { "$ref": "#/components/schemas/BenefitGrantLicenseKeysWebhook" }, { "$ref": "#/components/schemas/BenefitGrantMeterCreditWebhook" }, { "$ref": "#/components/schemas/BenefitGrantFeatureFlagWebhook" } ] }, "BenefitGrantedEvent": { "properties": { "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "timestamp": { "type": "string", "format": "date-time", "title": "Timestamp", "description": "The timestamp of the event." }, "organization_id": { "type": "string", "format": "uuid4", "title": "Organization Id", "description": "The ID of the organization owning the event.", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "x-polar-selector-widget": { "displayProperty": "name", "resourceName": "Organization", "resourceRoot": "/v1/organizations" } }, "customer_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Customer Id", "description": "ID of the customer in your Polar organization associated with the event." }, "customer": { "anyOf": [ { "$ref": "#/components/schemas/Customer" }, { "type": "null" } ], "description": "The customer associated with the event." }, "external_customer_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "External Customer Id", "description": "ID of the customer in your system associated with the event." }, "member_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Member Id", "description": "ID of the member within the customer's organization who performed the action inside B2B." }, "external_member_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "External Member Id", "description": "ID of the member in your system within the customer's organization who performed the action inside B2B." }, "child_count": { "type": "integer", "title": "Child Count", "description": "Number of direct child events linked to this event.", "default": 0 }, "parent_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Parent Id", "description": "The ID of the parent event." }, "label": { "type": "string", "title": "Label", "description": "Human readable label of the event type." }, "source": { "type": "string", "const": "system", "title": "Source", "description": "The source of the event. `system` events are created by Polar. `user` events are the one you create through our ingestion API." }, "name": { "type": "string", "const": "benefit.granted", "title": "Name", "description": "The name of the event." }, "metadata": { "$ref": "#/components/schemas/BenefitGrantMetadata" } }, "type": "object", "required": [ "id", "timestamp", "organization_id", "customer_id", "customer", "external_customer_id", "label", "source", "name", "metadata" ], "title": "BenefitGrantedEvent", "description": "An event created by Polar when a benefit is granted to a customer." }, "BenefitLicenseKeyActivationCreateProperties": { "properties": { "limit": { "type": "integer", "maximum": 50, "exclusiveMinimum": 0, "title": "Limit" }, "enable_customer_admin": { "type": "boolean", "title": "Enable Customer Admin" } }, "type": "object", "required": [ "limit", "enable_customer_admin" ], "title": "BenefitLicenseKeyActivationCreateProperties" }, "BenefitLicenseKeyActivationProperties": { "properties": { "limit": { "type": "integer", "title": "Limit" }, "enable_customer_admin": { "type": "boolean", "title": "Enable Customer Admin" } }, "type": "object", "required": [ "limit", "enable_customer_admin" ], "title": "BenefitLicenseKeyActivationProperties" }, "BenefitLicenseKeyExpirationProperties": { "properties": { "ttl": { "type": "integer", "exclusiveMinimum": 0, "title": "Ttl" }, "timeframe": { "type": "string", "enum": [ "year", "month", "day" ], "title": "Timeframe" } }, "type": "object", "required": [ "ttl", "timeframe" ], "title": "BenefitLicenseKeyExpirationProperties" }, "BenefitLicenseKeys": { "properties": { "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the benefit." }, "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "type": { "type": "string", "const": "license_keys", "title": "Type" }, "description": { "type": "string", "title": "Description", "description": "The description of the benefit." }, "selectable": { "type": "boolean", "title": "Selectable", "description": "Whether the benefit is selectable when creating a product." }, "deletable": { "type": "boolean", "title": "Deletable", "description": "Whether the benefit is deletable." }, "organization_id": { "type": "string", "format": "uuid4", "title": "Organization Id", "description": "The ID of the organization owning the benefit." }, "metadata": { "$ref": "#/components/schemas/MetadataOutputType" }, "properties": { "$ref": "#/components/schemas/BenefitLicenseKeysProperties" } }, "type": "object", "required": [ "id", "created_at", "modified_at", "type", "description", "selectable", "deletable", "organization_id", "metadata", "properties" ], "title": "BenefitLicenseKeys" }, "BenefitLicenseKeysCreate": { "properties": { "metadata": { "additionalProperties": { "anyOf": [ { "type": "string", "maxLength": 500, "minLength": 1 }, { "type": "integer" }, { "type": "number" }, { "type": "boolean" } ] }, "propertyNames": { "maxLength": 40, "minLength": 1 }, "type": "object", "maxProperties": 50, "title": "Metadata", "description": "Key-value object allowing you to store additional information.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**." }, "type": { "type": "string", "const": "license_keys", "title": "Type" }, "description": { "type": "string", "maxLength": 42, "minLength": 3, "title": "Description", "description": "The description of the benefit. Will be displayed on products having this benefit." }, "organization_id": { "anyOf": [ { "type": "string", "format": "uuid4", "description": "The organization ID.", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "x-polar-selector-widget": { "displayProperty": "name", "resourceName": "Organization", "resourceRoot": "/v1/organizations" } }, { "type": "null" } ], "title": "Organization Id", "description": "The ID of the organization owning the benefit. **Required unless you use an organization token.**" }, "properties": { "$ref": "#/components/schemas/BenefitLicenseKeysCreateProperties" } }, "type": "object", "required": [ "type", "description", "properties" ], "title": "BenefitLicenseKeysCreate" }, "BenefitLicenseKeysCreateProperties": { "properties": { "prefix": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Prefix" }, "expires": { "anyOf": [ { "$ref": "#/components/schemas/BenefitLicenseKeyExpirationProperties" }, { "type": "null" } ] }, "activations": { "anyOf": [ { "$ref": "#/components/schemas/BenefitLicenseKeyActivationCreateProperties" }, { "type": "null" } ] }, "limit_usage": { "anyOf": [ { "type": "integer", "exclusiveMinimum": 0 }, { "type": "null" } ], "title": "Limit Usage" } }, "type": "object", "title": "BenefitLicenseKeysCreateProperties" }, "BenefitLicenseKeysProperties": { "properties": { "prefix": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Prefix" }, "expires": { "anyOf": [ { "$ref": "#/components/schemas/BenefitLicenseKeyExpirationProperties" }, { "type": "null" } ] }, "activations": { "anyOf": [ { "$ref": "#/components/schemas/BenefitLicenseKeyActivationProperties" }, { "type": "null" } ] }, "limit_usage": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Limit Usage" } }, "type": "object", "required": [ "prefix", "expires", "activations", "limit_usage" ], "title": "BenefitLicenseKeysProperties" }, "BenefitLicenseKeysSubscriber": { "properties": { "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the benefit." }, "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "type": { "type": "string", "const": "license_keys", "title": "Type" }, "description": { "type": "string", "title": "Description", "description": "The description of the benefit." }, "selectable": { "type": "boolean", "title": "Selectable", "description": "Whether the benefit is selectable when creating a product." }, "deletable": { "type": "boolean", "title": "Deletable", "description": "Whether the benefit is deletable." }, "organization_id": { "type": "string", "format": "uuid4", "title": "Organization Id", "description": "The ID of the organization owning the benefit." }, "metadata": { "$ref": "#/components/schemas/MetadataOutputType" }, "organization": { "$ref": "#/components/schemas/BenefitSubscriberOrganization" }, "properties": { "$ref": "#/components/schemas/BenefitLicenseKeysSubscriberProperties" } }, "type": "object", "required": [ "id", "created_at", "modified_at", "type", "description", "selectable", "deletable", "organization_id", "metadata", "organization", "properties" ], "title": "BenefitLicenseKeysSubscriber" }, "BenefitLicenseKeysSubscriberProperties": { "properties": { "prefix": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Prefix" }, "expires": { "anyOf": [ { "$ref": "#/components/schemas/BenefitLicenseKeyExpirationProperties" }, { "type": "null" } ] }, "activations": { "anyOf": [ { "$ref": "#/components/schemas/BenefitLicenseKeyActivationProperties" }, { "type": "null" } ] }, "limit_usage": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Limit Usage" } }, "type": "object", "required": [ "prefix", "expires", "activations", "limit_usage" ], "title": "BenefitLicenseKeysSubscriberProperties" }, "BenefitLicenseKeysUpdate": { "properties": { "metadata": { "additionalProperties": { "anyOf": [ { "type": "string", "maxLength": 500, "minLength": 1 }, { "type": "integer" }, { "type": "number" }, { "type": "boolean" } ] }, "propertyNames": { "maxLength": 40, "minLength": 1 }, "type": "object", "maxProperties": 50, "title": "Metadata", "description": "Key-value object allowing you to store additional information.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**." }, "description": { "anyOf": [ { "type": "string", "maxLength": 42, "minLength": 3 }, { "type": "null" } ], "title": "Description", "description": "The description of the benefit. Will be displayed on products having this benefit." }, "type": { "type": "string", "const": "license_keys", "title": "Type" }, "properties": { "anyOf": [ { "$ref": "#/components/schemas/BenefitLicenseKeysCreateProperties" }, { "type": "null" } ] } }, "type": "object", "required": [ "type" ], "title": "BenefitLicenseKeysUpdate" }, "BenefitMeterCredit": { "properties": { "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the benefit." }, "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "type": { "type": "string", "const": "meter_credit", "title": "Type" }, "description": { "type": "string", "title": "Description", "description": "The description of the benefit." }, "selectable": { "type": "boolean", "title": "Selectable", "description": "Whether the benefit is selectable when creating a product." }, "deletable": { "type": "boolean", "title": "Deletable", "description": "Whether the benefit is deletable." }, "organization_id": { "type": "string", "format": "uuid4", "title": "Organization Id", "description": "The ID of the organization owning the benefit." }, "metadata": { "$ref": "#/components/schemas/MetadataOutputType" }, "properties": { "$ref": "#/components/schemas/BenefitMeterCreditProperties" } }, "type": "object", "required": [ "id", "created_at", "modified_at", "type", "description", "selectable", "deletable", "organization_id", "metadata", "properties" ], "title": "BenefitMeterCredit", "description": "A benefit of type `meter_unit`.\n\nUse it to grant a number of units on a specific meter." }, "BenefitMeterCreditCreate": { "properties": { "metadata": { "additionalProperties": { "anyOf": [ { "type": "string", "maxLength": 500, "minLength": 1 }, { "type": "integer" }, { "type": "number" }, { "type": "boolean" } ] }, "propertyNames": { "maxLength": 40, "minLength": 1 }, "type": "object", "maxProperties": 50, "title": "Metadata", "description": "Key-value object allowing you to store additional information.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**." }, "type": { "type": "string", "const": "meter_credit", "title": "Type" }, "description": { "type": "string", "maxLength": 42, "minLength": 3, "title": "Description", "description": "The description of the benefit. Will be displayed on products having this benefit." }, "organization_id": { "anyOf": [ { "type": "string", "format": "uuid4", "description": "The organization ID.", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "x-polar-selector-widget": { "displayProperty": "name", "resourceName": "Organization", "resourceRoot": "/v1/organizations" } }, { "type": "null" } ], "title": "Organization Id", "description": "The ID of the organization owning the benefit. **Required unless you use an organization token.**" }, "properties": { "$ref": "#/components/schemas/BenefitMeterCreditCreateProperties" } }, "type": "object", "required": [ "type", "description", "properties" ], "title": "BenefitMeterCreditCreate", "description": "Schema to create a benefit of type `meter_unit`." }, "BenefitMeterCreditCreateProperties": { "properties": { "units": { "type": "integer", "maximum": 2147483647, "exclusiveMinimum": 0, "title": "Units" }, "rollover": { "type": "boolean", "title": "Rollover" }, "meter_id": { "type": "string", "format": "uuid4", "title": "Meter Id" } }, "type": "object", "required": [ "units", "rollover", "meter_id" ], "title": "BenefitMeterCreditCreateProperties", "description": "Properties for creating a benefit of type `meter_unit`." }, "BenefitMeterCreditProperties": { "properties": { "units": { "type": "integer", "title": "Units" }, "rollover": { "type": "boolean", "title": "Rollover" }, "meter_id": { "type": "string", "format": "uuid4", "title": "Meter Id" } }, "type": "object", "required": [ "units", "rollover", "meter_id" ], "title": "BenefitMeterCreditProperties", "description": "Properties for a benefit of type `meter_unit`." }, "BenefitMeterCreditSubscriber": { "properties": { "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the benefit." }, "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "type": { "type": "string", "const": "meter_credit", "title": "Type" }, "description": { "type": "string", "title": "Description", "description": "The description of the benefit." }, "selectable": { "type": "boolean", "title": "Selectable", "description": "Whether the benefit is selectable when creating a product." }, "deletable": { "type": "boolean", "title": "Deletable", "description": "Whether the benefit is deletable." }, "organization_id": { "type": "string", "format": "uuid4", "title": "Organization Id", "description": "The ID of the organization owning the benefit." }, "metadata": { "$ref": "#/components/schemas/MetadataOutputType" }, "organization": { "$ref": "#/components/schemas/BenefitSubscriberOrganization" }, "properties": { "$ref": "#/components/schemas/BenefitMeterCreditSubscriberProperties" } }, "type": "object", "required": [ "id", "created_at", "modified_at", "type", "description", "selectable", "deletable", "organization_id", "metadata", "organization", "properties" ], "title": "BenefitMeterCreditSubscriber" }, "BenefitMeterCreditSubscriberProperties": { "properties": { "units": { "type": "integer", "title": "Units" }, "rollover": { "type": "boolean", "title": "Rollover" }, "meter_id": { "type": "string", "format": "uuid4", "title": "Meter Id" } }, "type": "object", "required": [ "units", "rollover", "meter_id" ], "title": "BenefitMeterCreditSubscriberProperties", "description": "Properties available to subscribers for a benefit of type `meter_unit`." }, "BenefitMeterCreditUpdate": { "properties": { "metadata": { "additionalProperties": { "anyOf": [ { "type": "string", "maxLength": 500, "minLength": 1 }, { "type": "integer" }, { "type": "number" }, { "type": "boolean" } ] }, "propertyNames": { "maxLength": 40, "minLength": 1 }, "type": "object", "maxProperties": 50, "title": "Metadata", "description": "Key-value object allowing you to store additional information.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**." }, "description": { "anyOf": [ { "type": "string", "maxLength": 42, "minLength": 3 }, { "type": "null" } ], "title": "Description", "description": "The description of the benefit. Will be displayed on products having this benefit." }, "type": { "type": "string", "const": "meter_credit", "title": "Type" }, "properties": { "anyOf": [ { "$ref": "#/components/schemas/BenefitMeterCreditCreateProperties" }, { "type": "null" } ] } }, "type": "object", "required": [ "type" ], "title": "BenefitMeterCreditUpdate" }, "BenefitPublic": { "properties": { "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the benefit." }, "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "type": { "$ref": "#/components/schemas/BenefitType", "description": "The type of the benefit." }, "description": { "type": "string", "title": "Description", "description": "The description of the benefit." }, "selectable": { "type": "boolean", "title": "Selectable", "description": "Whether the benefit is selectable when creating a product." }, "deletable": { "type": "boolean", "title": "Deletable", "description": "Whether the benefit is deletable." }, "organization_id": { "type": "string", "format": "uuid4", "title": "Organization Id", "description": "The ID of the organization owning the benefit." } }, "type": "object", "required": [ "id", "created_at", "modified_at", "type", "description", "selectable", "deletable", "organization_id" ], "title": "BenefitPublic" }, "BenefitRevokedEvent": { "properties": { "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "timestamp": { "type": "string", "format": "date-time", "title": "Timestamp", "description": "The timestamp of the event." }, "organization_id": { "type": "string", "format": "uuid4", "title": "Organization Id", "description": "The ID of the organization owning the event.", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "x-polar-selector-widget": { "displayProperty": "name", "resourceName": "Organization", "resourceRoot": "/v1/organizations" } }, "customer_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Customer Id", "description": "ID of the customer in your Polar organization associated with the event." }, "customer": { "anyOf": [ { "$ref": "#/components/schemas/Customer" }, { "type": "null" } ], "description": "The customer associated with the event." }, "external_customer_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "External Customer Id", "description": "ID of the customer in your system associated with the event." }, "member_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Member Id", "description": "ID of the member within the customer's organization who performed the action inside B2B." }, "external_member_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "External Member Id", "description": "ID of the member in your system within the customer's organization who performed the action inside B2B." }, "child_count": { "type": "integer", "title": "Child Count", "description": "Number of direct child events linked to this event.", "default": 0 }, "parent_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Parent Id", "description": "The ID of the parent event." }, "label": { "type": "string", "title": "Label", "description": "Human readable label of the event type." }, "source": { "type": "string", "const": "system", "title": "Source", "description": "The source of the event. `system` events are created by Polar. `user` events are the one you create through our ingestion API." }, "name": { "type": "string", "const": "benefit.revoked", "title": "Name", "description": "The name of the event." }, "metadata": { "$ref": "#/components/schemas/BenefitGrantMetadata" } }, "type": "object", "required": [ "id", "timestamp", "organization_id", "customer_id", "customer", "external_customer_id", "label", "source", "name", "metadata" ], "title": "BenefitRevokedEvent", "description": "An event created by Polar when a benefit is revoked from a customer." }, "BenefitSortProperty": { "type": "string", "enum": [ "created_at", "-created_at", "description", "-description", "type", "-type", "user_order", "-user_order" ], "title": "BenefitSortProperty" }, "BenefitSubscriberOrganization": { "properties": { "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "name": { "type": "string", "title": "Name", "description": "Organization name shown in checkout, customer portal, emails etc." }, "slug": { "type": "string", "title": "Slug", "description": "Unique organization slug in checkout, customer portal and credit card statements." }, "avatar_url": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Avatar Url", "description": "Avatar URL shown in checkout, customer portal, emails etc." }, "proration_behavior": { "$ref": "#/components/schemas/SubscriptionProrationBehavior", "description": "Proration behavior applied when customer updates their subscription from the portal." }, "allow_customer_updates": { "type": "boolean", "title": "Allow Customer Updates", "description": "Whether customers can update their subscriptions from the customer portal." } }, "type": "object", "required": [ "created_at", "modified_at", "id", "name", "slug", "avatar_url", "proration_behavior", "allow_customer_updates" ], "title": "BenefitSubscriberOrganization" }, "BenefitType": { "type": "string", "enum": [ "custom", "discord", "github_repository", "downloadables", "license_keys", "meter_credit", "feature_flag" ], "title": "BenefitType" }, "BenefitUpdatedEvent": { "properties": { "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "timestamp": { "type": "string", "format": "date-time", "title": "Timestamp", "description": "The timestamp of the event." }, "organization_id": { "type": "string", "format": "uuid4", "title": "Organization Id", "description": "The ID of the organization owning the event.", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "x-polar-selector-widget": { "displayProperty": "name", "resourceName": "Organization", "resourceRoot": "/v1/organizations" } }, "customer_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Customer Id", "description": "ID of the customer in your Polar organization associated with the event." }, "customer": { "anyOf": [ { "$ref": "#/components/schemas/Customer" }, { "type": "null" } ], "description": "The customer associated with the event." }, "external_customer_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "External Customer Id", "description": "ID of the customer in your system associated with the event." }, "member_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Member Id", "description": "ID of the member within the customer's organization who performed the action inside B2B." }, "external_member_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "External Member Id", "description": "ID of the member in your system within the customer's organization who performed the action inside B2B." }, "child_count": { "type": "integer", "title": "Child Count", "description": "Number of direct child events linked to this event.", "default": 0 }, "parent_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Parent Id", "description": "The ID of the parent event." }, "label": { "type": "string", "title": "Label", "description": "Human readable label of the event type." }, "source": { "type": "string", "const": "system", "title": "Source", "description": "The source of the event. `system` events are created by Polar. `user` events are the one you create through our ingestion API." }, "name": { "type": "string", "const": "benefit.updated", "title": "Name", "description": "The name of the event." }, "metadata": { "$ref": "#/components/schemas/BenefitGrantMetadata" } }, "type": "object", "required": [ "id", "timestamp", "organization_id", "customer_id", "customer", "external_customer_id", "label", "source", "name", "metadata" ], "title": "BenefitUpdatedEvent", "description": "An event created by Polar when a benefit is updated." }, "BillingAddressFieldMode": { "type": "string", "enum": [ "required", "optional", "disabled" ], "title": "BillingAddressFieldMode" }, "CardPayment": { "properties": { "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "processor": { "$ref": "#/components/schemas/PaymentProcessor", "description": "The payment processor.", "examples": [ "stripe" ] }, "status": { "$ref": "#/components/schemas/PaymentStatus", "description": "The payment status.", "examples": [ "succeeded" ] }, "amount": { "type": "integer", "title": "Amount", "description": "The payment amount in cents.", "examples": [ 1000 ] }, "currency": { "type": "string", "title": "Currency", "description": "The payment currency. Currently, only `usd` is supported.", "examples": [ "usd" ] }, "method": { "type": "string", "const": "card", "title": "Method", "description": "The payment method used.", "examples": [ "card" ] }, "decline_reason": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Decline Reason", "description": "Error code, if the payment was declined.", "examples": [ "insufficient_funds" ] }, "decline_message": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Decline Message", "description": "Human-readable error message, if the payment was declined.", "examples": [ "Your card has insufficient funds." ] }, "organization_id": { "type": "string", "format": "uuid4", "title": "Organization Id", "description": "The ID of the organization that owns the payment.", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ] }, "checkout_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Checkout Id", "description": "The ID of the checkout session associated with this payment.", "examples": [ "e4b478fa-cd25-4253-9f1f-8a41e6370ede" ] }, "order_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Order Id", "description": "The ID of the order associated with this payment.", "examples": [ "e4b478fa-cd25-4253-9f1f-8a41e6370ede" ] }, "processor_metadata": { "additionalProperties": true, "type": "object", "title": "Processor Metadata", "description": "Additional metadata from the payment processor for internal use." }, "method_metadata": { "$ref": "#/components/schemas/CardPaymentMetadata", "description": "Additional metadata for the card payment method." } }, "type": "object", "required": [ "created_at", "modified_at", "id", "processor", "status", "amount", "currency", "method", "decline_reason", "decline_message", "organization_id", "checkout_id", "order_id", "method_metadata" ], "title": "CardPayment", "description": "Schema of a payment with a card payment method." }, "CardPaymentMetadata": { "properties": { "brand": { "type": "string", "title": "Brand", "description": "The brand of the card used for the payment.", "examples": [ "visa", "amex" ] }, "last4": { "type": "string", "title": "Last4", "description": "The last 4 digits of the card number.", "examples": [ "4242" ] } }, "type": "object", "required": [ "brand", "last4" ], "title": "CardPaymentMetadata", "description": "Additional metadata for a card payment method." }, "Checkout": { "properties": { "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "custom_field_data": { "additionalProperties": { "anyOf": [ { "type": "string" }, { "type": "integer" }, { "type": "boolean" }, { "type": "string", "format": "date-time" }, { "type": "null" } ] }, "type": "object", "title": "Custom Field Data", "description": "Key-value object storing custom field values." }, "payment_processor": { "$ref": "#/components/schemas/PaymentProcessor", "description": "Payment processor used." }, "status": { "$ref": "#/components/schemas/CheckoutStatus", "description": "\n Status of the checkout session.\n\n - Open: the checkout session was opened.\n - Expired: the checkout session was expired and is no more accessible.\n - Confirmed: the user on the checkout session clicked Pay. This is not indicative of the payment's success status.\n - Failed: the checkout definitely failed for technical reasons and cannot be retried. In most cases, this state is never reached.\n - Succeeded: the payment on the checkout was performed successfully.\n " }, "client_secret": { "type": "string", "title": "Client Secret", "description": "Client secret used to update and complete the checkout session from the client." }, "url": { "type": "string", "title": "Url", "description": "URL where the customer can access the checkout session." }, "expires_at": { "type": "string", "format": "date-time", "title": "Expires At", "description": "Expiration date and time of the checkout session." }, "success_url": { "type": "string", "title": "Success Url", "description": "URL where the customer will be redirected after a successful payment." }, "return_url": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Return Url", "description": "When set, a back button will be shown in the checkout to return to this URL." }, "embed_origin": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Embed Origin", "description": "When checkout is embedded, represents the Origin of the page embedding the checkout. Used as a security measure to send messages only to the embedding page." }, "amount": { "type": "integer", "title": "Amount", "description": "Amount in cents, before discounts and taxes." }, "seats": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Seats", "description": "Predefined number of seats (works with seat-based pricing only)" }, "min_seats": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Min Seats", "description": "Minimum number of seats (works with seat-based pricing only)" }, "max_seats": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Max Seats", "description": "Maximum number of seats (works with seat-based pricing only)" }, "price_per_seat": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Price Per Seat", "description": "Price per seat in cents for the current seat count, based on the applicable tier. Only relevant for seat-based pricing." }, "discount_amount": { "type": "integer", "title": "Discount Amount", "description": "Discount amount in cents." }, "net_amount": { "type": "integer", "title": "Net Amount", "description": "Amount in cents, after discounts but before taxes." }, "tax_amount": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Tax Amount", "description": "Sales tax amount in cents. If `null`, it means there is no enough information yet to calculate it." }, "total_amount": { "type": "integer", "title": "Total Amount", "description": "Amount in cents, after discounts and taxes." }, "currency": { "type": "string", "title": "Currency", "description": "Currency code of the checkout session." }, "allow_trial": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "title": "Allow Trial", "description": "Whether to enable the trial period for the checkout session. If `false`, the trial period will be disabled, even if the selected product has a trial configured." }, "active_trial_interval": { "anyOf": [ { "$ref": "#/components/schemas/TrialInterval" }, { "type": "null" } ], "description": "Interval unit of the trial period, if any. This value is either set from the checkout, if `trial_interval` is set, or from the selected product." }, "active_trial_interval_count": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Active Trial Interval Count", "description": "Number of interval units of the trial period, if any. This value is either set from the checkout, if `trial_interval_count` is set, or from the selected product." }, "trial_end": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Trial End", "description": "End date and time of the trial period, if any." }, "organization_id": { "type": "string", "format": "uuid4", "title": "Organization Id", "description": "ID of the organization owning the checkout session." }, "product_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Product Id", "description": "ID of the product to checkout." }, "product_price_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Product Price Id", "description": "ID of the product price to checkout.", "deprecated": true }, "discount_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Discount Id", "description": "ID of the discount applied to the checkout." }, "allow_discount_codes": { "type": "boolean", "title": "Allow Discount Codes", "description": "Whether to allow the customer to apply discount codes. If you apply a discount through `discount_id`, it'll still be applied, but the customer won't be able to change it." }, "require_billing_address": { "type": "boolean", "title": "Require Billing Address", "description": "Whether to require the customer to fill their full billing address, instead of just the country. Customers in the US will always be required to fill their full address, regardless of this setting. If you preset the billing address, this setting will be automatically set to `true`." }, "is_discount_applicable": { "type": "boolean", "title": "Is Discount Applicable", "description": "Whether the discount is applicable to the checkout. Typically, free and custom prices are not discountable." }, "is_free_product_price": { "type": "boolean", "title": "Is Free Product Price", "description": "Whether the product price is free, regardless of discounts." }, "is_payment_required": { "type": "boolean", "title": "Is Payment Required", "description": "Whether the checkout requires payment, e.g. in case of free products or discounts that cover the total amount." }, "is_payment_setup_required": { "type": "boolean", "title": "Is Payment Setup Required", "description": "Whether the checkout requires setting up a payment method, regardless of the amount, e.g. subscriptions that have first free cycles." }, "is_payment_form_required": { "type": "boolean", "title": "Is Payment Form Required", "description": "Whether the checkout requires a payment form, whether because of a payment or payment method setup." }, "customer_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Customer Id" }, "is_business_customer": { "type": "boolean", "title": "Is Business Customer", "description": "Whether the customer is a business or an individual. If `true`, the customer will be required to fill their full billing address and billing name." }, "customer_name": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Customer Name", "description": "Name of the customer." }, "customer_email": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Customer Email", "description": "Email address of the customer." }, "customer_ip_address": { "anyOf": [ { "type": "string", "format": "ipvanyaddress" }, { "type": "null" } ], "title": "Customer Ip Address" }, "customer_billing_name": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Customer Billing Name" }, "customer_billing_address": { "anyOf": [ { "$ref": "#/components/schemas/Address", "description": "Billing address of the customer." }, { "type": "null" } ] }, "customer_tax_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Customer Tax Id" }, "locale": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Locale" }, "payment_processor_metadata": { "additionalProperties": { "type": "string" }, "type": "object", "title": "Payment Processor Metadata" }, "billing_address_fields": { "$ref": "#/components/schemas/CheckoutBillingAddressFields", "description": "Determine which billing address fields should be disabled, optional or required in the checkout form." }, "trial_interval": { "anyOf": [ { "$ref": "#/components/schemas/TrialInterval" }, { "type": "null" } ], "description": "The interval unit for the trial period." }, "trial_interval_count": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Trial Interval Count", "description": "The number of interval units for the trial period." }, "metadata": { "$ref": "#/components/schemas/MetadataOutputType" }, "external_customer_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "External Customer Id", "description": "ID of the customer in your system. If a matching customer exists on Polar, the resulting order will be linked to this customer. Otherwise, a new customer will be created with this external ID set." }, "products": { "items": { "$ref": "#/components/schemas/CheckoutProduct" }, "type": "array", "title": "Products", "description": "List of products available to select." }, "product": { "anyOf": [ { "$ref": "#/components/schemas/CheckoutProduct" }, { "type": "null" } ], "description": "Product selected to checkout." }, "product_price": { "anyOf": [ { "oneOf": [ { "$ref": "#/components/schemas/LegacyRecurringProductPrice" }, { "$ref": "#/components/schemas/ProductPrice" } ] }, { "type": "null" } ], "title": "Product Price", "description": "Price of the selected product.", "deprecated": true }, "prices": { "anyOf": [ { "additionalProperties": { "items": { "oneOf": [ { "$ref": "#/components/schemas/LegacyRecurringProductPrice" }, { "$ref": "#/components/schemas/ProductPrice" } ] }, "type": "array", "description": "List of prices for this product." }, "propertyNames": { "format": "uuid4" }, "type": "object" }, { "type": "null" } ], "title": "Prices", "description": "Mapping of product IDs to their list of prices." }, "discount": { "anyOf": [ { "oneOf": [ { "$ref": "#/components/schemas/CheckoutDiscountFixedOnceForeverDuration" }, { "$ref": "#/components/schemas/CheckoutDiscountFixedRepeatDuration" }, { "$ref": "#/components/schemas/CheckoutDiscountPercentageOnceForeverDuration" }, { "$ref": "#/components/schemas/CheckoutDiscountPercentageRepeatDuration" } ] }, { "type": "null" } ], "title": "Discount" }, "subscription_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Subscription Id" }, "attached_custom_fields": { "anyOf": [ { "items": { "$ref": "#/components/schemas/AttachedCustomField" }, "type": "array" }, { "type": "null" } ], "title": "Attached Custom Fields" }, "customer_metadata": { "additionalProperties": { "anyOf": [ { "type": "string" }, { "type": "integer" }, { "type": "boolean" } ] }, "type": "object", "title": "Customer Metadata" } }, "type": "object", "required": [ "id", "created_at", "modified_at", "payment_processor", "status", "client_secret", "url", "expires_at", "success_url", "return_url", "embed_origin", "amount", "discount_amount", "net_amount", "tax_amount", "total_amount", "currency", "allow_trial", "active_trial_interval", "active_trial_interval_count", "trial_end", "organization_id", "product_id", "product_price_id", "discount_id", "allow_discount_codes", "require_billing_address", "is_discount_applicable", "is_free_product_price", "is_payment_required", "is_payment_setup_required", "is_payment_form_required", "customer_id", "is_business_customer", "customer_name", "customer_email", "customer_ip_address", "customer_billing_name", "customer_billing_address", "customer_tax_id", "payment_processor_metadata", "billing_address_fields", "trial_interval", "trial_interval_count", "metadata", "external_customer_id", "products", "product", "product_price", "prices", "discount", "subscription_id", "attached_custom_fields", "customer_metadata" ], "title": "Checkout", "description": "Checkout session data retrieved using an access token." }, "CheckoutBillingAddressFields": { "properties": { "country": { "$ref": "#/components/schemas/BillingAddressFieldMode" }, "state": { "$ref": "#/components/schemas/BillingAddressFieldMode" }, "city": { "$ref": "#/components/schemas/BillingAddressFieldMode" }, "postal_code": { "$ref": "#/components/schemas/BillingAddressFieldMode" }, "line1": { "$ref": "#/components/schemas/BillingAddressFieldMode" }, "line2": { "$ref": "#/components/schemas/BillingAddressFieldMode" } }, "type": "object", "required": [ "country", "state", "city", "postal_code", "line1", "line2" ], "title": "CheckoutBillingAddressFields" }, "CheckoutConfirmStripe": { "properties": { "custom_field_data": { "additionalProperties": { "anyOf": [ { "type": "string" }, { "type": "integer" }, { "type": "boolean" }, { "type": "string", "format": "date-time" }, { "type": "null" } ] }, "type": "object", "title": "Custom Field Data", "description": "Key-value object storing custom field values." }, "product_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Product Id", "description": "ID of the product to checkout. Must be present in the checkout's product list." }, "product_price_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Product Price Id", "description": "ID of the product price to checkout. Must correspond to a price present in the checkout's product list.", "deprecated": true }, "amount": { "anyOf": [ { "type": "integer", "maximum": 99999999, "minimum": 0, "description": "Amount in cents, before discounts and taxes. Only useful for custom prices, it'll be ignored for fixed and free prices. " }, { "type": "null" } ], "title": "Amount" }, "seats": { "anyOf": [ { "type": "integer", "maximum": 1000, "minimum": 1 }, { "type": "null" } ], "title": "Seats", "description": "Number of seats for seat-based pricing." }, "is_business_customer": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "title": "Is Business Customer" }, "customer_name": { "anyOf": [ { "type": "string", "maxLength": 256, "description": "The name of the customer.", "examples": [ "John Doe" ] }, { "type": "null" } ], "title": "Customer Name" }, "customer_email": { "anyOf": [ { "type": "string", "format": "email", "description": "Email address of the customer." }, { "type": "null" } ], "title": "Customer Email" }, "customer_billing_name": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Customer Billing Name" }, "customer_billing_address": { "anyOf": [ { "$ref": "#/components/schemas/AddressInput", "description": "Billing address of the customer." }, { "type": "null" } ] }, "customer_tax_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Customer Tax Id" }, "locale": { "anyOf": [ { "type": "string", "pattern": "^[a-zA-Z]{2,3}(-[a-zA-Z]{2}|-[0-9]{3})?$", "description": "Locale of the customer, given as an IETF BCP 47 language tag. Supported: language code (e.g. `en`) or language + region (e.g. `en-US`). If `null` or unsupported, the locale will default to `en-US`.", "examples": [ "en", "en-US", "fr", "fr-CA" ] }, { "type": "null" } ], "title": "Locale" }, "discount_code": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Discount Code", "description": "Discount code to apply to the checkout." }, "allow_trial": { "anyOf": [ { "type": "boolean", "const": false }, { "type": "null" } ], "title": "Allow Trial", "description": "Disable the trial period for the checkout session. It's mainly useful when the trial is blocked because the customer already redeemed one." }, "confirmation_token_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Confirmation Token Id", "description": "ID of the Stripe confirmation token. Required for fixed prices and custom prices." } }, "type": "object", "title": "CheckoutConfirmStripe", "description": "Confirm a checkout session using a Stripe confirmation token." }, "CheckoutCreate": { "$ref": "#/components/schemas/CheckoutProductsCreate" }, "CheckoutCreatedEvent": { "properties": { "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "timestamp": { "type": "string", "format": "date-time", "title": "Timestamp", "description": "The timestamp of the event." }, "organization_id": { "type": "string", "format": "uuid4", "title": "Organization Id", "description": "The ID of the organization owning the event.", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "x-polar-selector-widget": { "displayProperty": "name", "resourceName": "Organization", "resourceRoot": "/v1/organizations" } }, "customer_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Customer Id", "description": "ID of the customer in your Polar organization associated with the event." }, "customer": { "anyOf": [ { "$ref": "#/components/schemas/Customer" }, { "type": "null" } ], "description": "The customer associated with the event." }, "external_customer_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "External Customer Id", "description": "ID of the customer in your system associated with the event." }, "member_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Member Id", "description": "ID of the member within the customer's organization who performed the action inside B2B." }, "external_member_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "External Member Id", "description": "ID of the member in your system within the customer's organization who performed the action inside B2B." }, "child_count": { "type": "integer", "title": "Child Count", "description": "Number of direct child events linked to this event.", "default": 0 }, "parent_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Parent Id", "description": "The ID of the parent event." }, "label": { "type": "string", "title": "Label", "description": "Human readable label of the event type." }, "source": { "type": "string", "const": "system", "title": "Source", "description": "The source of the event. `system` events are created by Polar. `user` events are the one you create through our ingestion API." }, "name": { "type": "string", "const": "checkout.created", "title": "Name", "description": "The name of the event." }, "metadata": { "$ref": "#/components/schemas/CheckoutCreatedMetadata" } }, "type": "object", "required": [ "id", "timestamp", "organization_id", "customer_id", "customer", "external_customer_id", "label", "source", "name", "metadata" ], "title": "CheckoutCreatedEvent", "description": "An event created by Polar when a checkout is created." }, "CheckoutCreatedMetadata": { "properties": { "checkout_id": { "type": "string", "title": "Checkout Id" }, "checkout_status": { "type": "string", "title": "Checkout Status" }, "product_id": { "type": "string", "title": "Product Id" } }, "type": "object", "required": [ "checkout_id", "checkout_status" ], "title": "CheckoutCreatedMetadata" }, "CheckoutCustomerBillingAddressFields": { "properties": { "country": { "type": "boolean", "title": "Country" }, "state": { "type": "boolean", "title": "State" }, "city": { "type": "boolean", "title": "City" }, "postal_code": { "type": "boolean", "title": "Postal Code" }, "line1": { "type": "boolean", "title": "Line1" }, "line2": { "type": "boolean", "title": "Line2" } }, "type": "object", "required": [ "country", "state", "city", "postal_code", "line1", "line2" ], "title": "CheckoutCustomerBillingAddressFields", "description": "Deprecated: Use CheckoutBillingAddressFields instead." }, "CheckoutDiscountFixedOnceForeverDuration": { "properties": { "duration": { "$ref": "#/components/schemas/DiscountDuration" }, "type": { "$ref": "#/components/schemas/DiscountType" }, "amount": { "type": "integer", "title": "Amount", "examples": [ 1000 ] }, "currency": { "type": "string", "title": "Currency", "examples": [ "usd" ] }, "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "name": { "type": "string", "title": "Name" }, "code": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Code" } }, "type": "object", "required": [ "duration", "type", "amount", "currency", "id", "name", "code" ], "title": "CheckoutDiscountFixedOnceForeverDuration", "description": "Schema for a fixed amount discount that is applied once or forever." }, "CheckoutDiscountFixedRepeatDuration": { "properties": { "duration": { "$ref": "#/components/schemas/DiscountDuration" }, "duration_in_months": { "type": "integer", "title": "Duration In Months" }, "type": { "$ref": "#/components/schemas/DiscountType" }, "amount": { "type": "integer", "title": "Amount", "examples": [ 1000 ] }, "currency": { "type": "string", "title": "Currency", "examples": [ "usd" ] }, "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "name": { "type": "string", "title": "Name" }, "code": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Code" } }, "type": "object", "required": [ "duration", "duration_in_months", "type", "amount", "currency", "id", "name", "code" ], "title": "CheckoutDiscountFixedRepeatDuration", "description": "Schema for a fixed amount discount that is applied on every invoice\nfor a certain number of months." }, "CheckoutDiscountPercentageOnceForeverDuration": { "properties": { "duration": { "$ref": "#/components/schemas/DiscountDuration" }, "type": { "$ref": "#/components/schemas/DiscountType" }, "basis_points": { "type": "integer", "title": "Basis Points", "description": "Discount percentage in basis points. A basis point is 1/100th of a percent. For example, 1000 basis points equals a 10% discount.", "examples": [ 1000 ] }, "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "name": { "type": "string", "title": "Name" }, "code": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Code" } }, "type": "object", "required": [ "duration", "type", "basis_points", "id", "name", "code" ], "title": "CheckoutDiscountPercentageOnceForeverDuration", "description": "Schema for a percentage discount that is applied once or forever." }, "CheckoutDiscountPercentageRepeatDuration": { "properties": { "duration": { "$ref": "#/components/schemas/DiscountDuration" }, "duration_in_months": { "type": "integer", "title": "Duration In Months" }, "type": { "$ref": "#/components/schemas/DiscountType" }, "basis_points": { "type": "integer", "title": "Basis Points", "description": "Discount percentage in basis points. A basis point is 1/100th of a percent. For example, 1000 basis points equals a 10% discount.", "examples": [ 1000 ] }, "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "name": { "type": "string", "title": "Name" }, "code": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Code" } }, "type": "object", "required": [ "duration", "duration_in_months", "type", "basis_points", "id", "name", "code" ], "title": "CheckoutDiscountPercentageRepeatDuration", "description": "Schema for a percentage discount that is applied on every invoice\nfor a certain number of months." }, "CheckoutForbiddenError": { "anyOf": [ { "$ref": "#/components/schemas/AlreadyActiveSubscriptionError" }, { "$ref": "#/components/schemas/NotOpenCheckout" }, { "$ref": "#/components/schemas/PaymentNotReady" }, { "$ref": "#/components/schemas/TrialAlreadyRedeemed" } ] }, "CheckoutLink": { "properties": { "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "trial_interval": { "anyOf": [ { "$ref": "#/components/schemas/TrialInterval" }, { "type": "null" } ], "description": "The interval unit for the trial period." }, "trial_interval_count": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Trial Interval Count", "description": "The number of interval units for the trial period." }, "metadata": { "$ref": "#/components/schemas/MetadataOutputType" }, "payment_processor": { "$ref": "#/components/schemas/PaymentProcessor", "description": "Payment processor used." }, "client_secret": { "type": "string", "title": "Client Secret", "description": "Client secret used to access the checkout link." }, "success_url": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Success Url", "description": "URL where the customer will be redirected after a successful payment." }, "return_url": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Return Url", "description": "When set, a back button will be shown in the checkout to return to this URL." }, "label": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Label", "description": "Optional label to distinguish links internally" }, "allow_discount_codes": { "type": "boolean", "title": "Allow Discount Codes", "description": "Whether to allow the customer to apply discount codes. If you apply a discount through `discount_id`, it'll still be applied, but the customer won't be able to change it." }, "require_billing_address": { "type": "boolean", "title": "Require Billing Address", "description": "Whether to require the customer to fill their full billing address, instead of just the country. Customers in the US will always be required to fill their full address, regardless of this setting." }, "discount_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Discount Id", "description": "ID of the discount to apply to the checkout. If the discount is not applicable anymore when opening the checkout link, it'll be ignored." }, "organization_id": { "type": "string", "format": "uuid4", "title": "Organization Id", "description": "The organization ID.", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "x-polar-selector-widget": { "displayProperty": "name", "resourceName": "Organization", "resourceRoot": "/v1/organizations" } }, "products": { "items": { "$ref": "#/components/schemas/CheckoutLinkProduct" }, "type": "array", "title": "Products" }, "discount": { "anyOf": [ { "oneOf": [ { "$ref": "#/components/schemas/DiscountFixedOnceForeverDurationBase" }, { "$ref": "#/components/schemas/DiscountFixedRepeatDurationBase" }, { "$ref": "#/components/schemas/DiscountPercentageOnceForeverDurationBase" }, { "$ref": "#/components/schemas/DiscountPercentageRepeatDurationBase" } ], "title": "CheckoutLinkDiscount" }, { "type": "null" } ], "title": "Discount" }, "url": { "type": "string", "title": "Url" } }, "type": "object", "required": [ "id", "created_at", "modified_at", "trial_interval", "trial_interval_count", "metadata", "payment_processor", "client_secret", "success_url", "return_url", "label", "allow_discount_codes", "require_billing_address", "discount_id", "organization_id", "products", "discount", "url" ], "title": "CheckoutLink", "description": "Checkout link data." }, "CheckoutLinkCreate": { "anyOf": [ { "$ref": "#/components/schemas/CheckoutLinkCreateProductPrice" }, { "$ref": "#/components/schemas/CheckoutLinkCreateProduct" }, { "$ref": "#/components/schemas/CheckoutLinkCreateProducts" } ] }, "CheckoutLinkCreateProduct": { "properties": { "metadata": { "additionalProperties": { "anyOf": [ { "type": "string", "maxLength": 500, "minLength": 1 }, { "type": "integer" }, { "type": "number" }, { "type": "boolean" } ] }, "propertyNames": { "maxLength": 40, "minLength": 1 }, "type": "object", "maxProperties": 50, "title": "Metadata", "description": "Key-value object allowing you to store additional information.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**." }, "trial_interval": { "anyOf": [ { "$ref": "#/components/schemas/TrialInterval" }, { "type": "null" } ], "description": "The interval unit for the trial period." }, "trial_interval_count": { "anyOf": [ { "type": "integer", "maximum": 1000, "minimum": 1 }, { "type": "null" } ], "title": "Trial Interval Count", "description": "The number of interval units for the trial period." }, "payment_processor": { "type": "string", "const": "stripe", "title": "Payment Processor", "description": "Payment processor to use. Currently only Stripe is supported." }, "label": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Label", "description": "Optional label to distinguish links internally" }, "allow_discount_codes": { "type": "boolean", "title": "Allow Discount Codes", "description": "Whether to allow the customer to apply discount codes. If you apply a discount through `discount_id`, it'll still be applied, but the customer won't be able to change it.", "default": true }, "require_billing_address": { "type": "boolean", "title": "Require Billing Address", "description": "Whether to require the customer to fill their full billing address, instead of just the country. Customers in the US will always be required to fill their full address, regardless of this setting.", "default": false }, "discount_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Discount Id", "description": "ID of the discount to apply to the checkout. If the discount is not applicable anymore when opening the checkout link, it'll be ignored." }, "success_url": { "anyOf": [ { "type": "string", "maxLength": 2083, "minLength": 1, "format": "uri" }, { "type": "null" } ], "title": "Success Url", "description": "URL where the customer will be redirected after a successful payment.You can add the `checkout_id={CHECKOUT_ID}` query parameter to retrieve the checkout session id." }, "return_url": { "anyOf": [ { "type": "string", "maxLength": 2083, "minLength": 1, "format": "uri" }, { "type": "null" } ], "title": "Return Url", "description": "When set, a back button will be shown in the checkout to return to this URL." }, "product_id": { "type": "string", "format": "uuid4", "title": "Product Id" } }, "type": "object", "required": [ "payment_processor", "product_id" ], "title": "CheckoutLinkCreateProduct", "description": "Schema to create a new checkout link from a a single product.\n\n**Deprecated**: Use `CheckoutLinkCreateProducts` instead." }, "CheckoutLinkCreateProductPrice": { "properties": { "metadata": { "additionalProperties": { "anyOf": [ { "type": "string", "maxLength": 500, "minLength": 1 }, { "type": "integer" }, { "type": "number" }, { "type": "boolean" } ] }, "propertyNames": { "maxLength": 40, "minLength": 1 }, "type": "object", "maxProperties": 50, "title": "Metadata", "description": "Key-value object allowing you to store additional information.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**." }, "trial_interval": { "anyOf": [ { "$ref": "#/components/schemas/TrialInterval" }, { "type": "null" } ], "description": "The interval unit for the trial period." }, "trial_interval_count": { "anyOf": [ { "type": "integer", "maximum": 1000, "minimum": 1 }, { "type": "null" } ], "title": "Trial Interval Count", "description": "The number of interval units for the trial period." }, "payment_processor": { "type": "string", "const": "stripe", "title": "Payment Processor", "description": "Payment processor to use. Currently only Stripe is supported." }, "label": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Label", "description": "Optional label to distinguish links internally" }, "allow_discount_codes": { "type": "boolean", "title": "Allow Discount Codes", "description": "Whether to allow the customer to apply discount codes. If you apply a discount through `discount_id`, it'll still be applied, but the customer won't be able to change it.", "default": true }, "require_billing_address": { "type": "boolean", "title": "Require Billing Address", "description": "Whether to require the customer to fill their full billing address, instead of just the country. Customers in the US will always be required to fill their full address, regardless of this setting.", "default": false }, "discount_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Discount Id", "description": "ID of the discount to apply to the checkout. If the discount is not applicable anymore when opening the checkout link, it'll be ignored." }, "success_url": { "anyOf": [ { "type": "string", "maxLength": 2083, "minLength": 1, "format": "uri" }, { "type": "null" } ], "title": "Success Url", "description": "URL where the customer will be redirected after a successful payment.You can add the `checkout_id={CHECKOUT_ID}` query parameter to retrieve the checkout session id." }, "return_url": { "anyOf": [ { "type": "string", "maxLength": 2083, "minLength": 1, "format": "uri" }, { "type": "null" } ], "title": "Return Url", "description": "When set, a back button will be shown in the checkout to return to this URL." }, "product_price_id": { "type": "string", "format": "uuid4", "title": "Product Price Id" } }, "type": "object", "required": [ "payment_processor", "product_price_id" ], "title": "CheckoutLinkCreateProductPrice", "description": "Schema to create a new checkout link from a a single product price.\n\n**Deprecated**: Use `CheckoutLinkCreateProducts` instead." }, "CheckoutLinkCreateProducts": { "properties": { "metadata": { "additionalProperties": { "anyOf": [ { "type": "string", "maxLength": 500, "minLength": 1 }, { "type": "integer" }, { "type": "number" }, { "type": "boolean" } ] }, "propertyNames": { "maxLength": 40, "minLength": 1 }, "type": "object", "maxProperties": 50, "title": "Metadata", "description": "Key-value object allowing you to store additional information.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**." }, "trial_interval": { "anyOf": [ { "$ref": "#/components/schemas/TrialInterval" }, { "type": "null" } ], "description": "The interval unit for the trial period." }, "trial_interval_count": { "anyOf": [ { "type": "integer", "maximum": 1000, "minimum": 1 }, { "type": "null" } ], "title": "Trial Interval Count", "description": "The number of interval units for the trial period." }, "payment_processor": { "type": "string", "const": "stripe", "title": "Payment Processor", "description": "Payment processor to use. Currently only Stripe is supported." }, "label": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Label", "description": "Optional label to distinguish links internally" }, "allow_discount_codes": { "type": "boolean", "title": "Allow Discount Codes", "description": "Whether to allow the customer to apply discount codes. If you apply a discount through `discount_id`, it'll still be applied, but the customer won't be able to change it.", "default": true }, "require_billing_address": { "type": "boolean", "title": "Require Billing Address", "description": "Whether to require the customer to fill their full billing address, instead of just the country. Customers in the US will always be required to fill their full address, regardless of this setting.", "default": false }, "discount_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Discount Id", "description": "ID of the discount to apply to the checkout. If the discount is not applicable anymore when opening the checkout link, it'll be ignored." }, "success_url": { "anyOf": [ { "type": "string", "maxLength": 2083, "minLength": 1, "format": "uri" }, { "type": "null" } ], "title": "Success Url", "description": "URL where the customer will be redirected after a successful payment.You can add the `checkout_id={CHECKOUT_ID}` query parameter to retrieve the checkout session id." }, "return_url": { "anyOf": [ { "type": "string", "maxLength": 2083, "minLength": 1, "format": "uri" }, { "type": "null" } ], "title": "Return Url", "description": "When set, a back button will be shown in the checkout to return to this URL." }, "products": { "items": { "type": "string", "format": "uuid4" }, "type": "array", "minItems": 1, "title": "Products", "description": "List of products that will be available to select at checkout." } }, "type": "object", "required": [ "payment_processor", "products" ], "title": "CheckoutLinkCreateProducts", "description": "Schema to create a new checkout link." }, "CheckoutLinkProduct": { "properties": { "metadata": { "$ref": "#/components/schemas/MetadataOutputType" }, "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "trial_interval": { "anyOf": [ { "$ref": "#/components/schemas/TrialInterval" }, { "type": "null" } ], "description": "The interval unit for the trial period." }, "trial_interval_count": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Trial Interval Count", "description": "The number of interval units for the trial period." }, "name": { "type": "string", "title": "Name", "description": "The name of the product." }, "description": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Description", "description": "The description of the product." }, "visibility": { "$ref": "#/components/schemas/ProductVisibility", "description": "The visibility of the product." }, "recurring_interval": { "anyOf": [ { "$ref": "#/components/schemas/SubscriptionRecurringInterval" }, { "type": "null" } ], "description": "The recurring interval of the product. If `None`, the product is a one-time purchase." }, "recurring_interval_count": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Recurring Interval Count", "description": "Number of interval units of the subscription. If this is set to 1 the charge will happen every interval (e.g. every month), if set to 2 it will be every other month, and so on. None for one-time products." }, "is_recurring": { "type": "boolean", "title": "Is Recurring", "description": "Whether the product is a subscription." }, "is_archived": { "type": "boolean", "title": "Is Archived", "description": "Whether the product is archived and no longer available." }, "organization_id": { "type": "string", "format": "uuid4", "title": "Organization Id", "description": "The ID of the organization owning the product." }, "prices": { "items": { "oneOf": [ { "$ref": "#/components/schemas/LegacyRecurringProductPrice" }, { "$ref": "#/components/schemas/ProductPrice" } ] }, "type": "array", "title": "Prices", "description": "List of prices for this product." }, "benefits": { "items": { "$ref": "#/components/schemas/BenefitPublic" }, "type": "array", "title": "BenefitPublic", "description": "List of benefits granted by the product." }, "medias": { "items": { "$ref": "#/components/schemas/ProductMediaFileRead" }, "type": "array", "title": "Medias", "description": "List of medias associated to the product." } }, "type": "object", "required": [ "metadata", "id", "created_at", "modified_at", "trial_interval", "trial_interval_count", "name", "description", "visibility", "recurring_interval", "recurring_interval_count", "is_recurring", "is_archived", "organization_id", "prices", "benefits", "medias" ], "title": "CheckoutLinkProduct", "description": "Product data for a checkout link." }, "CheckoutLinkSortProperty": { "type": "string", "enum": [ "created_at", "-created_at", "label", "-label", "success_url", "-success_url", "allow_discount_codes", "-allow_discount_codes" ], "title": "CheckoutLinkSortProperty" }, "CheckoutLinkUpdate": { "properties": { "trial_interval": { "anyOf": [ { "$ref": "#/components/schemas/TrialInterval" }, { "type": "null" } ], "description": "The interval unit for the trial period." }, "trial_interval_count": { "anyOf": [ { "type": "integer", "maximum": 1000, "minimum": 1 }, { "type": "null" } ], "title": "Trial Interval Count", "description": "The number of interval units for the trial period." }, "metadata": { "additionalProperties": { "anyOf": [ { "type": "string", "maxLength": 500, "minLength": 1 }, { "type": "integer" }, { "type": "number" }, { "type": "boolean" } ] }, "propertyNames": { "maxLength": 40, "minLength": 1 }, "type": "object", "maxProperties": 50, "title": "Metadata", "description": "Key-value object allowing you to store additional information.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**." }, "products": { "anyOf": [ { "items": { "type": "string", "format": "uuid4" }, "type": "array", "minItems": 1 }, { "type": "null" } ], "title": "Products", "description": "List of products that will be available to select at checkout." }, "label": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Label" }, "allow_discount_codes": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "title": "Allow Discount Codes", "description": "Whether to allow the customer to apply discount codes. If you apply a discount through `discount_id`, it'll still be applied, but the customer won't be able to change it." }, "require_billing_address": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "title": "Require Billing Address", "description": "Whether to require the customer to fill their full billing address, instead of just the country. Customers in the US will always be required to fill their full address, regardless of this setting." }, "discount_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Discount Id", "description": "ID of the discount to apply to the checkout. If the discount is not applicable anymore when opening the checkout link, it'll be ignored." }, "success_url": { "anyOf": [ { "type": "string", "maxLength": 2083, "minLength": 1, "format": "uri" }, { "type": "null" } ], "title": "Success Url", "description": "URL where the customer will be redirected after a successful payment.You can add the `checkout_id={CHECKOUT_ID}` query parameter to retrieve the checkout session id." }, "return_url": { "anyOf": [ { "type": "string", "maxLength": 2083, "minLength": 1, "format": "uri" }, { "type": "null" } ], "title": "Return Url", "description": "When set, a back button will be shown in the checkout to return to this URL." } }, "type": "object", "title": "CheckoutLinkUpdate", "description": "Schema to update an existing checkout link." }, "CheckoutOrganization": { "properties": { "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "name": { "type": "string", "title": "Name", "description": "Organization name shown in checkout, customer portal, emails etc." }, "slug": { "type": "string", "title": "Slug", "description": "Unique organization slug in checkout, customer portal and credit card statements." }, "avatar_url": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Avatar Url", "description": "Avatar URL shown in checkout, customer portal, emails etc." }, "proration_behavior": { "$ref": "#/components/schemas/SubscriptionProrationBehavior", "description": "Proration behavior applied when customer updates their subscription from the portal." }, "allow_customer_updates": { "type": "boolean", "title": "Allow Customer Updates", "description": "Whether customers can update their subscriptions from the customer portal." } }, "type": "object", "required": [ "created_at", "modified_at", "id", "name", "slug", "avatar_url", "proration_behavior", "allow_customer_updates" ], "title": "CheckoutOrganization" }, "CheckoutPriceCreate": { "properties": { "trial_interval": { "anyOf": [ { "$ref": "#/components/schemas/TrialInterval" }, { "type": "null" } ], "description": "The interval unit for the trial period." }, "trial_interval_count": { "anyOf": [ { "type": "integer", "maximum": 1000, "minimum": 1 }, { "type": "null" } ], "title": "Trial Interval Count", "description": "The number of interval units for the trial period." }, "metadata": { "additionalProperties": { "anyOf": [ { "type": "string", "maxLength": 500, "minLength": 1 }, { "type": "integer" }, { "type": "number" }, { "type": "boolean" } ] }, "propertyNames": { "maxLength": 40, "minLength": 1 }, "type": "object", "maxProperties": 50, "title": "Metadata", "description": "Key-value object allowing you to store additional information.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**." }, "custom_field_data": { "additionalProperties": { "anyOf": [ { "type": "string" }, { "type": "integer" }, { "type": "boolean" }, { "type": "string", "format": "date-time" }, { "type": "null" } ] }, "type": "object", "title": "Custom Field Data", "description": "Key-value object storing custom field values." }, "discount_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Discount Id", "description": "ID of the discount to apply to the checkout." }, "allow_discount_codes": { "type": "boolean", "title": "Allow Discount Codes", "description": "Whether to allow the customer to apply discount codes. If you apply a discount through `discount_id`, it'll still be applied, but the customer won't be able to change it.", "default": true }, "require_billing_address": { "type": "boolean", "title": "Require Billing Address", "description": "Whether to require the customer to fill their full billing address, instead of just the country. Customers in the US will always be required to fill their full address, regardless of this setting. If you preset the billing address, this setting will be automatically set to `true`.", "default": false }, "amount": { "anyOf": [ { "type": "integer", "maximum": 99999999, "minimum": 0, "description": "Amount in cents, before discounts and taxes. Only useful for custom prices, it'll be ignored for fixed and free prices. " }, { "type": "null" } ], "title": "Amount" }, "seats": { "anyOf": [ { "type": "integer", "maximum": 1000, "minimum": 1 }, { "type": "null" } ], "title": "Seats", "description": "Predefined number of seats (works with seat-based pricing only)" }, "min_seats": { "anyOf": [ { "type": "integer", "maximum": 1000, "minimum": 1 }, { "type": "null" } ], "title": "Min Seats", "description": "Minimum number of seats (works with seat-based pricing only)" }, "max_seats": { "anyOf": [ { "type": "integer", "maximum": 1000, "minimum": 1 }, { "type": "null" } ], "title": "Max Seats", "description": "Maximum number of seats (works with seat-based pricing only)" }, "allow_trial": { "type": "boolean", "title": "Allow Trial", "description": "Whether to enable the trial period for the checkout session. If `false`, the trial period will be disabled, even if the selected product has a trial configured.", "default": true }, "customer_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Customer Id", "description": "ID of an existing customer in the organization. The customer data will be pre-filled in the checkout form. The resulting order will be linked to this customer." }, "is_business_customer": { "type": "boolean", "title": "Is Business Customer", "description": "Whether the customer is a business or an individual. If `true`, the customer will be required to fill their full billing address and billing name.", "default": false }, "external_customer_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "External Customer Id", "description": "ID of the customer in your system. If a matching customer exists on Polar, the resulting order will be linked to this customer. Otherwise, a new customer will be created with this external ID set." }, "customer_name": { "anyOf": [ { "type": "string", "maxLength": 256, "description": "The name of the customer.", "examples": [ "John Doe" ] }, { "type": "null" } ], "title": "Customer Name" }, "customer_email": { "anyOf": [ { "type": "string", "format": "email", "description": "Email address of the customer." }, { "type": "null" } ], "title": "Customer Email" }, "customer_ip_address": { "anyOf": [ { "type": "string", "format": "ipvanyaddress" }, { "type": "null" } ], "title": "Customer Ip Address" }, "customer_billing_name": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Customer Billing Name" }, "customer_billing_address": { "anyOf": [ { "$ref": "#/components/schemas/AddressInput", "description": "Billing address of the customer." }, { "type": "null" } ] }, "customer_tax_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Customer Tax Id" }, "customer_metadata": { "additionalProperties": { "anyOf": [ { "type": "string", "maxLength": 500, "minLength": 1 }, { "type": "integer" }, { "type": "number" }, { "type": "boolean" } ] }, "propertyNames": { "maxLength": 40, "minLength": 1 }, "type": "object", "maxProperties": 50, "title": "Customer Metadata", "description": "Key-value object allowing you to store additional information that'll be copied to the created customer.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**." }, "subscription_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Subscription Id", "description": "ID of a subscription to upgrade. It must be on a free pricing. If checkout is successful, metadata set on this checkout will be copied to the subscription, and existing keys will be overwritten." }, "success_url": { "anyOf": [ { "type": "string", "maxLength": 2083, "minLength": 1, "format": "uri" }, { "type": "null" } ], "title": "Success Url", "description": "URL where the customer will be redirected after a successful payment.You can add the `checkout_id={CHECKOUT_ID}` query parameter to retrieve the checkout session id." }, "return_url": { "anyOf": [ { "type": "string", "maxLength": 2083, "minLength": 1, "format": "uri" }, { "type": "null" } ], "title": "Return Url", "description": "When set, a back button will be shown in the checkout to return to this URL." }, "embed_origin": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Embed Origin", "description": "If you plan to embed the checkout session, set this to the Origin of the embedding page. It'll allow the Polar iframe to communicate with the parent page." }, "locale": { "anyOf": [ { "type": "string", "pattern": "^[a-zA-Z]{2,3}(-[a-zA-Z]{2}|-[0-9]{3})?$", "description": "Locale of the customer, given as an IETF BCP 47 language tag. Supported: language code (e.g. `en`) or language + region (e.g. `en-US`). If `null` or unsupported, the locale will default to `en-US`.", "examples": [ "en", "en-US", "fr", "fr-CA" ] }, { "type": "null" } ], "title": "Locale" }, "product_price_id": { "type": "string", "format": "uuid4", "title": "Product Price Id", "description": "ID of the product price to checkout." } }, "type": "object", "required": [ "product_price_id" ], "title": "CheckoutPriceCreate", "description": "Create a new checkout session from a product price.\n\n**Deprecated**: Use `CheckoutProductsCreate` instead.\n\nMetadata set on the checkout will be copied\nto the resulting order and/or subscription." }, "CheckoutProduct": { "properties": { "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "trial_interval": { "anyOf": [ { "$ref": "#/components/schemas/TrialInterval" }, { "type": "null" } ], "description": "The interval unit for the trial period." }, "trial_interval_count": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Trial Interval Count", "description": "The number of interval units for the trial period." }, "name": { "type": "string", "title": "Name", "description": "The name of the product." }, "description": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Description", "description": "The description of the product." }, "visibility": { "$ref": "#/components/schemas/ProductVisibility", "description": "The visibility of the product." }, "recurring_interval": { "anyOf": [ { "$ref": "#/components/schemas/SubscriptionRecurringInterval" }, { "type": "null" } ], "description": "The recurring interval of the product. If `None`, the product is a one-time purchase." }, "recurring_interval_count": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Recurring Interval Count", "description": "Number of interval units of the subscription. If this is set to 1 the charge will happen every interval (e.g. every month), if set to 2 it will be every other month, and so on. None for one-time products." }, "is_recurring": { "type": "boolean", "title": "Is Recurring", "description": "Whether the product is a subscription." }, "is_archived": { "type": "boolean", "title": "Is Archived", "description": "Whether the product is archived and no longer available." }, "organization_id": { "type": "string", "format": "uuid4", "title": "Organization Id", "description": "The ID of the organization owning the product." }, "prices": { "items": { "oneOf": [ { "$ref": "#/components/schemas/LegacyRecurringProductPrice" }, { "$ref": "#/components/schemas/ProductPrice" } ] }, "type": "array", "title": "Prices", "description": "List of prices for this product." }, "benefits": { "items": { "$ref": "#/components/schemas/BenefitPublic" }, "type": "array", "title": "BenefitPublic", "description": "List of benefits granted by the product." }, "medias": { "items": { "$ref": "#/components/schemas/ProductMediaFileRead" }, "type": "array", "title": "Medias", "description": "List of medias associated to the product." } }, "type": "object", "required": [ "id", "created_at", "modified_at", "trial_interval", "trial_interval_count", "name", "description", "visibility", "recurring_interval", "recurring_interval_count", "is_recurring", "is_archived", "organization_id", "prices", "benefits", "medias" ], "title": "CheckoutProduct", "description": "Product data for a checkout session." }, "CheckoutProductCreate": { "properties": { "trial_interval": { "anyOf": [ { "$ref": "#/components/schemas/TrialInterval" }, { "type": "null" } ], "description": "The interval unit for the trial period." }, "trial_interval_count": { "anyOf": [ { "type": "integer", "maximum": 1000, "minimum": 1 }, { "type": "null" } ], "title": "Trial Interval Count", "description": "The number of interval units for the trial period." }, "metadata": { "additionalProperties": { "anyOf": [ { "type": "string", "maxLength": 500, "minLength": 1 }, { "type": "integer" }, { "type": "number" }, { "type": "boolean" } ] }, "propertyNames": { "maxLength": 40, "minLength": 1 }, "type": "object", "maxProperties": 50, "title": "Metadata", "description": "Key-value object allowing you to store additional information.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**." }, "custom_field_data": { "additionalProperties": { "anyOf": [ { "type": "string" }, { "type": "integer" }, { "type": "boolean" }, { "type": "string", "format": "date-time" }, { "type": "null" } ] }, "type": "object", "title": "Custom Field Data", "description": "Key-value object storing custom field values." }, "discount_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Discount Id", "description": "ID of the discount to apply to the checkout." }, "allow_discount_codes": { "type": "boolean", "title": "Allow Discount Codes", "description": "Whether to allow the customer to apply discount codes. If you apply a discount through `discount_id`, it'll still be applied, but the customer won't be able to change it.", "default": true }, "require_billing_address": { "type": "boolean", "title": "Require Billing Address", "description": "Whether to require the customer to fill their full billing address, instead of just the country. Customers in the US will always be required to fill their full address, regardless of this setting. If you preset the billing address, this setting will be automatically set to `true`.", "default": false }, "amount": { "anyOf": [ { "type": "integer", "maximum": 99999999, "minimum": 0, "description": "Amount in cents, before discounts and taxes. Only useful for custom prices, it'll be ignored for fixed and free prices. " }, { "type": "null" } ], "title": "Amount" }, "seats": { "anyOf": [ { "type": "integer", "maximum": 1000, "minimum": 1 }, { "type": "null" } ], "title": "Seats", "description": "Predefined number of seats (works with seat-based pricing only)" }, "min_seats": { "anyOf": [ { "type": "integer", "maximum": 1000, "minimum": 1 }, { "type": "null" } ], "title": "Min Seats", "description": "Minimum number of seats (works with seat-based pricing only)" }, "max_seats": { "anyOf": [ { "type": "integer", "maximum": 1000, "minimum": 1 }, { "type": "null" } ], "title": "Max Seats", "description": "Maximum number of seats (works with seat-based pricing only)" }, "allow_trial": { "type": "boolean", "title": "Allow Trial", "description": "Whether to enable the trial period for the checkout session. If `false`, the trial period will be disabled, even if the selected product has a trial configured.", "default": true }, "customer_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Customer Id", "description": "ID of an existing customer in the organization. The customer data will be pre-filled in the checkout form. The resulting order will be linked to this customer." }, "is_business_customer": { "type": "boolean", "title": "Is Business Customer", "description": "Whether the customer is a business or an individual. If `true`, the customer will be required to fill their full billing address and billing name.", "default": false }, "external_customer_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "External Customer Id", "description": "ID of the customer in your system. If a matching customer exists on Polar, the resulting order will be linked to this customer. Otherwise, a new customer will be created with this external ID set." }, "customer_name": { "anyOf": [ { "type": "string", "maxLength": 256, "description": "The name of the customer.", "examples": [ "John Doe" ] }, { "type": "null" } ], "title": "Customer Name" }, "customer_email": { "anyOf": [ { "type": "string", "format": "email", "description": "Email address of the customer." }, { "type": "null" } ], "title": "Customer Email" }, "customer_ip_address": { "anyOf": [ { "type": "string", "format": "ipvanyaddress" }, { "type": "null" } ], "title": "Customer Ip Address" }, "customer_billing_name": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Customer Billing Name" }, "customer_billing_address": { "anyOf": [ { "$ref": "#/components/schemas/AddressInput", "description": "Billing address of the customer." }, { "type": "null" } ] }, "customer_tax_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Customer Tax Id" }, "customer_metadata": { "additionalProperties": { "anyOf": [ { "type": "string", "maxLength": 500, "minLength": 1 }, { "type": "integer" }, { "type": "number" }, { "type": "boolean" } ] }, "propertyNames": { "maxLength": 40, "minLength": 1 }, "type": "object", "maxProperties": 50, "title": "Customer Metadata", "description": "Key-value object allowing you to store additional information that'll be copied to the created customer.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**." }, "subscription_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Subscription Id", "description": "ID of a subscription to upgrade. It must be on a free pricing. If checkout is successful, metadata set on this checkout will be copied to the subscription, and existing keys will be overwritten." }, "success_url": { "anyOf": [ { "type": "string", "maxLength": 2083, "minLength": 1, "format": "uri" }, { "type": "null" } ], "title": "Success Url", "description": "URL where the customer will be redirected after a successful payment.You can add the `checkout_id={CHECKOUT_ID}` query parameter to retrieve the checkout session id." }, "return_url": { "anyOf": [ { "type": "string", "maxLength": 2083, "minLength": 1, "format": "uri" }, { "type": "null" } ], "title": "Return Url", "description": "When set, a back button will be shown in the checkout to return to this URL." }, "embed_origin": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Embed Origin", "description": "If you plan to embed the checkout session, set this to the Origin of the embedding page. It'll allow the Polar iframe to communicate with the parent page." }, "locale": { "anyOf": [ { "type": "string", "pattern": "^[a-zA-Z]{2,3}(-[a-zA-Z]{2}|-[0-9]{3})?$", "description": "Locale of the customer, given as an IETF BCP 47 language tag. Supported: language code (e.g. `en`) or language + region (e.g. `en-US`). If `null` or unsupported, the locale will default to `en-US`.", "examples": [ "en", "en-US", "fr", "fr-CA" ] }, { "type": "null" } ], "title": "Locale" }, "currency": { "anyOf": [ { "$ref": "#/components/schemas/PresentmentCurrency", "maxLength": 3, "minLength": 3 }, { "type": "null" } ] }, "product_id": { "type": "string", "format": "uuid4", "title": "Product Id", "description": "ID of the product to checkout. First available price will be selected." } }, "type": "object", "required": [ "product_id" ], "title": "CheckoutProductCreate", "description": "Create a new checkout session from a product.\n\n**Deprecated**: Use `CheckoutProductsCreate` instead.\n\nMetadata set on the checkout will be copied\nto the resulting order and/or subscription." }, "CheckoutProductsCreate": { "properties": { "trial_interval": { "anyOf": [ { "$ref": "#/components/schemas/TrialInterval" }, { "type": "null" } ], "description": "The interval unit for the trial period." }, "trial_interval_count": { "anyOf": [ { "type": "integer", "maximum": 1000, "minimum": 1 }, { "type": "null" } ], "title": "Trial Interval Count", "description": "The number of interval units for the trial period." }, "metadata": { "additionalProperties": { "anyOf": [ { "type": "string", "maxLength": 500, "minLength": 1 }, { "type": "integer" }, { "type": "number" }, { "type": "boolean" } ] }, "propertyNames": { "maxLength": 40, "minLength": 1 }, "type": "object", "maxProperties": 50, "title": "Metadata", "description": "Key-value object allowing you to store additional information.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**." }, "custom_field_data": { "additionalProperties": { "anyOf": [ { "type": "string" }, { "type": "integer" }, { "type": "boolean" }, { "type": "string", "format": "date-time" }, { "type": "null" } ] }, "type": "object", "title": "Custom Field Data", "description": "Key-value object storing custom field values." }, "discount_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Discount Id", "description": "ID of the discount to apply to the checkout." }, "allow_discount_codes": { "type": "boolean", "title": "Allow Discount Codes", "description": "Whether to allow the customer to apply discount codes. If you apply a discount through `discount_id`, it'll still be applied, but the customer won't be able to change it.", "default": true }, "require_billing_address": { "type": "boolean", "title": "Require Billing Address", "description": "Whether to require the customer to fill their full billing address, instead of just the country. Customers in the US will always be required to fill their full address, regardless of this setting. If you preset the billing address, this setting will be automatically set to `true`.", "default": false }, "amount": { "anyOf": [ { "type": "integer", "maximum": 99999999, "minimum": 0, "description": "Amount in cents, before discounts and taxes. Only useful for custom prices, it'll be ignored for fixed and free prices. " }, { "type": "null" } ], "title": "Amount" }, "seats": { "anyOf": [ { "type": "integer", "maximum": 1000, "minimum": 1 }, { "type": "null" } ], "title": "Seats", "description": "Predefined number of seats (works with seat-based pricing only)" }, "min_seats": { "anyOf": [ { "type": "integer", "maximum": 1000, "minimum": 1 }, { "type": "null" } ], "title": "Min Seats", "description": "Minimum number of seats (works with seat-based pricing only)" }, "max_seats": { "anyOf": [ { "type": "integer", "maximum": 1000, "minimum": 1 }, { "type": "null" } ], "title": "Max Seats", "description": "Maximum number of seats (works with seat-based pricing only)" }, "allow_trial": { "type": "boolean", "title": "Allow Trial", "description": "Whether to enable the trial period for the checkout session. If `false`, the trial period will be disabled, even if the selected product has a trial configured.", "default": true }, "customer_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Customer Id", "description": "ID of an existing customer in the organization. The customer data will be pre-filled in the checkout form. The resulting order will be linked to this customer." }, "is_business_customer": { "type": "boolean", "title": "Is Business Customer", "description": "Whether the customer is a business or an individual. If `true`, the customer will be required to fill their full billing address and billing name.", "default": false }, "external_customer_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "External Customer Id", "description": "ID of the customer in your system. If a matching customer exists on Polar, the resulting order will be linked to this customer. Otherwise, a new customer will be created with this external ID set." }, "customer_name": { "anyOf": [ { "type": "string", "maxLength": 256, "description": "The name of the customer.", "examples": [ "John Doe" ] }, { "type": "null" } ], "title": "Customer Name" }, "customer_email": { "anyOf": [ { "type": "string", "format": "email", "description": "Email address of the customer." }, { "type": "null" } ], "title": "Customer Email" }, "customer_ip_address": { "anyOf": [ { "type": "string", "format": "ipvanyaddress" }, { "type": "null" } ], "title": "Customer Ip Address" }, "customer_billing_name": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Customer Billing Name" }, "customer_billing_address": { "anyOf": [ { "$ref": "#/components/schemas/AddressInput", "description": "Billing address of the customer." }, { "type": "null" } ] }, "customer_tax_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Customer Tax Id" }, "customer_metadata": { "additionalProperties": { "anyOf": [ { "type": "string", "maxLength": 500, "minLength": 1 }, { "type": "integer" }, { "type": "number" }, { "type": "boolean" } ] }, "propertyNames": { "maxLength": 40, "minLength": 1 }, "type": "object", "maxProperties": 50, "title": "Customer Metadata", "description": "Key-value object allowing you to store additional information that'll be copied to the created customer.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**." }, "subscription_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Subscription Id", "description": "ID of a subscription to upgrade. It must be on a free pricing. If checkout is successful, metadata set on this checkout will be copied to the subscription, and existing keys will be overwritten." }, "success_url": { "anyOf": [ { "type": "string", "maxLength": 2083, "minLength": 1, "format": "uri" }, { "type": "null" } ], "title": "Success Url", "description": "URL where the customer will be redirected after a successful payment.You can add the `checkout_id={CHECKOUT_ID}` query parameter to retrieve the checkout session id." }, "return_url": { "anyOf": [ { "type": "string", "maxLength": 2083, "minLength": 1, "format": "uri" }, { "type": "null" } ], "title": "Return Url", "description": "When set, a back button will be shown in the checkout to return to this URL." }, "embed_origin": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Embed Origin", "description": "If you plan to embed the checkout session, set this to the Origin of the embedding page. It'll allow the Polar iframe to communicate with the parent page." }, "locale": { "anyOf": [ { "type": "string", "pattern": "^[a-zA-Z]{2,3}(-[a-zA-Z]{2}|-[0-9]{3})?$", "description": "Locale of the customer, given as an IETF BCP 47 language tag. Supported: language code (e.g. `en`) or language + region (e.g. `en-US`). If `null` or unsupported, the locale will default to `en-US`.", "examples": [ "en", "en-US", "fr", "fr-CA" ] }, { "type": "null" } ], "title": "Locale" }, "currency": { "anyOf": [ { "$ref": "#/components/schemas/PresentmentCurrency", "maxLength": 3, "minLength": 3 }, { "type": "null" } ] }, "products": { "items": { "type": "string", "format": "uuid4" }, "type": "array", "minItems": 1, "title": "Products", "description": "List of product IDs available to select at that checkout. The first one will be selected by default." }, "prices": { "anyOf": [ { "additionalProperties": { "items": { "oneOf": [ { "$ref": "#/components/schemas/ProductPriceFixedCreate" }, { "$ref": "#/components/schemas/ProductPriceCustomCreate" }, { "$ref": "#/components/schemas/ProductPriceFreeCreate" }, { "$ref": "#/components/schemas/ProductPriceSeatBasedCreate" }, { "$ref": "#/components/schemas/ProductPriceMeteredUnitCreate" } ], "discriminator": { "propertyName": "amount_type", "mapping": { "custom": "#/components/schemas/ProductPriceCustomCreate", "fixed": "#/components/schemas/ProductPriceFixedCreate", "free": "#/components/schemas/ProductPriceFreeCreate", "metered_unit": "#/components/schemas/ProductPriceMeteredUnitCreate", "seat_based": "#/components/schemas/ProductPriceSeatBasedCreate" } } }, "type": "array", "minItems": 1, "description": "List of prices for the product. At most one static price (fixed, custom or free) is allowed. Any number of metered prices can be added." }, "propertyNames": { "format": "uuid4" }, "type": "object" }, { "type": "null" } ], "title": "Prices", "description": "Optional mapping of product IDs to a list of ad-hoc prices to create for that product. If not set, catalog prices of the product will be used." } }, "type": "object", "required": [ "products" ], "title": "CheckoutProductsCreate", "description": "Create a new checkout session from a list of products.\nCustomers will be able to switch between those products.\n\nMetadata set on the checkout will be copied\nto the resulting order and/or subscription." }, "CheckoutPublic": { "properties": { "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "custom_field_data": { "additionalProperties": { "anyOf": [ { "type": "string" }, { "type": "integer" }, { "type": "boolean" }, { "type": "string", "format": "date-time" }, { "type": "null" } ] }, "type": "object", "title": "Custom Field Data", "description": "Key-value object storing custom field values." }, "payment_processor": { "$ref": "#/components/schemas/PaymentProcessor", "description": "Payment processor used." }, "status": { "$ref": "#/components/schemas/CheckoutStatus", "description": "\n Status of the checkout session.\n\n - Open: the checkout session was opened.\n - Expired: the checkout session was expired and is no more accessible.\n - Confirmed: the user on the checkout session clicked Pay. This is not indicative of the payment's success status.\n - Failed: the checkout definitely failed for technical reasons and cannot be retried. In most cases, this state is never reached.\n - Succeeded: the payment on the checkout was performed successfully.\n " }, "client_secret": { "type": "string", "title": "Client Secret", "description": "Client secret used to update and complete the checkout session from the client." }, "url": { "type": "string", "title": "Url", "description": "URL where the customer can access the checkout session." }, "expires_at": { "type": "string", "format": "date-time", "title": "Expires At", "description": "Expiration date and time of the checkout session." }, "success_url": { "type": "string", "title": "Success Url", "description": "URL where the customer will be redirected after a successful payment." }, "return_url": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Return Url", "description": "When set, a back button will be shown in the checkout to return to this URL." }, "embed_origin": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Embed Origin", "description": "When checkout is embedded, represents the Origin of the page embedding the checkout. Used as a security measure to send messages only to the embedding page." }, "amount": { "type": "integer", "title": "Amount", "description": "Amount in cents, before discounts and taxes." }, "seats": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Seats", "description": "Predefined number of seats (works with seat-based pricing only)" }, "min_seats": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Min Seats", "description": "Minimum number of seats (works with seat-based pricing only)" }, "max_seats": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Max Seats", "description": "Maximum number of seats (works with seat-based pricing only)" }, "price_per_seat": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Price Per Seat", "description": "Price per seat in cents for the current seat count, based on the applicable tier. Only relevant for seat-based pricing." }, "discount_amount": { "type": "integer", "title": "Discount Amount", "description": "Discount amount in cents." }, "net_amount": { "type": "integer", "title": "Net Amount", "description": "Amount in cents, after discounts but before taxes." }, "tax_amount": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Tax Amount", "description": "Sales tax amount in cents. If `null`, it means there is no enough information yet to calculate it." }, "total_amount": { "type": "integer", "title": "Total Amount", "description": "Amount in cents, after discounts and taxes." }, "currency": { "type": "string", "title": "Currency", "description": "Currency code of the checkout session." }, "allow_trial": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "title": "Allow Trial", "description": "Whether to enable the trial period for the checkout session. If `false`, the trial period will be disabled, even if the selected product has a trial configured." }, "active_trial_interval": { "anyOf": [ { "$ref": "#/components/schemas/TrialInterval" }, { "type": "null" } ], "description": "Interval unit of the trial period, if any. This value is either set from the checkout, if `trial_interval` is set, or from the selected product." }, "active_trial_interval_count": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Active Trial Interval Count", "description": "Number of interval units of the trial period, if any. This value is either set from the checkout, if `trial_interval_count` is set, or from the selected product." }, "trial_end": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Trial End", "description": "End date and time of the trial period, if any." }, "organization_id": { "type": "string", "format": "uuid4", "title": "Organization Id", "description": "ID of the organization owning the checkout session." }, "product_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Product Id", "description": "ID of the product to checkout." }, "product_price_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Product Price Id", "description": "ID of the product price to checkout.", "deprecated": true }, "discount_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Discount Id", "description": "ID of the discount applied to the checkout." }, "allow_discount_codes": { "type": "boolean", "title": "Allow Discount Codes", "description": "Whether to allow the customer to apply discount codes. If you apply a discount through `discount_id`, it'll still be applied, but the customer won't be able to change it." }, "require_billing_address": { "type": "boolean", "title": "Require Billing Address", "description": "Whether to require the customer to fill their full billing address, instead of just the country. Customers in the US will always be required to fill their full address, regardless of this setting. If you preset the billing address, this setting will be automatically set to `true`." }, "is_discount_applicable": { "type": "boolean", "title": "Is Discount Applicable", "description": "Whether the discount is applicable to the checkout. Typically, free and custom prices are not discountable." }, "is_free_product_price": { "type": "boolean", "title": "Is Free Product Price", "description": "Whether the product price is free, regardless of discounts." }, "is_payment_required": { "type": "boolean", "title": "Is Payment Required", "description": "Whether the checkout requires payment, e.g. in case of free products or discounts that cover the total amount." }, "is_payment_setup_required": { "type": "boolean", "title": "Is Payment Setup Required", "description": "Whether the checkout requires setting up a payment method, regardless of the amount, e.g. subscriptions that have first free cycles." }, "is_payment_form_required": { "type": "boolean", "title": "Is Payment Form Required", "description": "Whether the checkout requires a payment form, whether because of a payment or payment method setup." }, "customer_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Customer Id" }, "is_business_customer": { "type": "boolean", "title": "Is Business Customer", "description": "Whether the customer is a business or an individual. If `true`, the customer will be required to fill their full billing address and billing name." }, "customer_name": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Customer Name", "description": "Name of the customer." }, "customer_email": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Customer Email", "description": "Email address of the customer." }, "customer_ip_address": { "anyOf": [ { "type": "string", "format": "ipvanyaddress" }, { "type": "null" } ], "title": "Customer Ip Address" }, "customer_billing_name": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Customer Billing Name" }, "customer_billing_address": { "anyOf": [ { "$ref": "#/components/schemas/Address", "description": "Billing address of the customer." }, { "type": "null" } ] }, "customer_tax_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Customer Tax Id" }, "locale": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Locale" }, "payment_processor_metadata": { "additionalProperties": { "type": "string" }, "type": "object", "title": "Payment Processor Metadata" }, "billing_address_fields": { "$ref": "#/components/schemas/CheckoutBillingAddressFields", "description": "Determine which billing address fields should be disabled, optional or required in the checkout form." }, "products": { "items": { "$ref": "#/components/schemas/CheckoutProduct" }, "type": "array", "title": "Products", "description": "List of products available to select." }, "product": { "anyOf": [ { "$ref": "#/components/schemas/CheckoutProduct" }, { "type": "null" } ], "description": "Product selected to checkout." }, "product_price": { "anyOf": [ { "oneOf": [ { "$ref": "#/components/schemas/LegacyRecurringProductPrice" }, { "$ref": "#/components/schemas/ProductPrice" } ] }, { "type": "null" } ], "title": "Product Price", "description": "Price of the selected product.", "deprecated": true }, "prices": { "anyOf": [ { "additionalProperties": { "items": { "oneOf": [ { "$ref": "#/components/schemas/LegacyRecurringProductPrice" }, { "$ref": "#/components/schemas/ProductPrice" } ] }, "type": "array", "description": "List of prices for this product." }, "propertyNames": { "format": "uuid4" }, "type": "object" }, { "type": "null" } ], "title": "Prices", "description": "Mapping of product IDs to their list of prices." }, "discount": { "anyOf": [ { "oneOf": [ { "$ref": "#/components/schemas/CheckoutDiscountFixedOnceForeverDuration" }, { "$ref": "#/components/schemas/CheckoutDiscountFixedRepeatDuration" }, { "$ref": "#/components/schemas/CheckoutDiscountPercentageOnceForeverDuration" }, { "$ref": "#/components/schemas/CheckoutDiscountPercentageRepeatDuration" } ] }, { "type": "null" } ], "title": "Discount" }, "organization": { "$ref": "#/components/schemas/CheckoutOrganization" }, "attached_custom_fields": { "anyOf": [ { "items": { "$ref": "#/components/schemas/AttachedCustomField" }, "type": "array" }, { "type": "null" } ], "title": "Attached Custom Fields" } }, "type": "object", "required": [ "id", "created_at", "modified_at", "payment_processor", "status", "client_secret", "url", "expires_at", "success_url", "return_url", "embed_origin", "amount", "discount_amount", "net_amount", "tax_amount", "total_amount", "currency", "allow_trial", "active_trial_interval", "active_trial_interval_count", "trial_end", "organization_id", "product_id", "product_price_id", "discount_id", "allow_discount_codes", "require_billing_address", "is_discount_applicable", "is_free_product_price", "is_payment_required", "is_payment_setup_required", "is_payment_form_required", "customer_id", "is_business_customer", "customer_name", "customer_email", "customer_ip_address", "customer_billing_name", "customer_billing_address", "customer_tax_id", "payment_processor_metadata", "billing_address_fields", "products", "product", "product_price", "prices", "discount", "organization", "attached_custom_fields" ], "title": "CheckoutPublic", "description": "Checkout session data retrieved using the client secret." }, "CheckoutPublicConfirmed": { "properties": { "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "custom_field_data": { "additionalProperties": { "anyOf": [ { "type": "string" }, { "type": "integer" }, { "type": "boolean" }, { "type": "string", "format": "date-time" }, { "type": "null" } ] }, "type": "object", "title": "Custom Field Data", "description": "Key-value object storing custom field values." }, "payment_processor": { "$ref": "#/components/schemas/PaymentProcessor", "description": "Payment processor used." }, "status": { "type": "string", "const": "confirmed", "title": "Status" }, "client_secret": { "type": "string", "title": "Client Secret", "description": "Client secret used to update and complete the checkout session from the client." }, "url": { "type": "string", "title": "Url", "description": "URL where the customer can access the checkout session." }, "expires_at": { "type": "string", "format": "date-time", "title": "Expires At", "description": "Expiration date and time of the checkout session." }, "success_url": { "type": "string", "title": "Success Url", "description": "URL where the customer will be redirected after a successful payment." }, "return_url": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Return Url", "description": "When set, a back button will be shown in the checkout to return to this URL." }, "embed_origin": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Embed Origin", "description": "When checkout is embedded, represents the Origin of the page embedding the checkout. Used as a security measure to send messages only to the embedding page." }, "amount": { "type": "integer", "title": "Amount", "description": "Amount in cents, before discounts and taxes." }, "seats": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Seats", "description": "Predefined number of seats (works with seat-based pricing only)" }, "min_seats": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Min Seats", "description": "Minimum number of seats (works with seat-based pricing only)" }, "max_seats": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Max Seats", "description": "Maximum number of seats (works with seat-based pricing only)" }, "price_per_seat": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Price Per Seat", "description": "Price per seat in cents for the current seat count, based on the applicable tier. Only relevant for seat-based pricing." }, "discount_amount": { "type": "integer", "title": "Discount Amount", "description": "Discount amount in cents." }, "net_amount": { "type": "integer", "title": "Net Amount", "description": "Amount in cents, after discounts but before taxes." }, "tax_amount": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Tax Amount", "description": "Sales tax amount in cents. If `null`, it means there is no enough information yet to calculate it." }, "total_amount": { "type": "integer", "title": "Total Amount", "description": "Amount in cents, after discounts and taxes." }, "currency": { "type": "string", "title": "Currency", "description": "Currency code of the checkout session." }, "allow_trial": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "title": "Allow Trial", "description": "Whether to enable the trial period for the checkout session. If `false`, the trial period will be disabled, even if the selected product has a trial configured." }, "active_trial_interval": { "anyOf": [ { "$ref": "#/components/schemas/TrialInterval" }, { "type": "null" } ], "description": "Interval unit of the trial period, if any. This value is either set from the checkout, if `trial_interval` is set, or from the selected product." }, "active_trial_interval_count": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Active Trial Interval Count", "description": "Number of interval units of the trial period, if any. This value is either set from the checkout, if `trial_interval_count` is set, or from the selected product." }, "trial_end": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Trial End", "description": "End date and time of the trial period, if any." }, "organization_id": { "type": "string", "format": "uuid4", "title": "Organization Id", "description": "ID of the organization owning the checkout session." }, "product_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Product Id", "description": "ID of the product to checkout." }, "product_price_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Product Price Id", "description": "ID of the product price to checkout.", "deprecated": true }, "discount_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Discount Id", "description": "ID of the discount applied to the checkout." }, "allow_discount_codes": { "type": "boolean", "title": "Allow Discount Codes", "description": "Whether to allow the customer to apply discount codes. If you apply a discount through `discount_id`, it'll still be applied, but the customer won't be able to change it." }, "require_billing_address": { "type": "boolean", "title": "Require Billing Address", "description": "Whether to require the customer to fill their full billing address, instead of just the country. Customers in the US will always be required to fill their full address, regardless of this setting. If you preset the billing address, this setting will be automatically set to `true`." }, "is_discount_applicable": { "type": "boolean", "title": "Is Discount Applicable", "description": "Whether the discount is applicable to the checkout. Typically, free and custom prices are not discountable." }, "is_free_product_price": { "type": "boolean", "title": "Is Free Product Price", "description": "Whether the product price is free, regardless of discounts." }, "is_payment_required": { "type": "boolean", "title": "Is Payment Required", "description": "Whether the checkout requires payment, e.g. in case of free products or discounts that cover the total amount." }, "is_payment_setup_required": { "type": "boolean", "title": "Is Payment Setup Required", "description": "Whether the checkout requires setting up a payment method, regardless of the amount, e.g. subscriptions that have first free cycles." }, "is_payment_form_required": { "type": "boolean", "title": "Is Payment Form Required", "description": "Whether the checkout requires a payment form, whether because of a payment or payment method setup." }, "customer_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Customer Id" }, "is_business_customer": { "type": "boolean", "title": "Is Business Customer", "description": "Whether the customer is a business or an individual. If `true`, the customer will be required to fill their full billing address and billing name." }, "customer_name": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Customer Name", "description": "Name of the customer." }, "customer_email": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Customer Email", "description": "Email address of the customer." }, "customer_ip_address": { "anyOf": [ { "type": "string", "format": "ipvanyaddress" }, { "type": "null" } ], "title": "Customer Ip Address" }, "customer_billing_name": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Customer Billing Name" }, "customer_billing_address": { "anyOf": [ { "$ref": "#/components/schemas/Address", "description": "Billing address of the customer." }, { "type": "null" } ] }, "customer_tax_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Customer Tax Id" }, "locale": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Locale" }, "payment_processor_metadata": { "additionalProperties": { "type": "string" }, "type": "object", "title": "Payment Processor Metadata" }, "billing_address_fields": { "$ref": "#/components/schemas/CheckoutBillingAddressFields", "description": "Determine which billing address fields should be disabled, optional or required in the checkout form." }, "products": { "items": { "$ref": "#/components/schemas/CheckoutProduct" }, "type": "array", "title": "Products", "description": "List of products available to select." }, "product": { "anyOf": [ { "$ref": "#/components/schemas/CheckoutProduct" }, { "type": "null" } ], "description": "Product selected to checkout." }, "product_price": { "anyOf": [ { "oneOf": [ { "$ref": "#/components/schemas/LegacyRecurringProductPrice" }, { "$ref": "#/components/schemas/ProductPrice" } ] }, { "type": "null" } ], "title": "Product Price", "description": "Price of the selected product.", "deprecated": true }, "prices": { "anyOf": [ { "additionalProperties": { "items": { "oneOf": [ { "$ref": "#/components/schemas/LegacyRecurringProductPrice" }, { "$ref": "#/components/schemas/ProductPrice" } ] }, "type": "array", "description": "List of prices for this product." }, "propertyNames": { "format": "uuid4" }, "type": "object" }, { "type": "null" } ], "title": "Prices", "description": "Mapping of product IDs to their list of prices." }, "discount": { "anyOf": [ { "oneOf": [ { "$ref": "#/components/schemas/CheckoutDiscountFixedOnceForeverDuration" }, { "$ref": "#/components/schemas/CheckoutDiscountFixedRepeatDuration" }, { "$ref": "#/components/schemas/CheckoutDiscountPercentageOnceForeverDuration" }, { "$ref": "#/components/schemas/CheckoutDiscountPercentageRepeatDuration" } ] }, { "type": "null" } ], "title": "Discount" }, "organization": { "$ref": "#/components/schemas/CheckoutOrganization" }, "attached_custom_fields": { "anyOf": [ { "items": { "$ref": "#/components/schemas/AttachedCustomField" }, "type": "array" }, { "type": "null" } ], "title": "Attached Custom Fields" }, "customer_session_token": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Customer Session Token" } }, "type": "object", "required": [ "id", "created_at", "modified_at", "payment_processor", "status", "client_secret", "url", "expires_at", "success_url", "return_url", "embed_origin", "amount", "discount_amount", "net_amount", "tax_amount", "total_amount", "currency", "allow_trial", "active_trial_interval", "active_trial_interval_count", "trial_end", "organization_id", "product_id", "product_price_id", "discount_id", "allow_discount_codes", "require_billing_address", "is_discount_applicable", "is_free_product_price", "is_payment_required", "is_payment_setup_required", "is_payment_form_required", "customer_id", "is_business_customer", "customer_name", "customer_email", "customer_ip_address", "customer_billing_name", "customer_billing_address", "customer_tax_id", "payment_processor_metadata", "billing_address_fields", "products", "product", "product_price", "prices", "discount", "organization", "attached_custom_fields", "customer_session_token" ], "title": "CheckoutPublicConfirmed", "description": "Checkout session data retrieved using the client secret after confirmation.\n\nIt contains a customer session token to retrieve order information\nright after the checkout." }, "CheckoutSortProperty": { "type": "string", "enum": [ "created_at", "-created_at", "expires_at", "-expires_at", "status", "-status" ], "title": "CheckoutSortProperty" }, "CheckoutStatus": { "type": "string", "enum": [ "open", "expired", "confirmed", "succeeded", "failed" ], "title": "CheckoutStatus" }, "CheckoutUpdate": { "properties": { "custom_field_data": { "additionalProperties": { "anyOf": [ { "type": "string" }, { "type": "integer" }, { "type": "boolean" }, { "type": "string", "format": "date-time" }, { "type": "null" } ] }, "type": "object", "title": "Custom Field Data", "description": "Key-value object storing custom field values." }, "product_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Product Id", "description": "ID of the product to checkout. Must be present in the checkout's product list." }, "product_price_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Product Price Id", "description": "ID of the product price to checkout. Must correspond to a price present in the checkout's product list.", "deprecated": true }, "amount": { "anyOf": [ { "type": "integer", "maximum": 99999999, "minimum": 0, "description": "Amount in cents, before discounts and taxes. Only useful for custom prices, it'll be ignored for fixed and free prices. " }, { "type": "null" } ], "title": "Amount" }, "seats": { "anyOf": [ { "type": "integer", "maximum": 1000, "minimum": 1 }, { "type": "null" } ], "title": "Seats", "description": "Number of seats for seat-based pricing." }, "is_business_customer": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "title": "Is Business Customer" }, "customer_name": { "anyOf": [ { "type": "string", "maxLength": 256, "description": "The name of the customer.", "examples": [ "John Doe" ] }, { "type": "null" } ], "title": "Customer Name" }, "customer_email": { "anyOf": [ { "type": "string", "format": "email", "description": "Email address of the customer." }, { "type": "null" } ], "title": "Customer Email" }, "customer_billing_name": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Customer Billing Name" }, "customer_billing_address": { "anyOf": [ { "$ref": "#/components/schemas/AddressInput", "description": "Billing address of the customer." }, { "type": "null" } ] }, "customer_tax_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Customer Tax Id" }, "locale": { "anyOf": [ { "type": "string", "pattern": "^[a-zA-Z]{2,3}(-[a-zA-Z]{2}|-[0-9]{3})?$", "description": "Locale of the customer, given as an IETF BCP 47 language tag. Supported: language code (e.g. `en`) or language + region (e.g. `en-US`). If `null` or unsupported, the locale will default to `en-US`.", "examples": [ "en", "en-US", "fr", "fr-CA" ] }, { "type": "null" } ], "title": "Locale" }, "trial_interval": { "anyOf": [ { "$ref": "#/components/schemas/TrialInterval" }, { "type": "null" } ], "description": "The interval unit for the trial period." }, "trial_interval_count": { "anyOf": [ { "type": "integer", "maximum": 1000, "minimum": 1 }, { "type": "null" } ], "title": "Trial Interval Count", "description": "The number of interval units for the trial period." }, "metadata": { "additionalProperties": { "anyOf": [ { "type": "string", "maxLength": 500, "minLength": 1 }, { "type": "integer" }, { "type": "number" }, { "type": "boolean" } ] }, "propertyNames": { "maxLength": 40, "minLength": 1 }, "type": "object", "maxProperties": 50, "title": "Metadata", "description": "Key-value object allowing you to store additional information.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**." }, "currency": { "anyOf": [ { "$ref": "#/components/schemas/PresentmentCurrency", "maxLength": 3, "minLength": 3 }, { "type": "null" } ] }, "discount_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Discount Id", "description": "ID of the discount to apply to the checkout." }, "allow_discount_codes": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "title": "Allow Discount Codes", "description": "Whether to allow the customer to apply discount codes. If you apply a discount through `discount_id`, it'll still be applied, but the customer won't be able to change it." }, "require_billing_address": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "title": "Require Billing Address", "description": "Whether to require the customer to fill their full billing address, instead of just the country. Customers in the US will always be required to fill their full address, regardless of this setting. If you preset the billing address, this setting will be automatically set to `true`." }, "allow_trial": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "title": "Allow Trial", "description": "Whether to enable the trial period for the checkout session. If `false`, the trial period will be disabled, even if the selected product has a trial configured." }, "customer_ip_address": { "anyOf": [ { "type": "string", "format": "ipvanyaddress" }, { "type": "null" } ], "title": "Customer Ip Address" }, "customer_metadata": { "anyOf": [ { "additionalProperties": { "anyOf": [ { "type": "string", "maxLength": 500, "minLength": 1 }, { "type": "integer" }, { "type": "number" }, { "type": "boolean" } ] }, "propertyNames": { "maxLength": 40, "minLength": 1 }, "type": "object", "maxProperties": 50, "description": "Key-value object allowing you to store additional information.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**." }, { "type": "null" } ], "title": "Customer Metadata", "description": "Key-value object allowing you to store additional information that'll be copied to the created customer.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**." }, "success_url": { "anyOf": [ { "type": "string", "maxLength": 2083, "minLength": 1, "format": "uri" }, { "type": "null" } ], "title": "Success Url", "description": "URL where the customer will be redirected after a successful payment.You can add the `checkout_id={CHECKOUT_ID}` query parameter to retrieve the checkout session id." }, "return_url": { "anyOf": [ { "type": "string", "maxLength": 2083, "minLength": 1, "format": "uri" }, { "type": "null" } ], "title": "Return Url", "description": "When set, a back button will be shown in the checkout to return to this URL." }, "embed_origin": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Embed Origin", "description": "If you plan to embed the checkout session, set this to the Origin of the embedding page. It'll allow the Polar iframe to communicate with the parent page." } }, "type": "object", "title": "CheckoutUpdate", "description": "Update an existing checkout session using an access token." }, "CheckoutUpdatePublic": { "properties": { "custom_field_data": { "additionalProperties": { "anyOf": [ { "type": "string" }, { "type": "integer" }, { "type": "boolean" }, { "type": "string", "format": "date-time" }, { "type": "null" } ] }, "type": "object", "title": "Custom Field Data", "description": "Key-value object storing custom field values." }, "product_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Product Id", "description": "ID of the product to checkout. Must be present in the checkout's product list." }, "product_price_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Product Price Id", "description": "ID of the product price to checkout. Must correspond to a price present in the checkout's product list.", "deprecated": true }, "amount": { "anyOf": [ { "type": "integer", "maximum": 99999999, "minimum": 0, "description": "Amount in cents, before discounts and taxes. Only useful for custom prices, it'll be ignored for fixed and free prices. " }, { "type": "null" } ], "title": "Amount" }, "seats": { "anyOf": [ { "type": "integer", "maximum": 1000, "minimum": 1 }, { "type": "null" } ], "title": "Seats", "description": "Number of seats for seat-based pricing." }, "is_business_customer": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "title": "Is Business Customer" }, "customer_name": { "anyOf": [ { "type": "string", "maxLength": 256, "description": "The name of the customer.", "examples": [ "John Doe" ] }, { "type": "null" } ], "title": "Customer Name" }, "customer_email": { "anyOf": [ { "type": "string", "format": "email", "description": "Email address of the customer." }, { "type": "null" } ], "title": "Customer Email" }, "customer_billing_name": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Customer Billing Name" }, "customer_billing_address": { "anyOf": [ { "$ref": "#/components/schemas/AddressInput", "description": "Billing address of the customer." }, { "type": "null" } ] }, "customer_tax_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Customer Tax Id" }, "locale": { "anyOf": [ { "type": "string", "pattern": "^[a-zA-Z]{2,3}(-[a-zA-Z]{2}|-[0-9]{3})?$", "description": "Locale of the customer, given as an IETF BCP 47 language tag. Supported: language code (e.g. `en`) or language + region (e.g. `en-US`). If `null` or unsupported, the locale will default to `en-US`.", "examples": [ "en", "en-US", "fr", "fr-CA" ] }, { "type": "null" } ], "title": "Locale" }, "discount_code": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Discount Code", "description": "Discount code to apply to the checkout." }, "allow_trial": { "anyOf": [ { "type": "boolean", "const": false }, { "type": "null" } ], "title": "Allow Trial", "description": "Disable the trial period for the checkout session. It's mainly useful when the trial is blocked because the customer already redeemed one." } }, "type": "object", "title": "CheckoutUpdatePublic", "description": "Update an existing checkout session using the client secret." }, "CostMetadata-Input": { "properties": { "amount": { "anyOf": [ { "type": "number" }, { "type": "string", "pattern": "^(?!^[-+.]*$)[+-]?0*(?:\\d{0,5}|(?=[\\d.]{1,18}0*$)\\d{0,5}\\.\\d{0,12}0*$)" } ], "title": "Amount", "description": "The amount in cents." }, "currency": { "type": "string", "pattern": "usd", "title": "Currency", "description": "The currency. Currently, only `usd` is supported." } }, "type": "object", "required": [ "amount", "currency" ], "title": "CostMetadata" }, "CostMetadata-Output": { "properties": { "amount": { "type": "string", "pattern": "^(?!^[-+.]*$)[+-]?0*(?:\\d{0,5}|(?=[\\d.]{1,18}0*$)\\d{0,5}\\.\\d{0,12}0*$)", "title": "Amount", "description": "The amount in cents." }, "currency": { "type": "string", "pattern": "usd", "title": "Currency", "description": "The currency. Currently, only `usd` is supported." } }, "type": "object", "required": [ "amount", "currency" ], "title": "CostMetadata" }, "CountAggregation": { "properties": { "func": { "type": "string", "const": "count", "title": "Func", "default": "count" } }, "type": "object", "title": "CountAggregation" }, "CountryAlpha2": { "type": "string", "enum": [ "AD", "AE", "AF", "AG", "AI", "AL", "AM", "AO", "AQ", "AR", "AS", "AT", "AU", "AW", "AX", "AZ", "BA", "BB", "BD", "BE", "BF", "BG", "BH", "BI", "BJ", "BL", "BM", "BN", "BO", "BQ", "BR", "BS", "BT", "BV", "BW", "BY", "BZ", "CA", "CC", "CD", "CF", "CG", "CH", "CI", "CK", "CL", "CM", "CN", "CO", "CR", "CU", "CV", "CW", "CX", "CY", "CZ", "DE", "DJ", "DK", "DM", "DO", "DZ", "EC", "EE", "EG", "EH", "ER", "ES", "ET", "FI", "FJ", "FK", "FM", "FO", "FR", "GA", "GB", "GD", "GE", "GF", "GG", "GH", "GI", "GL", "GM", "GN", "GP", "GQ", "GR", "GS", "GT", "GU", "GW", "GY", "HK", "HM", "HN", "HR", "HT", "HU", "ID", "IE", "IL", "IM", "IN", "IO", "IQ", "IR", "IS", "IT", "JE", "JM", "JO", "JP", "KE", "KG", "KH", "KI", "KM", "KN", "KP", "KR", "KW", "KY", "KZ", "LA", "LB", "LC", "LI", "LK", "LR", "LS", "LT", "LU", "LV", "LY", "MA", "MC", "MD", "ME", "MF", "MG", "MH", "MK", "ML", "MM", "MN", "MO", "MP", "MQ", "MR", "MS", "MT", "MU", "MV", "MW", "MX", "MY", "MZ", "NA", "NC", "NE", "NF", "NG", "NI", "NL", "NO", "NP", "NR", "NU", "NZ", "OM", "PA", "PE", "PF", "PG", "PH", "PK", "PL", "PM", "PN", "PR", "PS", "PT", "PW", "PY", "QA", "RE", "RO", "RS", "RU", "RW", "SA", "SB", "SC", "SD", "SE", "SG", "SH", "SI", "SJ", "SK", "SL", "SM", "SN", "SO", "SR", "SS", "ST", "SV", "SX", "SY", "SZ", "TC", "TD", "TF", "TG", "TH", "TJ", "TK", "TL", "TM", "TN", "TO", "TR", "TT", "TV", "TW", "TZ", "UA", "UG", "UM", "US", "UY", "UZ", "VA", "VC", "VE", "VG", "VI", "VN", "VU", "WF", "WS", "YE", "YT", "ZA", "ZM", "ZW" ], "title": "CountryAlpha2" }, "CountryAlpha2Input": { "type": "string", "enum": [ "AD", "AE", "AF", "AG", "AI", "AL", "AM", "AO", "AQ", "AR", "AS", "AT", "AU", "AW", "AX", "AZ", "BA", "BB", "BD", "BE", "BF", "BG", "BH", "BI", "BJ", "BL", "BM", "BN", "BO", "BQ", "BR", "BS", "BT", "BV", "BW", "BY", "BZ", "CA", "CC", "CD", "CF", "CG", "CH", "CI", "CK", "CL", "CM", "CN", "CO", "CR", "CV", "CW", "CX", "CY", "CZ", "DE", "DJ", "DK", "DM", "DO", "DZ", "EC", "EE", "EG", "EH", "ER", "ES", "ET", "FI", "FJ", "FK", "FM", "FO", "FR", "GA", "GB", "GD", "GE", "GF", "GG", "GH", "GI", "GL", "GM", "GN", "GP", "GQ", "GR", "GS", "GT", "GU", "GW", "GY", "HK", "HM", "HN", "HR", "HT", "HU", "ID", "IE", "IL", "IM", "IN", "IO", "IQ", "IS", "IT", "JE", "JM", "JO", "JP", "KE", "KG", "KH", "KI", "KM", "KN", "KR", "KW", "KY", "KZ", "LA", "LB", "LC", "LI", "LK", "LR", "LS", "LT", "LU", "LV", "LY", "MA", "MC", "MD", "ME", "MF", "MG", "MH", "MK", "ML", "MM", "MN", "MO", "MP", "MQ", "MR", "MS", "MT", "MU", "MV", "MW", "MX", "MY", "MZ", "NA", "NC", "NE", "NF", "NG", "NI", "NL", "NO", "NP", "NR", "NU", "NZ", "OM", "PA", "PE", "PF", "PG", "PH", "PK", "PL", "PM", "PN", "PR", "PS", "PT", "PW", "PY", "QA", "RE", "RO", "RS", "RW", "SA", "SB", "SC", "SD", "SE", "SG", "SH", "SI", "SJ", "SK", "SL", "SM", "SN", "SO", "SR", "SS", "ST", "SV", "SX", "SZ", "TC", "TD", "TF", "TG", "TH", "TJ", "TK", "TL", "TM", "TN", "TO", "TR", "TT", "TV", "TW", "TZ", "UA", "UG", "UM", "US", "UY", "UZ", "VA", "VC", "VE", "VG", "VI", "VN", "VU", "WF", "WS", "YE", "YT", "ZA", "ZM", "ZW" ], "title": "CountryAlpha2Input" }, "CursorPagination": { "properties": { "has_next_page": { "type": "boolean", "title": "Has Next Page" } }, "type": "object", "required": [ "has_next_page" ], "title": "CursorPagination" }, "CustomField": { "oneOf": [ { "$ref": "#/components/schemas/CustomFieldText" }, { "$ref": "#/components/schemas/CustomFieldNumber" }, { "$ref": "#/components/schemas/CustomFieldDate" }, { "$ref": "#/components/schemas/CustomFieldCheckbox" }, { "$ref": "#/components/schemas/CustomFieldSelect" } ], "discriminator": { "propertyName": "type", "mapping": { "checkbox": "#/components/schemas/CustomFieldCheckbox", "date": "#/components/schemas/CustomFieldDate", "number": "#/components/schemas/CustomFieldNumber", "select": "#/components/schemas/CustomFieldSelect", "text": "#/components/schemas/CustomFieldText" } } }, "CustomFieldCheckbox": { "properties": { "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "metadata": { "$ref": "#/components/schemas/MetadataOutputType" }, "type": { "type": "string", "const": "checkbox", "title": "Type" }, "slug": { "type": "string", "title": "Slug", "description": "Identifier of the custom field. It'll be used as key when storing the value." }, "name": { "type": "string", "title": "Name", "description": "Name of the custom field." }, "organization_id": { "type": "string", "format": "uuid4", "title": "Organization Id", "description": "The ID of the organization owning the custom field.", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "x-polar-selector-widget": { "displayProperty": "name", "resourceName": "Organization", "resourceRoot": "/v1/organizations" } }, "properties": { "$ref": "#/components/schemas/CustomFieldCheckboxProperties" } }, "type": "object", "required": [ "created_at", "modified_at", "id", "metadata", "type", "slug", "name", "organization_id", "properties" ], "title": "CustomFieldCheckbox", "description": "Schema for a custom field of type checkbox." }, "CustomFieldCheckboxProperties": { "properties": { "form_label": { "type": "string", "minLength": 1, "title": "Form Label" }, "form_help_text": { "type": "string", "minLength": 1, "title": "Form Help Text" }, "form_placeholder": { "type": "string", "minLength": 1, "title": "Form Placeholder" } }, "type": "object", "title": "CustomFieldCheckboxProperties" }, "CustomFieldCreate": { "oneOf": [ { "$ref": "#/components/schemas/CustomFieldCreateText" }, { "$ref": "#/components/schemas/CustomFieldCreateNumber" }, { "$ref": "#/components/schemas/CustomFieldCreateDate" }, { "$ref": "#/components/schemas/CustomFieldCreateCheckbox" }, { "$ref": "#/components/schemas/CustomFieldCreateSelect" } ], "discriminator": { "propertyName": "type", "mapping": { "checkbox": "#/components/schemas/CustomFieldCreateCheckbox", "date": "#/components/schemas/CustomFieldCreateDate", "number": "#/components/schemas/CustomFieldCreateNumber", "select": "#/components/schemas/CustomFieldCreateSelect", "text": "#/components/schemas/CustomFieldCreateText" } } }, "CustomFieldCreateCheckbox": { "properties": { "metadata": { "additionalProperties": { "anyOf": [ { "type": "string", "maxLength": 500, "minLength": 1 }, { "type": "integer" }, { "type": "number" }, { "type": "boolean" } ] }, "propertyNames": { "maxLength": 40, "minLength": 1 }, "type": "object", "maxProperties": 50, "title": "Metadata", "description": "Key-value object allowing you to store additional information.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**." }, "type": { "type": "string", "const": "checkbox", "title": "Type" }, "slug": { "type": "string", "minLength": 1, "pattern": "^[a-z0-9-_]+$", "title": "Slug", "description": "Identifier of the custom field. It'll be used as key when storing the value. Must be unique across the organization.It can only contain ASCII letters, numbers and hyphens." }, "name": { "type": "string", "minLength": 1, "title": "Name", "description": "Name of the custom field." }, "organization_id": { "anyOf": [ { "type": "string", "format": "uuid4", "description": "The organization ID.", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "x-polar-selector-widget": { "displayProperty": "name", "resourceName": "Organization", "resourceRoot": "/v1/organizations" } }, { "type": "null" } ], "title": "Organization Id", "description": "The ID of the organization owning the custom field. **Required unless you use an organization token.**" }, "properties": { "$ref": "#/components/schemas/CustomFieldCheckboxProperties" } }, "type": "object", "required": [ "type", "slug", "name", "properties" ], "title": "CustomFieldCreateCheckbox", "description": "Schema to create a custom field of type checkbox." }, "CustomFieldCreateDate": { "properties": { "metadata": { "additionalProperties": { "anyOf": [ { "type": "string", "maxLength": 500, "minLength": 1 }, { "type": "integer" }, { "type": "number" }, { "type": "boolean" } ] }, "propertyNames": { "maxLength": 40, "minLength": 1 }, "type": "object", "maxProperties": 50, "title": "Metadata", "description": "Key-value object allowing you to store additional information.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**." }, "type": { "type": "string", "const": "date", "title": "Type" }, "slug": { "type": "string", "minLength": 1, "pattern": "^[a-z0-9-_]+$", "title": "Slug", "description": "Identifier of the custom field. It'll be used as key when storing the value. Must be unique across the organization.It can only contain ASCII letters, numbers and hyphens." }, "name": { "type": "string", "minLength": 1, "title": "Name", "description": "Name of the custom field." }, "organization_id": { "anyOf": [ { "type": "string", "format": "uuid4", "description": "The organization ID.", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "x-polar-selector-widget": { "displayProperty": "name", "resourceName": "Organization", "resourceRoot": "/v1/organizations" } }, { "type": "null" } ], "title": "Organization Id", "description": "The ID of the organization owning the custom field. **Required unless you use an organization token.**" }, "properties": { "$ref": "#/components/schemas/CustomFieldDateProperties" } }, "type": "object", "required": [ "type", "slug", "name", "properties" ], "title": "CustomFieldCreateDate", "description": "Schema to create a custom field of type date." }, "CustomFieldCreateNumber": { "properties": { "metadata": { "additionalProperties": { "anyOf": [ { "type": "string", "maxLength": 500, "minLength": 1 }, { "type": "integer" }, { "type": "number" }, { "type": "boolean" } ] }, "propertyNames": { "maxLength": 40, "minLength": 1 }, "type": "object", "maxProperties": 50, "title": "Metadata", "description": "Key-value object allowing you to store additional information.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**." }, "type": { "type": "string", "const": "number", "title": "Type" }, "slug": { "type": "string", "minLength": 1, "pattern": "^[a-z0-9-_]+$", "title": "Slug", "description": "Identifier of the custom field. It'll be used as key when storing the value. Must be unique across the organization.It can only contain ASCII letters, numbers and hyphens." }, "name": { "type": "string", "minLength": 1, "title": "Name", "description": "Name of the custom field." }, "organization_id": { "anyOf": [ { "type": "string", "format": "uuid4", "description": "The organization ID.", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "x-polar-selector-widget": { "displayProperty": "name", "resourceName": "Organization", "resourceRoot": "/v1/organizations" } }, { "type": "null" } ], "title": "Organization Id", "description": "The ID of the organization owning the custom field. **Required unless you use an organization token.**" }, "properties": { "$ref": "#/components/schemas/CustomFieldNumberProperties" } }, "type": "object", "required": [ "type", "slug", "name", "properties" ], "title": "CustomFieldCreateNumber", "description": "Schema to create a custom field of type number." }, "CustomFieldCreateSelect": { "properties": { "metadata": { "additionalProperties": { "anyOf": [ { "type": "string", "maxLength": 500, "minLength": 1 }, { "type": "integer" }, { "type": "number" }, { "type": "boolean" } ] }, "propertyNames": { "maxLength": 40, "minLength": 1 }, "type": "object", "maxProperties": 50, "title": "Metadata", "description": "Key-value object allowing you to store additional information.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**." }, "type": { "type": "string", "const": "select", "title": "Type" }, "slug": { "type": "string", "minLength": 1, "pattern": "^[a-z0-9-_]+$", "title": "Slug", "description": "Identifier of the custom field. It'll be used as key when storing the value. Must be unique across the organization.It can only contain ASCII letters, numbers and hyphens." }, "name": { "type": "string", "minLength": 1, "title": "Name", "description": "Name of the custom field." }, "organization_id": { "anyOf": [ { "type": "string", "format": "uuid4", "description": "The organization ID.", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "x-polar-selector-widget": { "displayProperty": "name", "resourceName": "Organization", "resourceRoot": "/v1/organizations" } }, { "type": "null" } ], "title": "Organization Id", "description": "The ID of the organization owning the custom field. **Required unless you use an organization token.**" }, "properties": { "$ref": "#/components/schemas/CustomFieldSelectProperties" } }, "type": "object", "required": [ "type", "slug", "name", "properties" ], "title": "CustomFieldCreateSelect", "description": "Schema to create a custom field of type select." }, "CustomFieldCreateText": { "properties": { "metadata": { "additionalProperties": { "anyOf": [ { "type": "string", "maxLength": 500, "minLength": 1 }, { "type": "integer" }, { "type": "number" }, { "type": "boolean" } ] }, "propertyNames": { "maxLength": 40, "minLength": 1 }, "type": "object", "maxProperties": 50, "title": "Metadata", "description": "Key-value object allowing you to store additional information.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**." }, "type": { "type": "string", "const": "text", "title": "Type" }, "slug": { "type": "string", "minLength": 1, "pattern": "^[a-z0-9-_]+$", "title": "Slug", "description": "Identifier of the custom field. It'll be used as key when storing the value. Must be unique across the organization.It can only contain ASCII letters, numbers and hyphens." }, "name": { "type": "string", "minLength": 1, "title": "Name", "description": "Name of the custom field." }, "organization_id": { "anyOf": [ { "type": "string", "format": "uuid4", "description": "The organization ID.", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "x-polar-selector-widget": { "displayProperty": "name", "resourceName": "Organization", "resourceRoot": "/v1/organizations" } }, { "type": "null" } ], "title": "Organization Id", "description": "The ID of the organization owning the custom field. **Required unless you use an organization token.**" }, "properties": { "$ref": "#/components/schemas/CustomFieldTextProperties" } }, "type": "object", "required": [ "type", "slug", "name", "properties" ], "title": "CustomFieldCreateText", "description": "Schema to create a custom field of type text." }, "CustomFieldDate": { "properties": { "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "metadata": { "$ref": "#/components/schemas/MetadataOutputType" }, "type": { "type": "string", "const": "date", "title": "Type" }, "slug": { "type": "string", "title": "Slug", "description": "Identifier of the custom field. It'll be used as key when storing the value." }, "name": { "type": "string", "title": "Name", "description": "Name of the custom field." }, "organization_id": { "type": "string", "format": "uuid4", "title": "Organization Id", "description": "The ID of the organization owning the custom field.", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "x-polar-selector-widget": { "displayProperty": "name", "resourceName": "Organization", "resourceRoot": "/v1/organizations" } }, "properties": { "$ref": "#/components/schemas/CustomFieldDateProperties" } }, "type": "object", "required": [ "created_at", "modified_at", "id", "metadata", "type", "slug", "name", "organization_id", "properties" ], "title": "CustomFieldDate", "description": "Schema for a custom field of type date." }, "CustomFieldDateProperties": { "properties": { "form_label": { "type": "string", "minLength": 1, "title": "Form Label" }, "form_help_text": { "type": "string", "minLength": 1, "title": "Form Help Text" }, "form_placeholder": { "type": "string", "minLength": 1, "title": "Form Placeholder" }, "ge": { "type": "integer", "maximum": 2147483647, "minimum": -2147483648, "title": "Ge" }, "le": { "type": "integer", "maximum": 2147483647, "minimum": -2147483648, "title": "Le" } }, "type": "object", "title": "CustomFieldDateProperties" }, "CustomFieldNumber": { "properties": { "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "metadata": { "$ref": "#/components/schemas/MetadataOutputType" }, "type": { "type": "string", "const": "number", "title": "Type" }, "slug": { "type": "string", "title": "Slug", "description": "Identifier of the custom field. It'll be used as key when storing the value." }, "name": { "type": "string", "title": "Name", "description": "Name of the custom field." }, "organization_id": { "type": "string", "format": "uuid4", "title": "Organization Id", "description": "The ID of the organization owning the custom field.", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "x-polar-selector-widget": { "displayProperty": "name", "resourceName": "Organization", "resourceRoot": "/v1/organizations" } }, "properties": { "$ref": "#/components/schemas/CustomFieldNumberProperties" } }, "type": "object", "required": [ "created_at", "modified_at", "id", "metadata", "type", "slug", "name", "organization_id", "properties" ], "title": "CustomFieldNumber", "description": "Schema for a custom field of type number." }, "CustomFieldNumberProperties": { "properties": { "form_label": { "type": "string", "minLength": 1, "title": "Form Label" }, "form_help_text": { "type": "string", "minLength": 1, "title": "Form Help Text" }, "form_placeholder": { "type": "string", "minLength": 1, "title": "Form Placeholder" }, "ge": { "type": "integer", "maximum": 2147483647, "minimum": -2147483648, "title": "Ge" }, "le": { "type": "integer", "maximum": 2147483647, "minimum": -2147483648, "title": "Le" } }, "type": "object", "title": "CustomFieldNumberProperties" }, "CustomFieldSelect": { "properties": { "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "metadata": { "$ref": "#/components/schemas/MetadataOutputType" }, "type": { "type": "string", "const": "select", "title": "Type" }, "slug": { "type": "string", "title": "Slug", "description": "Identifier of the custom field. It'll be used as key when storing the value." }, "name": { "type": "string", "title": "Name", "description": "Name of the custom field." }, "organization_id": { "type": "string", "format": "uuid4", "title": "Organization Id", "description": "The ID of the organization owning the custom field.", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "x-polar-selector-widget": { "displayProperty": "name", "resourceName": "Organization", "resourceRoot": "/v1/organizations" } }, "properties": { "$ref": "#/components/schemas/CustomFieldSelectProperties" } }, "type": "object", "required": [ "created_at", "modified_at", "id", "metadata", "type", "slug", "name", "organization_id", "properties" ], "title": "CustomFieldSelect", "description": "Schema for a custom field of type select." }, "CustomFieldSelectOption": { "properties": { "value": { "type": "string", "minLength": 1, "title": "Value" }, "label": { "type": "string", "minLength": 1, "title": "Label" } }, "type": "object", "required": [ "value", "label" ], "title": "CustomFieldSelectOption" }, "CustomFieldSelectProperties": { "properties": { "form_label": { "type": "string", "minLength": 1, "title": "Form Label" }, "form_help_text": { "type": "string", "minLength": 1, "title": "Form Help Text" }, "form_placeholder": { "type": "string", "minLength": 1, "title": "Form Placeholder" }, "options": { "items": { "$ref": "#/components/schemas/CustomFieldSelectOption" }, "type": "array", "minItems": 1, "title": "Options" } }, "type": "object", "required": [ "options" ], "title": "CustomFieldSelectProperties" }, "CustomFieldSortProperty": { "type": "string", "enum": [ "created_at", "-created_at", "slug", "-slug", "name", "-name", "type", "-type" ], "title": "CustomFieldSortProperty" }, "CustomFieldText": { "properties": { "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "metadata": { "$ref": "#/components/schemas/MetadataOutputType" }, "type": { "type": "string", "const": "text", "title": "Type" }, "slug": { "type": "string", "title": "Slug", "description": "Identifier of the custom field. It'll be used as key when storing the value." }, "name": { "type": "string", "title": "Name", "description": "Name of the custom field." }, "organization_id": { "type": "string", "format": "uuid4", "title": "Organization Id", "description": "The ID of the organization owning the custom field.", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "x-polar-selector-widget": { "displayProperty": "name", "resourceName": "Organization", "resourceRoot": "/v1/organizations" } }, "properties": { "$ref": "#/components/schemas/CustomFieldTextProperties" } }, "type": "object", "required": [ "created_at", "modified_at", "id", "metadata", "type", "slug", "name", "organization_id", "properties" ], "title": "CustomFieldText", "description": "Schema for a custom field of type text." }, "CustomFieldTextProperties": { "properties": { "form_label": { "type": "string", "minLength": 1, "title": "Form Label" }, "form_help_text": { "type": "string", "minLength": 1, "title": "Form Help Text" }, "form_placeholder": { "type": "string", "minLength": 1, "title": "Form Placeholder" }, "textarea": { "type": "boolean", "title": "Textarea" }, "min_length": { "type": "integer", "maximum": 2147483647, "minimum": 0, "title": "Min Length" }, "max_length": { "type": "integer", "maximum": 2147483647, "minimum": 0, "title": "Max Length" } }, "type": "object", "title": "CustomFieldTextProperties" }, "CustomFieldType": { "type": "string", "enum": [ "text", "number", "date", "checkbox", "select" ], "title": "CustomFieldType" }, "CustomFieldUpdate": { "oneOf": [ { "$ref": "#/components/schemas/CustomFieldUpdateText" }, { "$ref": "#/components/schemas/CustomFieldUpdateNumber" }, { "$ref": "#/components/schemas/CustomFieldUpdateDate" }, { "$ref": "#/components/schemas/CustomFieldUpdateCheckbox" }, { "$ref": "#/components/schemas/CustomFieldUpdateSelect" } ], "discriminator": { "propertyName": "type", "mapping": { "checkbox": "#/components/schemas/CustomFieldUpdateCheckbox", "date": "#/components/schemas/CustomFieldUpdateDate", "number": "#/components/schemas/CustomFieldUpdateNumber", "select": "#/components/schemas/CustomFieldUpdateSelect", "text": "#/components/schemas/CustomFieldUpdateText" } } }, "CustomFieldUpdateCheckbox": { "properties": { "metadata": { "additionalProperties": { "anyOf": [ { "type": "string", "maxLength": 500, "minLength": 1 }, { "type": "integer" }, { "type": "number" }, { "type": "boolean" } ] }, "propertyNames": { "maxLength": 40, "minLength": 1 }, "type": "object", "maxProperties": 50, "title": "Metadata", "description": "Key-value object allowing you to store additional information.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**." }, "name": { "anyOf": [ { "type": "string", "minLength": 1, "description": "Name of the custom field." }, { "type": "null" } ], "title": "Name" }, "slug": { "anyOf": [ { "type": "string", "minLength": 1, "pattern": "^[a-z0-9-_]+$", "description": "Identifier of the custom field. It'll be used as key when storing the value. Must be unique across the organization.It can only contain ASCII letters, numbers and hyphens." }, { "type": "null" } ], "title": "Slug" }, "type": { "type": "string", "const": "checkbox", "title": "Type" }, "properties": { "anyOf": [ { "$ref": "#/components/schemas/CustomFieldCheckboxProperties" }, { "type": "null" } ] } }, "type": "object", "required": [ "type" ], "title": "CustomFieldUpdateCheckbox", "description": "Schema to update a custom field of type checkbox." }, "CustomFieldUpdateDate": { "properties": { "metadata": { "additionalProperties": { "anyOf": [ { "type": "string", "maxLength": 500, "minLength": 1 }, { "type": "integer" }, { "type": "number" }, { "type": "boolean" } ] }, "propertyNames": { "maxLength": 40, "minLength": 1 }, "type": "object", "maxProperties": 50, "title": "Metadata", "description": "Key-value object allowing you to store additional information.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**." }, "name": { "anyOf": [ { "type": "string", "minLength": 1, "description": "Name of the custom field." }, { "type": "null" } ], "title": "Name" }, "slug": { "anyOf": [ { "type": "string", "minLength": 1, "pattern": "^[a-z0-9-_]+$", "description": "Identifier of the custom field. It'll be used as key when storing the value. Must be unique across the organization.It can only contain ASCII letters, numbers and hyphens." }, { "type": "null" } ], "title": "Slug" }, "type": { "type": "string", "const": "date", "title": "Type" }, "properties": { "anyOf": [ { "$ref": "#/components/schemas/CustomFieldDateProperties" }, { "type": "null" } ] } }, "type": "object", "required": [ "type" ], "title": "CustomFieldUpdateDate", "description": "Schema to update a custom field of type date." }, "CustomFieldUpdateNumber": { "properties": { "metadata": { "additionalProperties": { "anyOf": [ { "type": "string", "maxLength": 500, "minLength": 1 }, { "type": "integer" }, { "type": "number" }, { "type": "boolean" } ] }, "propertyNames": { "maxLength": 40, "minLength": 1 }, "type": "object", "maxProperties": 50, "title": "Metadata", "description": "Key-value object allowing you to store additional information.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**." }, "name": { "anyOf": [ { "type": "string", "minLength": 1, "description": "Name of the custom field." }, { "type": "null" } ], "title": "Name" }, "slug": { "anyOf": [ { "type": "string", "minLength": 1, "pattern": "^[a-z0-9-_]+$", "description": "Identifier of the custom field. It'll be used as key when storing the value. Must be unique across the organization.It can only contain ASCII letters, numbers and hyphens." }, { "type": "null" } ], "title": "Slug" }, "type": { "type": "string", "const": "number", "title": "Type" }, "properties": { "anyOf": [ { "$ref": "#/components/schemas/CustomFieldNumberProperties" }, { "type": "null" } ] } }, "type": "object", "required": [ "type" ], "title": "CustomFieldUpdateNumber", "description": "Schema to update a custom field of type number." }, "CustomFieldUpdateSelect": { "properties": { "metadata": { "additionalProperties": { "anyOf": [ { "type": "string", "maxLength": 500, "minLength": 1 }, { "type": "integer" }, { "type": "number" }, { "type": "boolean" } ] }, "propertyNames": { "maxLength": 40, "minLength": 1 }, "type": "object", "maxProperties": 50, "title": "Metadata", "description": "Key-value object allowing you to store additional information.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**." }, "name": { "anyOf": [ { "type": "string", "minLength": 1, "description": "Name of the custom field." }, { "type": "null" } ], "title": "Name" }, "slug": { "anyOf": [ { "type": "string", "minLength": 1, "pattern": "^[a-z0-9-_]+$", "description": "Identifier of the custom field. It'll be used as key when storing the value. Must be unique across the organization.It can only contain ASCII letters, numbers and hyphens." }, { "type": "null" } ], "title": "Slug" }, "type": { "type": "string", "const": "select", "title": "Type" }, "properties": { "anyOf": [ { "$ref": "#/components/schemas/CustomFieldSelectProperties" }, { "type": "null" } ] } }, "type": "object", "required": [ "type" ], "title": "CustomFieldUpdateSelect", "description": "Schema to update a custom field of type select." }, "CustomFieldUpdateText": { "properties": { "metadata": { "additionalProperties": { "anyOf": [ { "type": "string", "maxLength": 500, "minLength": 1 }, { "type": "integer" }, { "type": "number" }, { "type": "boolean" } ] }, "propertyNames": { "maxLength": 40, "minLength": 1 }, "type": "object", "maxProperties": 50, "title": "Metadata", "description": "Key-value object allowing you to store additional information.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**." }, "name": { "anyOf": [ { "type": "string", "minLength": 1, "description": "Name of the custom field." }, { "type": "null" } ], "title": "Name" }, "slug": { "anyOf": [ { "type": "string", "minLength": 1, "pattern": "^[a-z0-9-_]+$", "description": "Identifier of the custom field. It'll be used as key when storing the value. Must be unique across the organization.It can only contain ASCII letters, numbers and hyphens." }, { "type": "null" } ], "title": "Slug" }, "type": { "type": "string", "const": "text", "title": "Type" }, "properties": { "anyOf": [ { "$ref": "#/components/schemas/CustomFieldTextProperties" }, { "type": "null" } ] } }, "type": "object", "required": [ "type" ], "title": "CustomFieldUpdateText", "description": "Schema to update a custom field of type text." }, "Customer": { "properties": { "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the customer.", "examples": [ "992fae2a-2a17-4b7a-8d9e-e287cf90131b" ] }, "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "metadata": { "$ref": "#/components/schemas/MetadataOutputType" }, "external_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "External Id", "description": "The ID of the customer in your system. This must be unique within the organization. Once set, it can't be updated.", "examples": [ "usr_1337" ] }, "email": { "type": "string", "title": "Email", "description": "The email address of the customer. This must be unique within the organization.", "examples": [ "customer@example.com" ] }, "email_verified": { "type": "boolean", "title": "Email Verified", "description": "Whether the customer email address is verified. The address is automatically verified when the customer accesses the customer portal using their email address.", "examples": [ true ] }, "type": { "anyOf": [ { "$ref": "#/components/schemas/CustomerType" }, { "type": "null" } ], "description": "The type of customer: 'individual' for single users, 'team' for customers with multiple members. Legacy customers may have NULL type which is treated as 'individual'.", "examples": [ "individual" ] }, "name": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Name", "description": "The name of the customer.", "examples": [ "John Doe" ] }, "billing_address": { "anyOf": [ { "$ref": "#/components/schemas/Address" }, { "type": "null" } ] }, "tax_id": { "anyOf": [ { "prefixItems": [ { "type": "string" }, { "$ref": "#/components/schemas/TaxIDFormat" } ], "type": "array", "maxItems": 2, "minItems": 2, "examples": [ [ "911144442", "us_ein" ], [ "FR61954506077", "eu_vat" ] ] }, { "type": "null" } ], "title": "Tax Id" }, "locale": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Locale" }, "organization_id": { "type": "string", "format": "uuid4", "title": "Organization Id", "description": "The ID of the organization owning the customer.", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ] }, "deleted_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Deleted At", "description": "Timestamp for when the customer was soft deleted." }, "avatar_url": { "type": "string", "title": "Avatar Url", "examples": [ "https://www.gravatar.com/avatar/xxx?d=404" ] } }, "type": "object", "required": [ "id", "created_at", "modified_at", "metadata", "email", "email_verified", "name", "billing_address", "tax_id", "organization_id", "deleted_at", "avatar_url" ], "title": "Customer", "description": "A customer in an organization." }, "CustomerBenefitGrant": { "anyOf": [ { "$ref": "#/components/schemas/CustomerBenefitGrantDiscord" }, { "$ref": "#/components/schemas/CustomerBenefitGrantGitHubRepository" }, { "$ref": "#/components/schemas/CustomerBenefitGrantDownloadables" }, { "$ref": "#/components/schemas/CustomerBenefitGrantLicenseKeys" }, { "$ref": "#/components/schemas/CustomerBenefitGrantCustom" }, { "$ref": "#/components/schemas/CustomerBenefitGrantMeterCredit" }, { "$ref": "#/components/schemas/CustomerBenefitGrantFeatureFlag" } ] }, "CustomerBenefitGrantCustom": { "properties": { "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "granted_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Granted At" }, "revoked_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Revoked At" }, "customer_id": { "type": "string", "format": "uuid4", "title": "Customer Id" }, "member_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Member Id" }, "benefit_id": { "type": "string", "format": "uuid4", "title": "Benefit Id" }, "subscription_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Subscription Id" }, "order_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Order Id" }, "is_granted": { "type": "boolean", "title": "Is Granted" }, "is_revoked": { "type": "boolean", "title": "Is Revoked" }, "error": { "anyOf": [ { "$ref": "#/components/schemas/BenefitGrantError" }, { "type": "null" } ] }, "customer": { "$ref": "#/components/schemas/CustomerPortalCustomer" }, "benefit": { "$ref": "#/components/schemas/BenefitCustomSubscriber" }, "properties": { "$ref": "#/components/schemas/BenefitGrantCustomProperties" } }, "type": "object", "required": [ "created_at", "modified_at", "id", "granted_at", "revoked_at", "customer_id", "benefit_id", "subscription_id", "order_id", "is_granted", "is_revoked", "customer", "benefit", "properties" ], "title": "CustomerBenefitGrantCustom" }, "CustomerBenefitGrantCustomUpdate": { "properties": { "benefit_type": { "type": "string", "const": "custom", "title": "Benefit Type" } }, "type": "object", "required": [ "benefit_type" ], "title": "CustomerBenefitGrantCustomUpdate" }, "CustomerBenefitGrantDiscord": { "properties": { "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "granted_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Granted At" }, "revoked_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Revoked At" }, "customer_id": { "type": "string", "format": "uuid4", "title": "Customer Id" }, "member_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Member Id" }, "benefit_id": { "type": "string", "format": "uuid4", "title": "Benefit Id" }, "subscription_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Subscription Id" }, "order_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Order Id" }, "is_granted": { "type": "boolean", "title": "Is Granted" }, "is_revoked": { "type": "boolean", "title": "Is Revoked" }, "error": { "anyOf": [ { "$ref": "#/components/schemas/BenefitGrantError" }, { "type": "null" } ] }, "customer": { "$ref": "#/components/schemas/CustomerPortalCustomer" }, "benefit": { "$ref": "#/components/schemas/BenefitDiscordSubscriber" }, "properties": { "$ref": "#/components/schemas/BenefitGrantDiscordProperties" } }, "type": "object", "required": [ "created_at", "modified_at", "id", "granted_at", "revoked_at", "customer_id", "benefit_id", "subscription_id", "order_id", "is_granted", "is_revoked", "customer", "benefit", "properties" ], "title": "CustomerBenefitGrantDiscord" }, "CustomerBenefitGrantDiscordPropertiesUpdate": { "properties": { "account_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Account Id" } }, "type": "object", "required": [ "account_id" ], "title": "CustomerBenefitGrantDiscordPropertiesUpdate" }, "CustomerBenefitGrantDiscordUpdate": { "properties": { "benefit_type": { "type": "string", "const": "discord", "title": "Benefit Type" }, "properties": { "$ref": "#/components/schemas/CustomerBenefitGrantDiscordPropertiesUpdate" } }, "type": "object", "required": [ "benefit_type", "properties" ], "title": "CustomerBenefitGrantDiscordUpdate" }, "CustomerBenefitGrantDownloadables": { "properties": { "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "granted_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Granted At" }, "revoked_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Revoked At" }, "customer_id": { "type": "string", "format": "uuid4", "title": "Customer Id" }, "member_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Member Id" }, "benefit_id": { "type": "string", "format": "uuid4", "title": "Benefit Id" }, "subscription_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Subscription Id" }, "order_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Order Id" }, "is_granted": { "type": "boolean", "title": "Is Granted" }, "is_revoked": { "type": "boolean", "title": "Is Revoked" }, "error": { "anyOf": [ { "$ref": "#/components/schemas/BenefitGrantError" }, { "type": "null" } ] }, "customer": { "$ref": "#/components/schemas/CustomerPortalCustomer" }, "benefit": { "$ref": "#/components/schemas/BenefitDownloadablesSubscriber" }, "properties": { "$ref": "#/components/schemas/BenefitGrantDownloadablesProperties" } }, "type": "object", "required": [ "created_at", "modified_at", "id", "granted_at", "revoked_at", "customer_id", "benefit_id", "subscription_id", "order_id", "is_granted", "is_revoked", "customer", "benefit", "properties" ], "title": "CustomerBenefitGrantDownloadables" }, "CustomerBenefitGrantDownloadablesUpdate": { "properties": { "benefit_type": { "type": "string", "const": "downloadables", "title": "Benefit Type" } }, "type": "object", "required": [ "benefit_type" ], "title": "CustomerBenefitGrantDownloadablesUpdate" }, "CustomerBenefitGrantFeatureFlag": { "properties": { "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "granted_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Granted At" }, "revoked_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Revoked At" }, "customer_id": { "type": "string", "format": "uuid4", "title": "Customer Id" }, "member_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Member Id" }, "benefit_id": { "type": "string", "format": "uuid4", "title": "Benefit Id" }, "subscription_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Subscription Id" }, "order_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Order Id" }, "is_granted": { "type": "boolean", "title": "Is Granted" }, "is_revoked": { "type": "boolean", "title": "Is Revoked" }, "error": { "anyOf": [ { "$ref": "#/components/schemas/BenefitGrantError" }, { "type": "null" } ] }, "customer": { "$ref": "#/components/schemas/CustomerPortalCustomer" }, "benefit": { "$ref": "#/components/schemas/BenefitFeatureFlagSubscriber" }, "properties": { "$ref": "#/components/schemas/BenefitGrantFeatureFlagProperties" } }, "type": "object", "required": [ "created_at", "modified_at", "id", "granted_at", "revoked_at", "customer_id", "benefit_id", "subscription_id", "order_id", "is_granted", "is_revoked", "customer", "benefit", "properties" ], "title": "CustomerBenefitGrantFeatureFlag" }, "CustomerBenefitGrantFeatureFlagUpdate": { "properties": { "benefit_type": { "type": "string", "const": "feature_flag", "title": "Benefit Type" } }, "type": "object", "required": [ "benefit_type" ], "title": "CustomerBenefitGrantFeatureFlagUpdate" }, "CustomerBenefitGrantGitHubRepository": { "properties": { "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "granted_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Granted At" }, "revoked_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Revoked At" }, "customer_id": { "type": "string", "format": "uuid4", "title": "Customer Id" }, "member_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Member Id" }, "benefit_id": { "type": "string", "format": "uuid4", "title": "Benefit Id" }, "subscription_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Subscription Id" }, "order_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Order Id" }, "is_granted": { "type": "boolean", "title": "Is Granted" }, "is_revoked": { "type": "boolean", "title": "Is Revoked" }, "error": { "anyOf": [ { "$ref": "#/components/schemas/BenefitGrantError" }, { "type": "null" } ] }, "customer": { "$ref": "#/components/schemas/CustomerPortalCustomer" }, "benefit": { "$ref": "#/components/schemas/BenefitGitHubRepositorySubscriber" }, "properties": { "$ref": "#/components/schemas/BenefitGrantGitHubRepositoryProperties" } }, "type": "object", "required": [ "created_at", "modified_at", "id", "granted_at", "revoked_at", "customer_id", "benefit_id", "subscription_id", "order_id", "is_granted", "is_revoked", "customer", "benefit", "properties" ], "title": "CustomerBenefitGrantGitHubRepository" }, "CustomerBenefitGrantGitHubRepositoryPropertiesUpdate": { "properties": { "account_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Account Id" } }, "type": "object", "required": [ "account_id" ], "title": "CustomerBenefitGrantGitHubRepositoryPropertiesUpdate" }, "CustomerBenefitGrantGitHubRepositoryUpdate": { "properties": { "benefit_type": { "type": "string", "const": "github_repository", "title": "Benefit Type" }, "properties": { "$ref": "#/components/schemas/CustomerBenefitGrantGitHubRepositoryPropertiesUpdate" } }, "type": "object", "required": [ "benefit_type", "properties" ], "title": "CustomerBenefitGrantGitHubRepositoryUpdate" }, "CustomerBenefitGrantLicenseKeys": { "properties": { "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "granted_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Granted At" }, "revoked_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Revoked At" }, "customer_id": { "type": "string", "format": "uuid4", "title": "Customer Id" }, "member_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Member Id" }, "benefit_id": { "type": "string", "format": "uuid4", "title": "Benefit Id" }, "subscription_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Subscription Id" }, "order_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Order Id" }, "is_granted": { "type": "boolean", "title": "Is Granted" }, "is_revoked": { "type": "boolean", "title": "Is Revoked" }, "error": { "anyOf": [ { "$ref": "#/components/schemas/BenefitGrantError" }, { "type": "null" } ] }, "customer": { "$ref": "#/components/schemas/CustomerPortalCustomer" }, "benefit": { "$ref": "#/components/schemas/BenefitLicenseKeysSubscriber" }, "properties": { "$ref": "#/components/schemas/BenefitGrantLicenseKeysProperties" } }, "type": "object", "required": [ "created_at", "modified_at", "id", "granted_at", "revoked_at", "customer_id", "benefit_id", "subscription_id", "order_id", "is_granted", "is_revoked", "customer", "benefit", "properties" ], "title": "CustomerBenefitGrantLicenseKeys" }, "CustomerBenefitGrantLicenseKeysUpdate": { "properties": { "benefit_type": { "type": "string", "const": "license_keys", "title": "Benefit Type" } }, "type": "object", "required": [ "benefit_type" ], "title": "CustomerBenefitGrantLicenseKeysUpdate" }, "CustomerBenefitGrantMeterCredit": { "properties": { "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "granted_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Granted At" }, "revoked_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Revoked At" }, "customer_id": { "type": "string", "format": "uuid4", "title": "Customer Id" }, "member_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Member Id" }, "benefit_id": { "type": "string", "format": "uuid4", "title": "Benefit Id" }, "subscription_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Subscription Id" }, "order_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Order Id" }, "is_granted": { "type": "boolean", "title": "Is Granted" }, "is_revoked": { "type": "boolean", "title": "Is Revoked" }, "error": { "anyOf": [ { "$ref": "#/components/schemas/BenefitGrantError" }, { "type": "null" } ] }, "customer": { "$ref": "#/components/schemas/CustomerPortalCustomer" }, "benefit": { "$ref": "#/components/schemas/BenefitMeterCreditSubscriber" }, "properties": { "$ref": "#/components/schemas/BenefitGrantMeterCreditProperties" } }, "type": "object", "required": [ "created_at", "modified_at", "id", "granted_at", "revoked_at", "customer_id", "benefit_id", "subscription_id", "order_id", "is_granted", "is_revoked", "customer", "benefit", "properties" ], "title": "CustomerBenefitGrantMeterCredit" }, "CustomerBenefitGrantMeterCreditUpdate": { "properties": { "benefit_type": { "type": "string", "const": "meter_credit", "title": "Benefit Type" } }, "type": "object", "required": [ "benefit_type" ], "title": "CustomerBenefitGrantMeterCreditUpdate" }, "CustomerBenefitGrantSortProperty": { "type": "string", "enum": [ "granted_at", "-granted_at", "type", "-type", "organization", "-organization", "product_benefit", "-product_benefit" ], "title": "CustomerBenefitGrantSortProperty" }, "CustomerBenefitGrantUpdate": { "oneOf": [ { "$ref": "#/components/schemas/CustomerBenefitGrantDiscordUpdate" }, { "$ref": "#/components/schemas/CustomerBenefitGrantGitHubRepositoryUpdate" }, { "$ref": "#/components/schemas/CustomerBenefitGrantDownloadablesUpdate" }, { "$ref": "#/components/schemas/CustomerBenefitGrantLicenseKeysUpdate" }, { "$ref": "#/components/schemas/CustomerBenefitGrantCustomUpdate" }, { "$ref": "#/components/schemas/CustomerBenefitGrantMeterCreditUpdate" }, { "$ref": "#/components/schemas/CustomerBenefitGrantFeatureFlagUpdate" } ], "discriminator": { "propertyName": "benefit_type", "mapping": { "custom": "#/components/schemas/CustomerBenefitGrantCustomUpdate", "discord": "#/components/schemas/CustomerBenefitGrantDiscordUpdate", "downloadables": "#/components/schemas/CustomerBenefitGrantDownloadablesUpdate", "feature_flag": "#/components/schemas/CustomerBenefitGrantFeatureFlagUpdate", "github_repository": "#/components/schemas/CustomerBenefitGrantGitHubRepositoryUpdate", "license_keys": "#/components/schemas/CustomerBenefitGrantLicenseKeysUpdate", "meter_credit": "#/components/schemas/CustomerBenefitGrantMeterCreditUpdate" } } }, "CustomerCancellationReason": { "type": "string", "enum": [ "customer_service", "low_quality", "missing_features", "switched_service", "too_complex", "too_expensive", "unused", "other" ], "title": "CustomerCancellationReason" }, "CustomerCreate": { "properties": { "metadata": { "additionalProperties": { "anyOf": [ { "type": "string", "maxLength": 500, "minLength": 1 }, { "type": "integer" }, { "type": "number" }, { "type": "boolean" } ] }, "propertyNames": { "maxLength": 40, "minLength": 1 }, "type": "object", "maxProperties": 50, "title": "Metadata", "description": "Key-value object allowing you to store additional information.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**." }, "external_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "External Id", "description": "The ID of the customer in your system. This must be unique within the organization. Once set, it can't be updated.", "examples": [ "usr_1337" ] }, "email": { "type": "string", "format": "email", "title": "Email", "description": "The email address of the customer. This must be unique within the organization.", "examples": [ "customer@example.com" ] }, "name": { "anyOf": [ { "type": "string", "maxLength": 256, "description": "The name of the customer.", "examples": [ "John Doe" ] }, { "type": "null" } ], "title": "Name" }, "billing_address": { "anyOf": [ { "$ref": "#/components/schemas/AddressInput" }, { "type": "null" } ] }, "tax_id": { "anyOf": [ { "prefixItems": [ { "type": "string" }, { "$ref": "#/components/schemas/TaxIDFormat" } ], "type": "array", "maxItems": 2, "minItems": 2, "examples": [ [ "911144442", "us_ein" ], [ "FR61954506077", "eu_vat" ] ] }, { "type": "null" } ], "title": "Tax Id" }, "locale": { "anyOf": [ { "type": "string", "pattern": "^[a-zA-Z]{2,3}(-[a-zA-Z]{2}|-[0-9]{3})?$", "description": "Locale of the customer, given as an IETF BCP 47 language tag. Supported: language code (e.g. `en`) or language + region (e.g. `en-US`). If `null` or unsupported, the locale will default to `en-US`.", "examples": [ "en", "en-US", "fr", "fr-CA" ] }, { "type": "null" } ], "title": "Locale" }, "type": { "anyOf": [ { "$ref": "#/components/schemas/CustomerType" }, { "type": "null" } ], "description": "The type of customer. Defaults to 'individual'. Set to 'team' for customers that can have multiple members.", "examples": [ "individual" ] }, "organization_id": { "anyOf": [ { "type": "string", "format": "uuid4", "description": "The organization ID.", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "x-polar-selector-widget": { "displayProperty": "name", "resourceName": "Organization", "resourceRoot": "/v1/organizations" } }, { "type": "null" } ], "title": "Organization Id", "description": "The ID of the organization owning the customer. **Required unless you use an organization token.**" }, "owner": { "anyOf": [ { "$ref": "#/components/schemas/OwnerCreate" }, { "type": "null" } ], "description": "Optional owner member to create with the customer. If not provided, an owner member will be automatically created using the customer's email and name." } }, "type": "object", "required": [ "email" ], "title": "CustomerCreate" }, "CustomerCreatedEvent": { "properties": { "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "timestamp": { "type": "string", "format": "date-time", "title": "Timestamp", "description": "The timestamp of the event." }, "organization_id": { "type": "string", "format": "uuid4", "title": "Organization Id", "description": "The ID of the organization owning the event.", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "x-polar-selector-widget": { "displayProperty": "name", "resourceName": "Organization", "resourceRoot": "/v1/organizations" } }, "customer_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Customer Id", "description": "ID of the customer in your Polar organization associated with the event." }, "customer": { "anyOf": [ { "$ref": "#/components/schemas/Customer" }, { "type": "null" } ], "description": "The customer associated with the event." }, "external_customer_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "External Customer Id", "description": "ID of the customer in your system associated with the event." }, "member_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Member Id", "description": "ID of the member within the customer's organization who performed the action inside B2B." }, "external_member_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "External Member Id", "description": "ID of the member in your system within the customer's organization who performed the action inside B2B." }, "child_count": { "type": "integer", "title": "Child Count", "description": "Number of direct child events linked to this event.", "default": 0 }, "parent_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Parent Id", "description": "The ID of the parent event." }, "label": { "type": "string", "title": "Label", "description": "Human readable label of the event type." }, "source": { "type": "string", "const": "system", "title": "Source", "description": "The source of the event. `system` events are created by Polar. `user` events are the one you create through our ingestion API." }, "name": { "type": "string", "const": "customer.created", "title": "Name", "description": "The name of the event." }, "metadata": { "$ref": "#/components/schemas/CustomerCreatedMetadata" } }, "type": "object", "required": [ "id", "timestamp", "organization_id", "customer_id", "customer", "external_customer_id", "label", "source", "name", "metadata" ], "title": "CustomerCreatedEvent", "description": "An event created by Polar when a customer is created." }, "CustomerCreatedMetadata": { "properties": { "customer_id": { "type": "string", "title": "Customer Id" }, "customer_email": { "type": "string", "title": "Customer Email" }, "customer_name": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Customer Name" }, "customer_external_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Customer External Id" } }, "type": "object", "required": [ "customer_id", "customer_email", "customer_name", "customer_external_id" ], "title": "CustomerCreatedMetadata" }, "CustomerCustomerMeter": { "properties": { "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "customer_id": { "type": "string", "format": "uuid4", "title": "Customer Id", "description": "The ID of the customer.", "examples": [ "992fae2a-2a17-4b7a-8d9e-e287cf90131b" ] }, "meter_id": { "type": "string", "format": "uuid4", "title": "Meter Id", "description": "The ID of the meter.", "examples": [ "d498a884-e2cd-4d3e-8002-f536468a8b22" ] }, "consumed_units": { "type": "number", "title": "Consumed Units", "description": "The number of consumed units.", "examples": [ 25 ] }, "credited_units": { "type": "integer", "title": "Credited Units", "description": "The number of credited units.", "examples": [ 100 ] }, "balance": { "type": "number", "title": "Balance", "description": "The balance of the meter, i.e. the difference between credited and consumed units.", "examples": [ 75 ] }, "meter": { "$ref": "#/components/schemas/CustomerCustomerMeterMeter" } }, "type": "object", "required": [ "id", "created_at", "modified_at", "customer_id", "meter_id", "consumed_units", "credited_units", "balance", "meter" ], "title": "CustomerCustomerMeter" }, "CustomerCustomerMeterMeter": { "properties": { "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "name": { "type": "string", "title": "Name", "description": "The name of the meter. Will be shown on customer's invoices and usage." } }, "type": "object", "required": [ "created_at", "modified_at", "id", "name" ], "title": "CustomerCustomerMeterMeter" }, "CustomerCustomerMeterSortProperty": { "type": "string", "enum": [ "created_at", "-created_at", "modified_at", "-modified_at", "meter_id", "-meter_id", "meter_name", "-meter_name", "consumed_units", "-consumed_units", "credited_units", "-credited_units", "balance", "-balance" ], "title": "CustomerCustomerMeterSortProperty" }, "CustomerCustomerSession": { "properties": { "expires_at": { "type": "string", "format": "date-time", "title": "Expires At" }, "return_url": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Return Url" } }, "type": "object", "required": [ "expires_at", "return_url" ], "title": "CustomerCustomerSession" }, "CustomerDeletedEvent": { "properties": { "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "timestamp": { "type": "string", "format": "date-time", "title": "Timestamp", "description": "The timestamp of the event." }, "organization_id": { "type": "string", "format": "uuid4", "title": "Organization Id", "description": "The ID of the organization owning the event.", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "x-polar-selector-widget": { "displayProperty": "name", "resourceName": "Organization", "resourceRoot": "/v1/organizations" } }, "customer_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Customer Id", "description": "ID of the customer in your Polar organization associated with the event." }, "customer": { "anyOf": [ { "$ref": "#/components/schemas/Customer" }, { "type": "null" } ], "description": "The customer associated with the event." }, "external_customer_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "External Customer Id", "description": "ID of the customer in your system associated with the event." }, "member_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Member Id", "description": "ID of the member within the customer's organization who performed the action inside B2B." }, "external_member_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "External Member Id", "description": "ID of the member in your system within the customer's organization who performed the action inside B2B." }, "child_count": { "type": "integer", "title": "Child Count", "description": "Number of direct child events linked to this event.", "default": 0 }, "parent_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Parent Id", "description": "The ID of the parent event." }, "label": { "type": "string", "title": "Label", "description": "Human readable label of the event type." }, "source": { "type": "string", "const": "system", "title": "Source", "description": "The source of the event. `system` events are created by Polar. `user` events are the one you create through our ingestion API." }, "name": { "type": "string", "const": "customer.deleted", "title": "Name", "description": "The name of the event." }, "metadata": { "$ref": "#/components/schemas/CustomerDeletedMetadata" } }, "type": "object", "required": [ "id", "timestamp", "organization_id", "customer_id", "customer", "external_customer_id", "label", "source", "name", "metadata" ], "title": "CustomerDeletedEvent", "description": "An event created by Polar when a customer is deleted." }, "CustomerDeletedMetadata": { "properties": { "customer_id": { "type": "string", "title": "Customer Id" }, "customer_email": { "type": "string", "title": "Customer Email" }, "customer_name": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Customer Name" }, "customer_external_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Customer External Id" } }, "type": "object", "required": [ "customer_id", "customer_email", "customer_name", "customer_external_id" ], "title": "CustomerDeletedMetadata" }, "CustomerMeter": { "properties": { "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "customer_id": { "type": "string", "format": "uuid4", "title": "Customer Id", "description": "The ID of the customer.", "examples": [ "992fae2a-2a17-4b7a-8d9e-e287cf90131b" ] }, "meter_id": { "type": "string", "format": "uuid4", "title": "Meter Id", "description": "The ID of the meter.", "examples": [ "d498a884-e2cd-4d3e-8002-f536468a8b22" ] }, "consumed_units": { "type": "number", "title": "Consumed Units", "description": "The number of consumed units.", "examples": [ 25 ] }, "credited_units": { "type": "integer", "title": "Credited Units", "description": "The number of credited units.", "examples": [ 100 ] }, "balance": { "type": "number", "title": "Balance", "description": "The balance of the meter, i.e. the difference between credited and consumed units.", "examples": [ 75 ] }, "customer": { "$ref": "#/components/schemas/Customer", "description": "The customer associated with this meter." }, "meter": { "$ref": "#/components/schemas/Meter", "description": "The meter associated with this customer." } }, "type": "object", "required": [ "id", "created_at", "modified_at", "customer_id", "meter_id", "consumed_units", "credited_units", "balance", "customer", "meter" ], "title": "CustomerMeter", "description": "An active customer meter, with current consumed and credited units." }, "CustomerMeterSortProperty": { "type": "string", "enum": [ "created_at", "-created_at", "modified_at", "-modified_at", "customer_id", "-customer_id", "customer_name", "-customer_name", "meter_id", "-meter_id", "meter_name", "-meter_name", "consumed_units", "-consumed_units", "credited_units", "-credited_units", "balance", "-balance" ], "title": "CustomerMeterSortProperty" }, "CustomerNotReady": { "properties": { "error": { "type": "string", "const": "CustomerNotReady", "title": "Error", "examples": [ "CustomerNotReady" ] }, "detail": { "type": "string", "title": "Detail" } }, "type": "object", "required": [ "error", "detail" ], "title": "CustomerNotReady" }, "CustomerOrder": { "properties": { "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "status": { "$ref": "#/components/schemas/OrderStatus", "examples": [ "paid" ] }, "paid": { "type": "boolean", "title": "Paid", "description": "Whether the order has been paid for.", "examples": [ true ] }, "subtotal_amount": { "type": "integer", "title": "Subtotal Amount", "description": "Amount in cents, before discounts and taxes.", "examples": [ 10000 ] }, "discount_amount": { "type": "integer", "title": "Discount Amount", "description": "Discount amount in cents.", "examples": [ 1000 ] }, "net_amount": { "type": "integer", "title": "Net Amount", "description": "Amount in cents, after discounts but before taxes.", "examples": [ 9000 ] }, "tax_amount": { "type": "integer", "title": "Tax Amount", "description": "Sales tax amount in cents.", "examples": [ 720 ] }, "total_amount": { "type": "integer", "title": "Total Amount", "description": "Amount in cents, after discounts and taxes.", "examples": [ 9720 ] }, "applied_balance_amount": { "type": "integer", "title": "Applied Balance Amount", "description": "Customer's balance amount applied to this invoice. Can increase the total amount paid, if the customer has a negative balance, or decrease it, if the customer has a positive balance.Amount in cents.", "examples": [ 0 ] }, "due_amount": { "type": "integer", "title": "Due Amount", "description": "Amount in cents that is due for this order.", "examples": [ 0 ] }, "refunded_amount": { "type": "integer", "title": "Refunded Amount", "description": "Amount refunded in cents.", "examples": [ 0 ] }, "refunded_tax_amount": { "type": "integer", "title": "Refunded Tax Amount", "description": "Sales tax refunded in cents.", "examples": [ 0 ] }, "currency": { "type": "string", "title": "Currency", "examples": [ "usd" ] }, "billing_reason": { "$ref": "#/components/schemas/OrderBillingReason" }, "billing_name": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Billing Name", "description": "The name of the customer that should appear on the invoice. " }, "billing_address": { "anyOf": [ { "$ref": "#/components/schemas/Address" }, { "type": "null" } ] }, "invoice_number": { "type": "string", "title": "Invoice Number", "description": "The invoice number associated with this order." }, "is_invoice_generated": { "type": "boolean", "title": "Is Invoice Generated", "description": "Whether an invoice has been generated for this order." }, "seats": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Seats", "description": "Number of seats purchased (for seat-based one-time orders)." }, "customer_id": { "type": "string", "format": "uuid4", "title": "Customer Id" }, "product_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Product Id" }, "discount_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Discount Id" }, "subscription_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Subscription Id" }, "checkout_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Checkout Id" }, "product": { "anyOf": [ { "$ref": "#/components/schemas/CustomerOrderProduct" }, { "type": "null" } ] }, "subscription": { "anyOf": [ { "$ref": "#/components/schemas/CustomerOrderSubscription" }, { "type": "null" } ] }, "items": { "items": { "$ref": "#/components/schemas/OrderItemSchema" }, "type": "array", "title": "Items", "description": "Line items composing the order." }, "description": { "type": "string", "title": "Description", "description": "A summary description of the order.", "examples": [ "Pro Plan" ] }, "next_payment_attempt_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Next Payment Attempt At", "description": "When the next payment retry is scheduled" } }, "type": "object", "required": [ "id", "created_at", "modified_at", "status", "paid", "subtotal_amount", "discount_amount", "net_amount", "tax_amount", "total_amount", "applied_balance_amount", "due_amount", "refunded_amount", "refunded_tax_amount", "currency", "billing_reason", "billing_name", "billing_address", "invoice_number", "is_invoice_generated", "customer_id", "product_id", "discount_id", "subscription_id", "checkout_id", "product", "subscription", "items", "description" ], "title": "CustomerOrder" }, "CustomerOrderConfirmPayment": { "properties": { "confirmation_token_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Confirmation Token Id", "description": "ID of the Stripe confirmation token for new payment methods." }, "payment_method_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Payment Method Id", "description": "ID of an existing saved payment method." }, "payment_processor": { "$ref": "#/components/schemas/PaymentProcessor", "description": "Payment processor used.", "default": "stripe" } }, "type": "object", "title": "CustomerOrderConfirmPayment", "description": "Schema to confirm a retry payment using either a saved payment method or a new confirmation token." }, "CustomerOrderInvoice": { "properties": { "url": { "type": "string", "title": "Url", "description": "The URL to the invoice." } }, "type": "object", "required": [ "url" ], "title": "CustomerOrderInvoice", "description": "Order's invoice data." }, "CustomerOrderPaymentConfirmation": { "properties": { "status": { "type": "string", "title": "Status", "description": "Payment status after confirmation." }, "client_secret": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Client Secret", "description": "Client secret for handling additional actions." }, "error": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Error", "description": "Error message if confirmation failed." } }, "type": "object", "required": [ "status" ], "title": "CustomerOrderPaymentConfirmation", "description": "Response after confirming a retry payment." }, "CustomerOrderPaymentStatus": { "properties": { "status": { "type": "string", "title": "Status", "description": "Current payment status." }, "error": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Error", "description": "Error message if payment failed." } }, "type": "object", "required": [ "status" ], "title": "CustomerOrderPaymentStatus", "description": "Payment status for an order." }, "CustomerOrderProduct": { "properties": { "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "trial_interval": { "anyOf": [ { "$ref": "#/components/schemas/TrialInterval" }, { "type": "null" } ], "description": "The interval unit for the trial period." }, "trial_interval_count": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Trial Interval Count", "description": "The number of interval units for the trial period." }, "name": { "type": "string", "title": "Name", "description": "The name of the product." }, "description": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Description", "description": "The description of the product." }, "visibility": { "$ref": "#/components/schemas/ProductVisibility", "description": "The visibility of the product." }, "recurring_interval": { "anyOf": [ { "$ref": "#/components/schemas/SubscriptionRecurringInterval" }, { "type": "null" } ], "description": "The recurring interval of the product. If `None`, the product is a one-time purchase." }, "recurring_interval_count": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Recurring Interval Count", "description": "Number of interval units of the subscription. If this is set to 1 the charge will happen every interval (e.g. every month), if set to 2 it will be every other month, and so on. None for one-time products." }, "is_recurring": { "type": "boolean", "title": "Is Recurring", "description": "Whether the product is a subscription." }, "is_archived": { "type": "boolean", "title": "Is Archived", "description": "Whether the product is archived and no longer available." }, "organization_id": { "type": "string", "format": "uuid4", "title": "Organization Id", "description": "The ID of the organization owning the product." }, "prices": { "items": { "oneOf": [ { "$ref": "#/components/schemas/LegacyRecurringProductPrice" }, { "$ref": "#/components/schemas/ProductPrice" } ] }, "type": "array", "title": "Prices", "description": "List of prices for this product." }, "benefits": { "items": { "$ref": "#/components/schemas/BenefitPublic" }, "type": "array", "title": "BenefitPublic", "description": "List of benefits granted by the product." }, "medias": { "items": { "$ref": "#/components/schemas/ProductMediaFileRead" }, "type": "array", "title": "Medias", "description": "List of medias associated to the product." }, "organization": { "$ref": "#/components/schemas/CustomerOrganization" } }, "type": "object", "required": [ "id", "created_at", "modified_at", "trial_interval", "trial_interval_count", "name", "description", "visibility", "recurring_interval", "recurring_interval_count", "is_recurring", "is_archived", "organization_id", "prices", "benefits", "medias", "organization" ], "title": "CustomerOrderProduct" }, "CustomerOrderSortProperty": { "type": "string", "enum": [ "created_at", "-created_at", "amount", "-amount", "net_amount", "-net_amount", "product", "-product", "subscription", "-subscription" ], "title": "CustomerOrderSortProperty" }, "CustomerOrderSubscription": { "properties": { "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "amount": { "type": "integer", "title": "Amount", "description": "The amount of the subscription.", "examples": [ 10000 ] }, "currency": { "type": "string", "title": "Currency", "description": "The currency of the subscription.", "examples": [ "usd" ] }, "recurring_interval": { "$ref": "#/components/schemas/SubscriptionRecurringInterval", "description": "The interval at which the subscription recurs.", "examples": [ "month" ] }, "recurring_interval_count": { "type": "integer", "title": "Recurring Interval Count", "description": "Number of interval units of the subscription. If this is set to 1 the charge will happen every interval (e.g. every month), if set to 2 it will be every other month, and so on." }, "status": { "$ref": "#/components/schemas/SubscriptionStatus", "description": "The status of the subscription.", "examples": [ "active" ] }, "current_period_start": { "type": "string", "format": "date-time", "title": "Current Period Start", "description": "The start timestamp of the current billing period." }, "current_period_end": { "type": "string", "format": "date-time", "title": "Current Period End", "description": "The end timestamp of the current billing period." }, "trial_start": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Trial Start", "description": "The start timestamp of the trial period, if any." }, "trial_end": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Trial End", "description": "The end timestamp of the trial period, if any." }, "cancel_at_period_end": { "type": "boolean", "title": "Cancel At Period End", "description": "Whether the subscription will be canceled at the end of the current period." }, "canceled_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Canceled At", "description": "The timestamp when the subscription was canceled. The subscription might still be active if `cancel_at_period_end` is `true`." }, "started_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Started At", "description": "The timestamp when the subscription started." }, "ends_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Ends At", "description": "The timestamp when the subscription will end." }, "ended_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Ended At", "description": "The timestamp when the subscription ended." }, "customer_id": { "type": "string", "format": "uuid4", "title": "Customer Id", "description": "The ID of the subscribed customer." }, "product_id": { "type": "string", "format": "uuid4", "title": "Product Id", "description": "The ID of the subscribed product." }, "discount_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Discount Id", "description": "The ID of the applied discount, if any." }, "checkout_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Checkout Id" }, "seats": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Seats", "description": "The number of seats for seat-based subscriptions. None for non-seat subscriptions." }, "customer_cancellation_reason": { "anyOf": [ { "$ref": "#/components/schemas/CustomerCancellationReason" }, { "type": "null" } ] }, "customer_cancellation_comment": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Customer Cancellation Comment" } }, "type": "object", "required": [ "created_at", "modified_at", "id", "amount", "currency", "recurring_interval", "recurring_interval_count", "status", "current_period_start", "current_period_end", "trial_start", "trial_end", "cancel_at_period_end", "canceled_at", "started_at", "ends_at", "ended_at", "customer_id", "product_id", "discount_id", "checkout_id", "customer_cancellation_reason", "customer_cancellation_comment" ], "title": "CustomerOrderSubscription" }, "CustomerOrderUpdate": { "properties": { "billing_name": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Billing Name", "description": "The name of the customer that should appear on the invoice." }, "billing_address": { "anyOf": [ { "$ref": "#/components/schemas/AddressInput" }, { "type": "null" } ], "description": "The address of the customer that should appear on the invoice. Country and state fields cannot be updated." } }, "type": "object", "title": "CustomerOrderUpdate", "description": "Schema to update an order." }, "CustomerOrganization": { "properties": { "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "name": { "type": "string", "title": "Name", "description": "Organization name shown in checkout, customer portal, emails etc." }, "slug": { "type": "string", "title": "Slug", "description": "Unique organization slug in checkout, customer portal and credit card statements." }, "avatar_url": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Avatar Url", "description": "Avatar URL shown in checkout, customer portal, emails etc." }, "proration_behavior": { "$ref": "#/components/schemas/SubscriptionProrationBehavior", "description": "Proration behavior applied when customer updates their subscription from the portal." }, "allow_customer_updates": { "type": "boolean", "title": "Allow Customer Updates", "description": "Whether customers can update their subscriptions from the customer portal." }, "customer_portal_settings": { "$ref": "#/components/schemas/OrganizationCustomerPortalSettings", "description": "Settings related to the customer portal" }, "organization_features": { "$ref": "#/components/schemas/CustomerOrganizationFeatureSettings", "description": "Feature flags for the customer portal." } }, "type": "object", "required": [ "created_at", "modified_at", "id", "name", "slug", "avatar_url", "proration_behavior", "allow_customer_updates", "customer_portal_settings" ], "title": "CustomerOrganization" }, "CustomerOrganizationData": { "properties": { "organization": { "$ref": "#/components/schemas/CustomerOrganization" }, "products": { "items": { "$ref": "#/components/schemas/CustomerProduct" }, "type": "array", "title": "Products" } }, "type": "object", "required": [ "organization", "products" ], "title": "CustomerOrganizationData", "description": "Schema of an organization and related data for customer portal." }, "CustomerOrganizationFeatureSettings": { "properties": { "member_model_enabled": { "type": "boolean", "title": "Member Model Enabled", "description": "Whether the member model is enabled for this organization.", "default": false } }, "type": "object", "title": "CustomerOrganizationFeatureSettings", "description": "Feature flags exposed to the customer portal." }, "CustomerPaymentMethod": { "anyOf": [ { "$ref": "#/components/schemas/PaymentMethodCard" }, { "$ref": "#/components/schemas/PaymentMethodGeneric" } ] }, "CustomerPaymentMethodConfirm": { "properties": { "setup_intent_id": { "type": "string", "title": "Setup Intent Id" }, "set_default": { "type": "boolean", "title": "Set Default" } }, "type": "object", "required": [ "setup_intent_id", "set_default" ], "title": "CustomerPaymentMethodConfirm" }, "CustomerPaymentMethodCreate": { "properties": { "confirmation_token_id": { "type": "string", "title": "Confirmation Token Id" }, "set_default": { "type": "boolean", "title": "Set Default" }, "return_url": { "type": "string", "title": "Return Url" } }, "type": "object", "required": [ "confirmation_token_id", "set_default", "return_url" ], "title": "CustomerPaymentMethodCreate" }, "CustomerPaymentMethodCreateRequiresActionResponse": { "properties": { "status": { "type": "string", "const": "requires_action", "title": "Status" }, "client_secret": { "type": "string", "title": "Client Secret" } }, "type": "object", "required": [ "status", "client_secret" ], "title": "CustomerPaymentMethodCreateRequiresActionResponse" }, "CustomerPaymentMethodCreateResponse": { "oneOf": [ { "$ref": "#/components/schemas/CustomerPaymentMethodCreateSucceededResponse" }, { "$ref": "#/components/schemas/CustomerPaymentMethodCreateRequiresActionResponse" } ], "discriminator": { "propertyName": "status", "mapping": { "requires_action": "#/components/schemas/CustomerPaymentMethodCreateRequiresActionResponse", "succeeded": "#/components/schemas/CustomerPaymentMethodCreateSucceededResponse" } } }, "CustomerPaymentMethodCreateSucceededResponse": { "properties": { "status": { "type": "string", "const": "succeeded", "title": "Status" }, "payment_method": { "$ref": "#/components/schemas/CustomerPaymentMethod", "title": "CustomerPaymentMethod" } }, "type": "object", "required": [ "status", "payment_method" ], "title": "CustomerPaymentMethodCreateSucceededResponse" }, "CustomerPortalCustomer": { "properties": { "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "email": { "type": "string", "title": "Email" }, "email_verified": { "type": "boolean", "title": "Email Verified" }, "name": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Name" }, "billing_name": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Billing Name" }, "billing_address": { "anyOf": [ { "$ref": "#/components/schemas/Address" }, { "type": "null" } ] }, "tax_id": { "anyOf": [ { "prefixItems": [ { "type": "string" }, { "$ref": "#/components/schemas/TaxIDFormat" } ], "type": "array", "maxItems": 2, "minItems": 2, "examples": [ [ "911144442", "us_ein" ], [ "FR61954506077", "eu_vat" ] ] }, { "type": "null" } ], "title": "Tax Id" }, "oauth_accounts": { "additionalProperties": { "$ref": "#/components/schemas/CustomerPortalOAuthAccount" }, "type": "object", "title": "Oauth Accounts" }, "default_payment_method_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Default Payment Method Id" }, "type": { "anyOf": [ { "$ref": "#/components/schemas/CustomerType" }, { "type": "null" } ] } }, "type": "object", "required": [ "created_at", "modified_at", "id", "email", "email_verified", "name", "billing_name", "billing_address", "tax_id", "oauth_accounts" ], "title": "CustomerPortalCustomer" }, "CustomerPortalCustomerUpdate": { "properties": { "billing_name": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Billing Name" }, "billing_address": { "anyOf": [ { "$ref": "#/components/schemas/AddressInput" }, { "type": "null" } ] }, "tax_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Tax Id" } }, "type": "object", "title": "CustomerPortalCustomerUpdate" }, "CustomerPortalMember": { "properties": { "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "email": { "type": "string", "title": "Email", "description": "The email address of the member." }, "name": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Name", "description": "The name of the member." }, "role": { "$ref": "#/components/schemas/MemberRole", "description": "The role of the member within the team." } }, "type": "object", "required": [ "created_at", "modified_at", "id", "email", "name", "role" ], "title": "CustomerPortalMember", "description": "A member of the customer's team as seen in the customer portal." }, "CustomerPortalMemberCreate": { "properties": { "email": { "type": "string", "format": "email", "title": "Email", "description": "The email address of the new member." }, "name": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Name", "description": "The name of the new member (optional)." }, "role": { "$ref": "#/components/schemas/MemberRole", "description": "The role for the new member. Defaults to 'member'.", "default": "member", "examples": [ "billing_manager", "member" ] } }, "type": "object", "required": [ "email" ], "title": "CustomerPortalMemberCreate", "description": "Schema for adding a new member to the customer's team." }, "CustomerPortalMemberUpdate": { "properties": { "role": { "anyOf": [ { "$ref": "#/components/schemas/MemberRole" }, { "type": "null" } ], "description": "The new role for the member.", "examples": [ "billing_manager", "member" ] } }, "type": "object", "title": "CustomerPortalMemberUpdate", "description": "Schema for updating a member's role in the customer portal." }, "CustomerPortalOAuthAccount": { "properties": { "account_id": { "type": "string", "title": "Account Id" }, "account_username": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Account Username" } }, "type": "object", "required": [ "account_id", "account_username" ], "title": "CustomerPortalOAuthAccount" }, "CustomerPortalSubscriptionSettings": { "properties": { "update_seats": { "type": "boolean", "title": "Update Seats" }, "update_plan": { "type": "boolean", "title": "Update Plan" } }, "type": "object", "required": [ "update_seats", "update_plan" ], "title": "CustomerPortalSubscriptionSettings" }, "CustomerPortalUsageSettings": { "properties": { "show": { "type": "boolean", "title": "Show" } }, "type": "object", "required": [ "show" ], "title": "CustomerPortalUsageSettings" }, "CustomerProduct": { "properties": { "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "trial_interval": { "anyOf": [ { "$ref": "#/components/schemas/TrialInterval" }, { "type": "null" } ], "description": "The interval unit for the trial period." }, "trial_interval_count": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Trial Interval Count", "description": "The number of interval units for the trial period." }, "name": { "type": "string", "title": "Name", "description": "The name of the product." }, "description": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Description", "description": "The description of the product." }, "visibility": { "$ref": "#/components/schemas/ProductVisibility", "description": "The visibility of the product." }, "recurring_interval": { "anyOf": [ { "$ref": "#/components/schemas/SubscriptionRecurringInterval" }, { "type": "null" } ], "description": "The recurring interval of the product. If `None`, the product is a one-time purchase." }, "recurring_interval_count": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Recurring Interval Count", "description": "Number of interval units of the subscription. If this is set to 1 the charge will happen every interval (e.g. every month), if set to 2 it will be every other month, and so on. None for one-time products." }, "is_recurring": { "type": "boolean", "title": "Is Recurring", "description": "Whether the product is a subscription." }, "is_archived": { "type": "boolean", "title": "Is Archived", "description": "Whether the product is archived and no longer available." }, "organization_id": { "type": "string", "format": "uuid4", "title": "Organization Id", "description": "The ID of the organization owning the product." }, "prices": { "items": { "oneOf": [ { "$ref": "#/components/schemas/LegacyRecurringProductPrice" }, { "$ref": "#/components/schemas/ProductPrice" } ] }, "type": "array", "title": "Prices", "description": "List of available prices for this product." }, "benefits": { "items": { "$ref": "#/components/schemas/BenefitPublic" }, "type": "array", "title": "BenefitPublic", "description": "The benefits granted by the product." }, "medias": { "items": { "$ref": "#/components/schemas/ProductMediaFileRead" }, "type": "array", "title": "Medias", "description": "The medias associated to the product." } }, "type": "object", "required": [ "id", "created_at", "modified_at", "trial_interval", "trial_interval_count", "name", "description", "visibility", "recurring_interval", "recurring_interval_count", "is_recurring", "is_archived", "organization_id", "prices", "benefits", "medias" ], "title": "CustomerProduct", "description": "Schema of a product for customer portal." }, "CustomerSeat": { "properties": { "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "id": { "type": "string", "format": "uuid", "title": "Id", "description": "The seat ID" }, "subscription_id": { "anyOf": [ { "type": "string", "format": "uuid" }, { "type": "null" } ], "title": "Subscription Id", "description": "The subscription ID (for recurring seats)" }, "order_id": { "anyOf": [ { "type": "string", "format": "uuid" }, { "type": "null" } ], "title": "Order Id", "description": "The order ID (for one-time purchase seats)" }, "status": { "$ref": "#/components/schemas/SeatStatus", "description": "Status of the seat" }, "customer_id": { "anyOf": [ { "type": "string", "format": "uuid" }, { "type": "null" } ], "title": "Customer Id", "description": "The customer ID. When member_model_enabled is true, this is the billing customer (purchaser). When false, this is the seat member customer." }, "member_id": { "anyOf": [ { "type": "string", "format": "uuid" }, { "type": "null" } ], "title": "Member Id", "description": "The member ID of the seat occupant" }, "member": { "anyOf": [ { "$ref": "#/components/schemas/Member" }, { "type": "null" } ], "description": "The member associated with this seat" }, "email": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Email", "description": "Email of the seat member (set when member_model_enabled is true)" }, "customer_email": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Customer Email", "description": "The assigned customer email" }, "invitation_token_expires_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Invitation Token Expires At", "description": "When the invitation token expires" }, "claimed_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Claimed At", "description": "When the seat was claimed" }, "revoked_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Revoked At", "description": "When the seat was revoked" }, "seat_metadata": { "anyOf": [ { "additionalProperties": true, "type": "object" }, { "type": "null" } ], "title": "Seat Metadata", "description": "Additional metadata for the seat" } }, "type": "object", "required": [ "created_at", "modified_at", "id", "status" ], "title": "CustomerSeat" }, "CustomerSeatClaimResponse": { "properties": { "seat": { "$ref": "#/components/schemas/CustomerSeat", "description": "The claimed seat" }, "customer_session_token": { "type": "string", "title": "Customer Session Token", "description": "Session token for immediate customer portal access" } }, "type": "object", "required": [ "seat", "customer_session_token" ], "title": "CustomerSeatClaimResponse", "description": "Response after successfully claiming a seat." }, "CustomerSession": { "properties": { "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "token": { "type": "string", "title": "Token" }, "expires_at": { "type": "string", "format": "date-time", "title": "Expires At" }, "return_url": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Return Url" }, "customer_portal_url": { "type": "string", "title": "Customer Portal Url" }, "customer_id": { "type": "string", "format": "uuid4", "title": "Customer Id" }, "customer": { "$ref": "#/components/schemas/Customer" } }, "type": "object", "required": [ "created_at", "modified_at", "id", "token", "expires_at", "return_url", "customer_portal_url", "customer_id", "customer" ], "title": "CustomerSession", "description": "A customer session that can be used to authenticate as a customer." }, "CustomerSessionCustomerExternalIDCreate": { "properties": { "member_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Member Id", "description": "ID of the member to create a session for. When not provided and the organization has `member_model_enabled`, the owner member of the customer will be used for individual customers." }, "external_member_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "External Member Id", "description": "External ID of the member to create a session for. Alternative to `member_id`." }, "return_url": { "anyOf": [ { "type": "string", "maxLength": 2083, "minLength": 1, "format": "uri" }, { "type": "null" } ], "title": "Return Url", "description": "When set, a back button will be shown in the customer portal to return to this URL.", "examples": [ "https://example.com/account" ] }, "external_customer_id": { "type": "string", "title": "External Customer Id", "description": "External ID of the customer to create a session for." } }, "type": "object", "required": [ "external_customer_id" ], "title": "CustomerSessionCustomerExternalIDCreate", "description": "Schema for creating a customer session using an external customer ID." }, "CustomerSessionCustomerIDCreate": { "properties": { "member_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Member Id", "description": "ID of the member to create a session for. When not provided and the organization has `member_model_enabled`, the owner member of the customer will be used for individual customers." }, "external_member_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "External Member Id", "description": "External ID of the member to create a session for. Alternative to `member_id`." }, "return_url": { "anyOf": [ { "type": "string", "maxLength": 2083, "minLength": 1, "format": "uri" }, { "type": "null" } ], "title": "Return Url", "description": "When set, a back button will be shown in the customer portal to return to this URL.", "examples": [ "https://example.com/account" ] }, "customer_id": { "type": "string", "format": "uuid4", "title": "Customer Id", "description": "ID of the customer to create a session for." } }, "type": "object", "required": [ "customer_id" ], "title": "CustomerSessionCustomerIDCreate", "description": "Schema for creating a customer session using a customer ID." }, "CustomerSortProperty": { "type": "string", "enum": [ "created_at", "-created_at", "email", "-email", "name", "-name" ], "title": "CustomerSortProperty" }, "CustomerState": { "properties": { "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the customer.", "examples": [ "992fae2a-2a17-4b7a-8d9e-e287cf90131b" ] }, "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "metadata": { "$ref": "#/components/schemas/MetadataOutputType" }, "external_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "External Id", "description": "The ID of the customer in your system. This must be unique within the organization. Once set, it can't be updated.", "examples": [ "usr_1337" ] }, "email": { "type": "string", "title": "Email", "description": "The email address of the customer. This must be unique within the organization.", "examples": [ "customer@example.com" ] }, "email_verified": { "type": "boolean", "title": "Email Verified", "description": "Whether the customer email address is verified. The address is automatically verified when the customer accesses the customer portal using their email address.", "examples": [ true ] }, "type": { "anyOf": [ { "$ref": "#/components/schemas/CustomerType" }, { "type": "null" } ], "description": "The type of customer: 'individual' for single users, 'team' for customers with multiple members. Legacy customers may have NULL type which is treated as 'individual'.", "examples": [ "individual" ] }, "name": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Name", "description": "The name of the customer.", "examples": [ "John Doe" ] }, "billing_address": { "anyOf": [ { "$ref": "#/components/schemas/Address" }, { "type": "null" } ] }, "tax_id": { "anyOf": [ { "prefixItems": [ { "type": "string" }, { "$ref": "#/components/schemas/TaxIDFormat" } ], "type": "array", "maxItems": 2, "minItems": 2, "examples": [ [ "911144442", "us_ein" ], [ "FR61954506077", "eu_vat" ] ] }, { "type": "null" } ], "title": "Tax Id" }, "locale": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Locale" }, "organization_id": { "type": "string", "format": "uuid4", "title": "Organization Id", "description": "The ID of the organization owning the customer.", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ] }, "deleted_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Deleted At", "description": "Timestamp for when the customer was soft deleted." }, "active_subscriptions": { "items": { "$ref": "#/components/schemas/CustomerStateSubscription" }, "type": "array", "title": "Active Subscriptions", "description": "The customer's active subscriptions." }, "granted_benefits": { "items": { "$ref": "#/components/schemas/CustomerStateBenefitGrant" }, "type": "array", "title": "Granted Benefits", "description": "The customer's active benefit grants." }, "active_meters": { "items": { "$ref": "#/components/schemas/CustomerStateMeter" }, "type": "array", "title": "Active Meters", "description": "The customer's active meters." }, "avatar_url": { "type": "string", "title": "Avatar Url", "examples": [ "https://www.gravatar.com/avatar/xxx?d=404" ] } }, "type": "object", "required": [ "id", "created_at", "modified_at", "metadata", "email", "email_verified", "name", "billing_address", "tax_id", "organization_id", "deleted_at", "active_subscriptions", "granted_benefits", "active_meters", "avatar_url" ], "title": "CustomerState", "description": "A customer along with additional state information:\n\n* Active subscriptions\n* Granted benefits\n* Active meters" }, "CustomerStateBenefitGrant": { "properties": { "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the grant.", "examples": [ "d322132c-a9d0-4e0d-b8d3-d81ad021a3a9" ] }, "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "granted_at": { "type": "string", "format": "date-time", "title": "Granted At", "description": "The timestamp when the benefit was granted.", "examples": [ "2025-01-03T13:37:00Z" ] }, "benefit_id": { "type": "string", "format": "uuid4", "title": "Benefit Id", "description": "The ID of the benefit concerned by this grant.", "examples": [ "397a17aa-15cf-4cb4-9333-18040203cf98" ] }, "benefit_type": { "$ref": "#/components/schemas/BenefitType", "description": "The type of the benefit concerned by this grant.", "examples": [ "custom" ] }, "benefit_metadata": { "$ref": "#/components/schemas/MetadataOutputType", "description": "The metadata of the benefit concerned by this grant.", "examples": [ { "key": "value" } ] }, "properties": { "anyOf": [ { "$ref": "#/components/schemas/BenefitGrantDiscordProperties" }, { "$ref": "#/components/schemas/BenefitGrantGitHubRepositoryProperties" }, { "$ref": "#/components/schemas/BenefitGrantDownloadablesProperties" }, { "$ref": "#/components/schemas/BenefitGrantLicenseKeysProperties" }, { "$ref": "#/components/schemas/BenefitGrantCustomProperties" }, { "$ref": "#/components/schemas/BenefitGrantFeatureFlagProperties" } ], "title": "Properties" } }, "type": "object", "required": [ "id", "created_at", "modified_at", "granted_at", "benefit_id", "benefit_type", "benefit_metadata", "properties" ], "title": "CustomerStateBenefitGrant", "description": "An active benefit grant for a customer." }, "CustomerStateMeter": { "properties": { "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "meter_id": { "type": "string", "format": "uuid4", "title": "Meter Id", "description": "The ID of the meter.", "examples": [ "d498a884-e2cd-4d3e-8002-f536468a8b22" ] }, "consumed_units": { "type": "number", "title": "Consumed Units", "description": "The number of consumed units.", "examples": [ 25 ] }, "credited_units": { "type": "integer", "title": "Credited Units", "description": "The number of credited units.", "examples": [ 100 ] }, "balance": { "type": "number", "title": "Balance", "description": "The balance of the meter, i.e. the difference between credited and consumed units.", "examples": [ 75 ] } }, "type": "object", "required": [ "id", "created_at", "modified_at", "meter_id", "consumed_units", "credited_units", "balance" ], "title": "CustomerStateMeter", "description": "An active meter for a customer, with latest consumed and credited units." }, "CustomerStateSubscription": { "properties": { "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the subscription.", "examples": [ "e5149aae-e521-42b9-b24c-abb3d71eea2e" ] }, "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "custom_field_data": { "additionalProperties": { "anyOf": [ { "type": "string" }, { "type": "integer" }, { "type": "boolean" }, { "type": "string", "format": "date-time" }, { "type": "null" } ] }, "type": "object", "title": "Custom Field Data", "description": "Key-value object storing custom field values." }, "metadata": { "$ref": "#/components/schemas/MetadataOutputType" }, "status": { "type": "string", "enum": [ "active", "trialing" ], "title": "Status", "examples": [ "active", "trialing" ] }, "amount": { "type": "integer", "title": "Amount", "description": "The amount of the subscription.", "examples": [ 1000 ] }, "currency": { "type": "string", "title": "Currency", "description": "The currency of the subscription.", "examples": [ "usd" ] }, "recurring_interval": { "$ref": "#/components/schemas/SubscriptionRecurringInterval", "description": "The interval at which the subscription recurs." }, "current_period_start": { "type": "string", "format": "date-time", "title": "Current Period Start", "description": "The start timestamp of the current billing period.", "examples": [ "2025-02-03T13:37:00Z" ] }, "current_period_end": { "type": "string", "format": "date-time", "title": "Current Period End", "description": "The end timestamp of the current billing period.", "examples": [ "2025-03-03T13:37:00Z" ] }, "trial_start": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Trial Start", "description": "The start timestamp of the trial period, if any.", "examples": [ "2025-02-03T13:37:00Z" ] }, "trial_end": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Trial End", "description": "The end timestamp of the trial period, if any.", "examples": [ "2025-03-03T13:37:00Z" ] }, "cancel_at_period_end": { "type": "boolean", "title": "Cancel At Period End", "description": "Whether the subscription will be canceled at the end of the current period.", "examples": [ false ] }, "canceled_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Canceled At", "description": "The timestamp when the subscription was canceled. The subscription might still be active if `cancel_at_period_end` is `true`.", "examples": [ null ] }, "started_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Started At", "description": "The timestamp when the subscription started.", "examples": [ "2025-01-03T13:37:00Z" ] }, "ends_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Ends At", "description": "The timestamp when the subscription will end.", "examples": [ null ] }, "product_id": { "type": "string", "format": "uuid4", "title": "Product Id", "description": "The ID of the subscribed product.", "examples": [ "d8dd2de1-21b7-4a41-8bc3-ce909c0cfe23" ] }, "discount_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Discount Id", "description": "The ID of the applied discount, if any.", "examples": [ null ] }, "meters": { "items": { "$ref": "#/components/schemas/CustomerStateSubscriptionMeter" }, "type": "array", "title": "Meters", "description": "List of meters associated with the subscription." } }, "type": "object", "required": [ "id", "created_at", "modified_at", "metadata", "status", "amount", "currency", "recurring_interval", "current_period_start", "current_period_end", "trial_start", "trial_end", "cancel_at_period_end", "canceled_at", "started_at", "ends_at", "product_id", "discount_id", "meters" ], "title": "CustomerStateSubscription", "description": "An active customer subscription." }, "CustomerStateSubscriptionMeter": { "properties": { "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "consumed_units": { "type": "number", "title": "Consumed Units", "description": "The number of consumed units so far in this billing period.", "examples": [ 25 ] }, "credited_units": { "type": "integer", "title": "Credited Units", "description": "The number of credited units so far in this billing period.", "examples": [ 100 ] }, "amount": { "type": "integer", "title": "Amount", "description": "The amount due in cents so far in this billing period.", "examples": [ 0 ] }, "meter_id": { "type": "string", "format": "uuid4", "title": "Meter Id", "description": "The ID of the meter.", "examples": [ "d498a884-e2cd-4d3e-8002-f536468a8b22" ] } }, "type": "object", "required": [ "created_at", "modified_at", "id", "consumed_units", "credited_units", "amount", "meter_id" ], "title": "CustomerStateSubscriptionMeter", "description": "Current consumption and spending for a subscription meter." }, "CustomerSubscription": { "properties": { "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "amount": { "type": "integer", "title": "Amount", "description": "The amount of the subscription.", "examples": [ 10000 ] }, "currency": { "type": "string", "title": "Currency", "description": "The currency of the subscription.", "examples": [ "usd" ] }, "recurring_interval": { "$ref": "#/components/schemas/SubscriptionRecurringInterval", "description": "The interval at which the subscription recurs.", "examples": [ "month" ] }, "recurring_interval_count": { "type": "integer", "title": "Recurring Interval Count", "description": "Number of interval units of the subscription. If this is set to 1 the charge will happen every interval (e.g. every month), if set to 2 it will be every other month, and so on." }, "status": { "$ref": "#/components/schemas/SubscriptionStatus", "description": "The status of the subscription.", "examples": [ "active" ] }, "current_period_start": { "type": "string", "format": "date-time", "title": "Current Period Start", "description": "The start timestamp of the current billing period." }, "current_period_end": { "type": "string", "format": "date-time", "title": "Current Period End", "description": "The end timestamp of the current billing period." }, "trial_start": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Trial Start", "description": "The start timestamp of the trial period, if any." }, "trial_end": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Trial End", "description": "The end timestamp of the trial period, if any." }, "cancel_at_period_end": { "type": "boolean", "title": "Cancel At Period End", "description": "Whether the subscription will be canceled at the end of the current period." }, "canceled_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Canceled At", "description": "The timestamp when the subscription was canceled. The subscription might still be active if `cancel_at_period_end` is `true`." }, "started_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Started At", "description": "The timestamp when the subscription started." }, "ends_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Ends At", "description": "The timestamp when the subscription will end." }, "ended_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Ended At", "description": "The timestamp when the subscription ended." }, "customer_id": { "type": "string", "format": "uuid4", "title": "Customer Id", "description": "The ID of the subscribed customer." }, "product_id": { "type": "string", "format": "uuid4", "title": "Product Id", "description": "The ID of the subscribed product." }, "discount_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Discount Id", "description": "The ID of the applied discount, if any." }, "checkout_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Checkout Id" }, "seats": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Seats", "description": "The number of seats for seat-based subscriptions. None for non-seat subscriptions." }, "customer_cancellation_reason": { "anyOf": [ { "$ref": "#/components/schemas/CustomerCancellationReason" }, { "type": "null" } ] }, "customer_cancellation_comment": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Customer Cancellation Comment" }, "product": { "$ref": "#/components/schemas/CustomerSubscriptionProduct" }, "prices": { "items": { "oneOf": [ { "$ref": "#/components/schemas/LegacyRecurringProductPrice" }, { "$ref": "#/components/schemas/ProductPrice" } ] }, "type": "array", "title": "Prices", "description": "List of enabled prices for the subscription." }, "meters": { "items": { "$ref": "#/components/schemas/CustomerSubscriptionMeter" }, "type": "array", "title": "Meters", "description": "List of meters associated with the subscription." } }, "type": "object", "required": [ "created_at", "modified_at", "id", "amount", "currency", "recurring_interval", "recurring_interval_count", "status", "current_period_start", "current_period_end", "trial_start", "trial_end", "cancel_at_period_end", "canceled_at", "started_at", "ends_at", "ended_at", "customer_id", "product_id", "discount_id", "checkout_id", "customer_cancellation_reason", "customer_cancellation_comment", "product", "prices", "meters" ], "title": "CustomerSubscription" }, "CustomerSubscriptionCancel": { "properties": { "cancel_at_period_end": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "title": "Cancel At Period End", "description": "Cancel an active subscription once the current period ends.\n\nOr uncancel a subscription currently set to be revoked at period end." }, "cancellation_reason": { "anyOf": [ { "$ref": "#/components/schemas/CustomerCancellationReason" }, { "type": "null" } ], "description": "Customers reason for cancellation.\n\n* `too_expensive`: Too expensive for the customer.\n* `missing_features`: Customer is missing certain features.\n* `switched_service`: Customer switched to another service.\n* `unused`: Customer is not using it enough.\n* `customer_service`: Customer is not satisfied with the customer service.\n* `low_quality`: Customer is unhappy with the quality.\n* `too_complex`: Customer considers the service too complicated.\n* `other`: Other reason(s)." }, "cancellation_comment": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Cancellation Comment", "description": "Customer feedback and why they decided to cancel." } }, "type": "object", "title": "CustomerSubscriptionCancel" }, "CustomerSubscriptionMeter": { "properties": { "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "consumed_units": { "type": "number", "title": "Consumed Units", "description": "The number of consumed units so far in this billing period.", "examples": [ 25 ] }, "credited_units": { "type": "integer", "title": "Credited Units", "description": "The number of credited units so far in this billing period.", "examples": [ 100 ] }, "amount": { "type": "integer", "title": "Amount", "description": "The amount due in cents so far in this billing period.", "examples": [ 0 ] }, "meter_id": { "type": "string", "format": "uuid4", "title": "Meter Id", "description": "The ID of the meter.", "examples": [ "d498a884-e2cd-4d3e-8002-f536468a8b22" ] }, "meter": { "$ref": "#/components/schemas/CustomerSubscriptionMeterMeter" } }, "type": "object", "required": [ "created_at", "modified_at", "id", "consumed_units", "credited_units", "amount", "meter_id", "meter" ], "title": "CustomerSubscriptionMeter" }, "CustomerSubscriptionMeterMeter": { "properties": { "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "name": { "type": "string", "title": "Name", "description": "The name of the meter. Will be shown on customer's invoices and usage." } }, "type": "object", "required": [ "created_at", "modified_at", "id", "name" ], "title": "CustomerSubscriptionMeterMeter" }, "CustomerSubscriptionProduct": { "properties": { "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "trial_interval": { "anyOf": [ { "$ref": "#/components/schemas/TrialInterval" }, { "type": "null" } ], "description": "The interval unit for the trial period." }, "trial_interval_count": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Trial Interval Count", "description": "The number of interval units for the trial period." }, "name": { "type": "string", "title": "Name", "description": "The name of the product." }, "description": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Description", "description": "The description of the product." }, "visibility": { "$ref": "#/components/schemas/ProductVisibility", "description": "The visibility of the product." }, "recurring_interval": { "anyOf": [ { "$ref": "#/components/schemas/SubscriptionRecurringInterval" }, { "type": "null" } ], "description": "The recurring interval of the product. If `None`, the product is a one-time purchase." }, "recurring_interval_count": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Recurring Interval Count", "description": "Number of interval units of the subscription. If this is set to 1 the charge will happen every interval (e.g. every month), if set to 2 it will be every other month, and so on. None for one-time products." }, "is_recurring": { "type": "boolean", "title": "Is Recurring", "description": "Whether the product is a subscription." }, "is_archived": { "type": "boolean", "title": "Is Archived", "description": "Whether the product is archived and no longer available." }, "organization_id": { "type": "string", "format": "uuid4", "title": "Organization Id", "description": "The ID of the organization owning the product." }, "prices": { "items": { "oneOf": [ { "$ref": "#/components/schemas/LegacyRecurringProductPrice" }, { "$ref": "#/components/schemas/ProductPrice" } ] }, "type": "array", "title": "Prices", "description": "List of prices for this product." }, "benefits": { "items": { "$ref": "#/components/schemas/BenefitPublic" }, "type": "array", "title": "BenefitPublic", "description": "List of benefits granted by the product." }, "medias": { "items": { "$ref": "#/components/schemas/ProductMediaFileRead" }, "type": "array", "title": "Medias", "description": "List of medias associated to the product." }, "organization": { "$ref": "#/components/schemas/CustomerOrganization" } }, "type": "object", "required": [ "id", "created_at", "modified_at", "trial_interval", "trial_interval_count", "name", "description", "visibility", "recurring_interval", "recurring_interval_count", "is_recurring", "is_archived", "organization_id", "prices", "benefits", "medias", "organization" ], "title": "CustomerSubscriptionProduct" }, "CustomerSubscriptionSortProperty": { "type": "string", "enum": [ "started_at", "-started_at", "amount", "-amount", "status", "-status", "organization", "-organization", "product", "-product" ], "title": "CustomerSubscriptionSortProperty" }, "CustomerSubscriptionUpdate": { "anyOf": [ { "$ref": "#/components/schemas/CustomerSubscriptionUpdateProduct" }, { "$ref": "#/components/schemas/CustomerSubscriptionUpdateSeats" }, { "$ref": "#/components/schemas/CustomerSubscriptionCancel" } ] }, "CustomerSubscriptionUpdateProduct": { "properties": { "product_id": { "type": "string", "format": "uuid4", "title": "Product Id", "description": "Update subscription to another product." } }, "type": "object", "required": [ "product_id" ], "title": "CustomerSubscriptionUpdateProduct" }, "CustomerSubscriptionUpdateSeats": { "properties": { "seats": { "type": "integer", "minimum": 1, "title": "Seats", "description": "Update the number of seats for this subscription." }, "proration_behavior": { "anyOf": [ { "$ref": "#/components/schemas/SubscriptionProrationBehavior" }, { "type": "null" } ], "description": "Determine how to handle the proration billing. If not provided, will use the default organization setting." } }, "type": "object", "required": [ "seats" ], "title": "CustomerSubscriptionUpdateSeats" }, "CustomerType": { "type": "string", "enum": [ "individual", "team" ], "title": "CustomerType" }, "CustomerUpdate": { "properties": { "metadata": { "additionalProperties": { "anyOf": [ { "type": "string", "maxLength": 500, "minLength": 1 }, { "type": "integer" }, { "type": "number" }, { "type": "boolean" } ] }, "propertyNames": { "maxLength": 40, "minLength": 1 }, "type": "object", "maxProperties": 50, "title": "Metadata", "description": "Key-value object allowing you to store additional information.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**." }, "email": { "anyOf": [ { "type": "string", "format": "email" }, { "type": "null" } ], "title": "Email", "description": "The email address of the customer. This must be unique within the organization.", "examples": [ "customer@example.com" ] }, "name": { "anyOf": [ { "type": "string", "maxLength": 256, "description": "The name of the customer.", "examples": [ "John Doe" ] }, { "type": "null" } ], "title": "Name" }, "billing_address": { "anyOf": [ { "$ref": "#/components/schemas/AddressInput" }, { "type": "null" } ] }, "tax_id": { "anyOf": [ { "prefixItems": [ { "type": "string" }, { "$ref": "#/components/schemas/TaxIDFormat" } ], "type": "array", "maxItems": 2, "minItems": 2, "examples": [ [ "911144442", "us_ein" ], [ "FR61954506077", "eu_vat" ] ] }, { "type": "null" } ], "title": "Tax Id" }, "locale": { "anyOf": [ { "type": "string", "pattern": "^[a-zA-Z]{2,3}(-[a-zA-Z]{2}|-[0-9]{3})?$", "description": "Locale of the customer, given as an IETF BCP 47 language tag. Supported: language code (e.g. `en`) or language + region (e.g. `en-US`). If `null` or unsupported, the locale will default to `en-US`.", "examples": [ "en", "en-US", "fr", "fr-CA" ] }, { "type": "null" } ], "title": "Locale" }, "external_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "External Id", "description": "The ID of the customer in your system. This must be unique within the organization. Once set, it can't be updated.", "examples": [ "usr_1337" ] }, "type": { "anyOf": [ { "$ref": "#/components/schemas/CustomerType" }, { "type": "null" } ], "description": "The customer type. Can only be upgraded from 'individual' to 'team', never downgraded.", "examples": [ "team" ] } }, "type": "object", "title": "CustomerUpdate" }, "CustomerUpdateExternalID": { "properties": { "metadata": { "additionalProperties": { "anyOf": [ { "type": "string", "maxLength": 500, "minLength": 1 }, { "type": "integer" }, { "type": "number" }, { "type": "boolean" } ] }, "propertyNames": { "maxLength": 40, "minLength": 1 }, "type": "object", "maxProperties": 50, "title": "Metadata", "description": "Key-value object allowing you to store additional information.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**." }, "email": { "anyOf": [ { "type": "string", "format": "email" }, { "type": "null" } ], "title": "Email", "description": "The email address of the customer. This must be unique within the organization.", "examples": [ "customer@example.com" ] }, "name": { "anyOf": [ { "type": "string", "maxLength": 256, "description": "The name of the customer.", "examples": [ "John Doe" ] }, { "type": "null" } ], "title": "Name" }, "billing_address": { "anyOf": [ { "$ref": "#/components/schemas/AddressInput" }, { "type": "null" } ] }, "tax_id": { "anyOf": [ { "prefixItems": [ { "type": "string" }, { "$ref": "#/components/schemas/TaxIDFormat" } ], "type": "array", "maxItems": 2, "minItems": 2, "examples": [ [ "911144442", "us_ein" ], [ "FR61954506077", "eu_vat" ] ] }, { "type": "null" } ], "title": "Tax Id" }, "locale": { "anyOf": [ { "type": "string", "pattern": "^[a-zA-Z]{2,3}(-[a-zA-Z]{2}|-[0-9]{3})?$", "description": "Locale of the customer, given as an IETF BCP 47 language tag. Supported: language code (e.g. `en`) or language + region (e.g. `en-US`). If `null` or unsupported, the locale will default to `en-US`.", "examples": [ "en", "en-US", "fr", "fr-CA" ] }, { "type": "null" } ], "title": "Locale" } }, "type": "object", "title": "CustomerUpdateExternalID" }, "CustomerUpdatedEvent": { "properties": { "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "timestamp": { "type": "string", "format": "date-time", "title": "Timestamp", "description": "The timestamp of the event." }, "organization_id": { "type": "string", "format": "uuid4", "title": "Organization Id", "description": "The ID of the organization owning the event.", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "x-polar-selector-widget": { "displayProperty": "name", "resourceName": "Organization", "resourceRoot": "/v1/organizations" } }, "customer_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Customer Id", "description": "ID of the customer in your Polar organization associated with the event." }, "customer": { "anyOf": [ { "$ref": "#/components/schemas/Customer" }, { "type": "null" } ], "description": "The customer associated with the event." }, "external_customer_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "External Customer Id", "description": "ID of the customer in your system associated with the event." }, "member_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Member Id", "description": "ID of the member within the customer's organization who performed the action inside B2B." }, "external_member_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "External Member Id", "description": "ID of the member in your system within the customer's organization who performed the action inside B2B." }, "child_count": { "type": "integer", "title": "Child Count", "description": "Number of direct child events linked to this event.", "default": 0 }, "parent_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Parent Id", "description": "The ID of the parent event." }, "label": { "type": "string", "title": "Label", "description": "Human readable label of the event type." }, "source": { "type": "string", "const": "system", "title": "Source", "description": "The source of the event. `system` events are created by Polar. `user` events are the one you create through our ingestion API." }, "name": { "type": "string", "const": "customer.updated", "title": "Name", "description": "The name of the event." }, "metadata": { "$ref": "#/components/schemas/CustomerUpdatedMetadata" } }, "type": "object", "required": [ "id", "timestamp", "organization_id", "customer_id", "customer", "external_customer_id", "label", "source", "name", "metadata" ], "title": "CustomerUpdatedEvent", "description": "An event created by Polar when a customer is updated." }, "CustomerUpdatedFields": { "properties": { "name": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Name" }, "email": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Email" }, "billing_address": { "anyOf": [ { "$ref": "#/components/schemas/AddressDict" }, { "type": "null" } ] }, "tax_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Tax Id" }, "metadata": { "anyOf": [ { "additionalProperties": { "anyOf": [ { "type": "string" }, { "type": "integer" }, { "type": "boolean" } ] }, "type": "object" }, { "type": "null" } ], "title": "Metadata" } }, "type": "object", "title": "CustomerUpdatedFields" }, "CustomerUpdatedMetadata": { "properties": { "customer_id": { "type": "string", "title": "Customer Id" }, "customer_email": { "type": "string", "title": "Customer Email" }, "customer_name": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Customer Name" }, "customer_external_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Customer External Id" }, "updated_fields": { "$ref": "#/components/schemas/CustomerUpdatedFields" } }, "type": "object", "required": [ "customer_id", "customer_email", "customer_name", "customer_external_id", "updated_fields" ], "title": "CustomerUpdatedMetadata" }, "CustomerWallet": { "properties": { "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "customer_id": { "type": "string", "format": "uuid4", "title": "Customer Id", "description": "The ID of the customer that owns the wallet.", "examples": [ "992fae2a-2a17-4b7a-8d9e-e287cf90131b" ] }, "balance": { "type": "integer", "title": "Balance", "description": "The current balance of the wallet, in cents.", "examples": [ 5000 ] }, "currency": { "type": "string", "title": "Currency", "description": "The currency of the wallet.", "examples": [ "usd" ] } }, "type": "object", "required": [ "id", "created_at", "modified_at", "customer_id", "balance", "currency" ], "title": "CustomerWallet", "description": "A wallet represents your balance with an organization.\n\nYou can top-up your wallet and use the balance to pay for usage." }, "CustomerWalletSortProperty": { "type": "string", "enum": [ "created_at", "-created_at", "balance", "-balance" ], "title": "CustomerWalletSortProperty" }, "Discount": { "oneOf": [ { "$ref": "#/components/schemas/DiscountFixedOnceForeverDuration" }, { "$ref": "#/components/schemas/DiscountFixedRepeatDuration" }, { "$ref": "#/components/schemas/DiscountPercentageOnceForeverDuration" }, { "$ref": "#/components/schemas/DiscountPercentageRepeatDuration" } ] }, "DiscountCreate": { "oneOf": [ { "$ref": "#/components/schemas/DiscountFixedOnceForeverDurationCreate" }, { "$ref": "#/components/schemas/DiscountFixedRepeatDurationCreate" }, { "$ref": "#/components/schemas/DiscountPercentageOnceForeverDurationCreate" }, { "$ref": "#/components/schemas/DiscountPercentageRepeatDurationCreate" } ] }, "DiscountDuration": { "type": "string", "enum": [ "once", "forever", "repeating" ], "title": "DiscountDuration" }, "DiscountFixedOnceForeverDuration": { "properties": { "duration": { "$ref": "#/components/schemas/DiscountDuration" }, "type": { "$ref": "#/components/schemas/DiscountType" }, "amount": { "type": "integer", "title": "Amount", "examples": [ 1000 ] }, "currency": { "type": "string", "title": "Currency", "examples": [ "usd" ] }, "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "metadata": { "$ref": "#/components/schemas/MetadataOutputType" }, "name": { "type": "string", "title": "Name", "description": "Name of the discount. Will be displayed to the customer when the discount is applied." }, "code": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Code", "description": "Code customers can use to apply the discount during checkout." }, "starts_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Starts At", "description": "Timestamp after which the discount is redeemable." }, "ends_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Ends At", "description": "Timestamp after which the discount is no longer redeemable." }, "max_redemptions": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Max Redemptions", "description": "Maximum number of times the discount can be redeemed." }, "redemptions_count": { "type": "integer", "title": "Redemptions Count", "description": "Number of times the discount has been redeemed." }, "organization_id": { "type": "string", "format": "uuid4", "title": "Organization Id", "description": "The organization ID.", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "x-polar-selector-widget": { "displayProperty": "name", "resourceName": "Organization", "resourceRoot": "/v1/organizations" } }, "products": { "items": { "$ref": "#/components/schemas/DiscountProduct" }, "type": "array", "title": "Products" } }, "type": "object", "required": [ "duration", "type", "amount", "currency", "created_at", "modified_at", "id", "metadata", "name", "code", "starts_at", "ends_at", "max_redemptions", "redemptions_count", "organization_id", "products" ], "title": "DiscountFixedOnceForeverDuration", "description": "Schema for a fixed amount discount that is applied once or forever." }, "DiscountFixedOnceForeverDurationBase": { "properties": { "duration": { "$ref": "#/components/schemas/DiscountDuration" }, "type": { "$ref": "#/components/schemas/DiscountType" }, "amount": { "type": "integer", "title": "Amount", "examples": [ 1000 ] }, "currency": { "type": "string", "title": "Currency", "examples": [ "usd" ] }, "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "metadata": { "$ref": "#/components/schemas/MetadataOutputType" }, "name": { "type": "string", "title": "Name", "description": "Name of the discount. Will be displayed to the customer when the discount is applied." }, "code": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Code", "description": "Code customers can use to apply the discount during checkout." }, "starts_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Starts At", "description": "Timestamp after which the discount is redeemable." }, "ends_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Ends At", "description": "Timestamp after which the discount is no longer redeemable." }, "max_redemptions": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Max Redemptions", "description": "Maximum number of times the discount can be redeemed." }, "redemptions_count": { "type": "integer", "title": "Redemptions Count", "description": "Number of times the discount has been redeemed." }, "organization_id": { "type": "string", "format": "uuid4", "title": "Organization Id", "description": "The organization ID.", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "x-polar-selector-widget": { "displayProperty": "name", "resourceName": "Organization", "resourceRoot": "/v1/organizations" } } }, "type": "object", "required": [ "duration", "type", "amount", "currency", "created_at", "modified_at", "id", "metadata", "name", "code", "starts_at", "ends_at", "max_redemptions", "redemptions_count", "organization_id" ], "title": "DiscountFixedOnceForeverDurationBase" }, "DiscountFixedOnceForeverDurationCreate": { "properties": { "duration": { "$ref": "#/components/schemas/DiscountDuration" }, "type": { "$ref": "#/components/schemas/DiscountType", "description": "Type of the discount." }, "amount": { "type": "integer", "maximum": 999999999999, "minimum": 0, "title": "Amount", "description": "Fixed amount to discount from the invoice total." }, "currency": { "$ref": "#/components/schemas/PresentmentCurrency", "description": "The currency of the fixed amount discount.", "default": "usd" }, "metadata": { "additionalProperties": { "anyOf": [ { "type": "string", "maxLength": 500, "minLength": 1 }, { "type": "integer" }, { "type": "number" }, { "type": "boolean" } ] }, "propertyNames": { "maxLength": 40, "minLength": 1 }, "type": "object", "maxProperties": 50, "title": "Metadata", "description": "Key-value object allowing you to store additional information.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**." }, "name": { "type": "string", "minLength": 1, "title": "Name", "description": "Name of the discount. Will be displayed to the customer when the discount is applied." }, "code": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Code", "description": "Code customers can use to apply the discount during checkout. Must be between 3 and 256 characters long and contain only alphanumeric characters.If not provided, the discount can only be applied via the API." }, "starts_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Starts At", "description": "Optional timestamp after which the discount is redeemable." }, "ends_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Ends At", "description": "Optional timestamp after which the discount is no longer redeemable." }, "max_redemptions": { "anyOf": [ { "type": "integer", "minimum": 1 }, { "type": "null" } ], "title": "Max Redemptions", "description": "Optional maximum number of times the discount can be redeemed." }, "products": { "anyOf": [ { "items": { "type": "string", "format": "uuid4" }, "type": "array", "description": "List of product IDs the discount can be applied to." }, { "type": "null" } ], "title": "Products" }, "organization_id": { "anyOf": [ { "type": "string", "format": "uuid4", "description": "The organization ID.", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "x-polar-selector-widget": { "displayProperty": "name", "resourceName": "Organization", "resourceRoot": "/v1/organizations" } }, { "type": "null" } ], "title": "Organization Id", "description": "The ID of the organization owning the discount. **Required unless you use an organization token.**" } }, "type": "object", "required": [ "duration", "type", "amount", "name" ], "title": "DiscountFixedOnceForeverDurationCreate", "description": "Schema to create a fixed amount discount that is applied once or forever." }, "DiscountFixedRepeatDuration": { "properties": { "duration": { "$ref": "#/components/schemas/DiscountDuration" }, "duration_in_months": { "type": "integer", "title": "Duration In Months" }, "type": { "$ref": "#/components/schemas/DiscountType" }, "amount": { "type": "integer", "title": "Amount", "examples": [ 1000 ] }, "currency": { "type": "string", "title": "Currency", "examples": [ "usd" ] }, "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "metadata": { "$ref": "#/components/schemas/MetadataOutputType" }, "name": { "type": "string", "title": "Name", "description": "Name of the discount. Will be displayed to the customer when the discount is applied." }, "code": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Code", "description": "Code customers can use to apply the discount during checkout." }, "starts_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Starts At", "description": "Timestamp after which the discount is redeemable." }, "ends_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Ends At", "description": "Timestamp after which the discount is no longer redeemable." }, "max_redemptions": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Max Redemptions", "description": "Maximum number of times the discount can be redeemed." }, "redemptions_count": { "type": "integer", "title": "Redemptions Count", "description": "Number of times the discount has been redeemed." }, "organization_id": { "type": "string", "format": "uuid4", "title": "Organization Id", "description": "The organization ID.", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "x-polar-selector-widget": { "displayProperty": "name", "resourceName": "Organization", "resourceRoot": "/v1/organizations" } }, "products": { "items": { "$ref": "#/components/schemas/DiscountProduct" }, "type": "array", "title": "Products" } }, "type": "object", "required": [ "duration", "duration_in_months", "type", "amount", "currency", "created_at", "modified_at", "id", "metadata", "name", "code", "starts_at", "ends_at", "max_redemptions", "redemptions_count", "organization_id", "products" ], "title": "DiscountFixedRepeatDuration", "description": "Schema for a fixed amount discount that is applied on every invoice\nfor a certain number of months." }, "DiscountFixedRepeatDurationBase": { "properties": { "duration": { "$ref": "#/components/schemas/DiscountDuration" }, "duration_in_months": { "type": "integer", "title": "Duration In Months" }, "type": { "$ref": "#/components/schemas/DiscountType" }, "amount": { "type": "integer", "title": "Amount", "examples": [ 1000 ] }, "currency": { "type": "string", "title": "Currency", "examples": [ "usd" ] }, "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "metadata": { "$ref": "#/components/schemas/MetadataOutputType" }, "name": { "type": "string", "title": "Name", "description": "Name of the discount. Will be displayed to the customer when the discount is applied." }, "code": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Code", "description": "Code customers can use to apply the discount during checkout." }, "starts_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Starts At", "description": "Timestamp after which the discount is redeemable." }, "ends_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Ends At", "description": "Timestamp after which the discount is no longer redeemable." }, "max_redemptions": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Max Redemptions", "description": "Maximum number of times the discount can be redeemed." }, "redemptions_count": { "type": "integer", "title": "Redemptions Count", "description": "Number of times the discount has been redeemed." }, "organization_id": { "type": "string", "format": "uuid4", "title": "Organization Id", "description": "The organization ID.", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "x-polar-selector-widget": { "displayProperty": "name", "resourceName": "Organization", "resourceRoot": "/v1/organizations" } } }, "type": "object", "required": [ "duration", "duration_in_months", "type", "amount", "currency", "created_at", "modified_at", "id", "metadata", "name", "code", "starts_at", "ends_at", "max_redemptions", "redemptions_count", "organization_id" ], "title": "DiscountFixedRepeatDurationBase" }, "DiscountFixedRepeatDurationCreate": { "properties": { "duration": { "$ref": "#/components/schemas/DiscountDuration" }, "duration_in_months": { "type": "integer", "maximum": 999, "minimum": 1, "title": "Duration In Months", "description": "Number of months the discount should be applied.\n\nFor this to work on yearly pricing, you should multiply this by 12.\nFor example, to apply the discount for 2 years, set this to 24." }, "type": { "$ref": "#/components/schemas/DiscountType", "description": "Type of the discount." }, "amount": { "type": "integer", "maximum": 999999999999, "minimum": 0, "title": "Amount", "description": "Fixed amount to discount from the invoice total." }, "currency": { "$ref": "#/components/schemas/PresentmentCurrency", "description": "The currency of the fixed amount discount.", "default": "usd" }, "metadata": { "additionalProperties": { "anyOf": [ { "type": "string", "maxLength": 500, "minLength": 1 }, { "type": "integer" }, { "type": "number" }, { "type": "boolean" } ] }, "propertyNames": { "maxLength": 40, "minLength": 1 }, "type": "object", "maxProperties": 50, "title": "Metadata", "description": "Key-value object allowing you to store additional information.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**." }, "name": { "type": "string", "minLength": 1, "title": "Name", "description": "Name of the discount. Will be displayed to the customer when the discount is applied." }, "code": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Code", "description": "Code customers can use to apply the discount during checkout. Must be between 3 and 256 characters long and contain only alphanumeric characters.If not provided, the discount can only be applied via the API." }, "starts_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Starts At", "description": "Optional timestamp after which the discount is redeemable." }, "ends_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Ends At", "description": "Optional timestamp after which the discount is no longer redeemable." }, "max_redemptions": { "anyOf": [ { "type": "integer", "minimum": 1 }, { "type": "null" } ], "title": "Max Redemptions", "description": "Optional maximum number of times the discount can be redeemed." }, "products": { "anyOf": [ { "items": { "type": "string", "format": "uuid4" }, "type": "array", "description": "List of product IDs the discount can be applied to." }, { "type": "null" } ], "title": "Products" }, "organization_id": { "anyOf": [ { "type": "string", "format": "uuid4", "description": "The organization ID.", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "x-polar-selector-widget": { "displayProperty": "name", "resourceName": "Organization", "resourceRoot": "/v1/organizations" } }, { "type": "null" } ], "title": "Organization Id", "description": "The ID of the organization owning the discount. **Required unless you use an organization token.**" } }, "type": "object", "required": [ "duration", "duration_in_months", "type", "amount", "name" ], "title": "DiscountFixedRepeatDurationCreate", "description": "Schema to create a fixed amount discount that is applied on every invoice\nfor a certain number of months." }, "DiscountPercentageOnceForeverDuration": { "properties": { "duration": { "$ref": "#/components/schemas/DiscountDuration" }, "type": { "$ref": "#/components/schemas/DiscountType" }, "basis_points": { "type": "integer", "title": "Basis Points", "description": "Discount percentage in basis points. A basis point is 1/100th of a percent. For example, 1000 basis points equals a 10% discount.", "examples": [ 1000 ] }, "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "metadata": { "$ref": "#/components/schemas/MetadataOutputType" }, "name": { "type": "string", "title": "Name", "description": "Name of the discount. Will be displayed to the customer when the discount is applied." }, "code": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Code", "description": "Code customers can use to apply the discount during checkout." }, "starts_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Starts At", "description": "Timestamp after which the discount is redeemable." }, "ends_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Ends At", "description": "Timestamp after which the discount is no longer redeemable." }, "max_redemptions": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Max Redemptions", "description": "Maximum number of times the discount can be redeemed." }, "redemptions_count": { "type": "integer", "title": "Redemptions Count", "description": "Number of times the discount has been redeemed." }, "organization_id": { "type": "string", "format": "uuid4", "title": "Organization Id", "description": "The organization ID.", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "x-polar-selector-widget": { "displayProperty": "name", "resourceName": "Organization", "resourceRoot": "/v1/organizations" } }, "products": { "items": { "$ref": "#/components/schemas/DiscountProduct" }, "type": "array", "title": "Products" } }, "type": "object", "required": [ "duration", "type", "basis_points", "created_at", "modified_at", "id", "metadata", "name", "code", "starts_at", "ends_at", "max_redemptions", "redemptions_count", "organization_id", "products" ], "title": "DiscountPercentageOnceForeverDuration", "description": "Schema for a percentage discount that is applied once or forever." }, "DiscountPercentageOnceForeverDurationBase": { "properties": { "duration": { "$ref": "#/components/schemas/DiscountDuration" }, "type": { "$ref": "#/components/schemas/DiscountType" }, "basis_points": { "type": "integer", "title": "Basis Points", "description": "Discount percentage in basis points. A basis point is 1/100th of a percent. For example, 1000 basis points equals a 10% discount.", "examples": [ 1000 ] }, "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "metadata": { "$ref": "#/components/schemas/MetadataOutputType" }, "name": { "type": "string", "title": "Name", "description": "Name of the discount. Will be displayed to the customer when the discount is applied." }, "code": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Code", "description": "Code customers can use to apply the discount during checkout." }, "starts_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Starts At", "description": "Timestamp after which the discount is redeemable." }, "ends_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Ends At", "description": "Timestamp after which the discount is no longer redeemable." }, "max_redemptions": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Max Redemptions", "description": "Maximum number of times the discount can be redeemed." }, "redemptions_count": { "type": "integer", "title": "Redemptions Count", "description": "Number of times the discount has been redeemed." }, "organization_id": { "type": "string", "format": "uuid4", "title": "Organization Id", "description": "The organization ID.", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "x-polar-selector-widget": { "displayProperty": "name", "resourceName": "Organization", "resourceRoot": "/v1/organizations" } } }, "type": "object", "required": [ "duration", "type", "basis_points", "created_at", "modified_at", "id", "metadata", "name", "code", "starts_at", "ends_at", "max_redemptions", "redemptions_count", "organization_id" ], "title": "DiscountPercentageOnceForeverDurationBase" }, "DiscountPercentageOnceForeverDurationCreate": { "properties": { "duration": { "$ref": "#/components/schemas/DiscountDuration" }, "type": { "$ref": "#/components/schemas/DiscountType", "description": "Type of the discount." }, "basis_points": { "type": "integer", "maximum": 10000, "minimum": 1, "title": "Basis Points", "description": "Discount percentage in basis points.\n\nA basis point is 1/100th of a percent.\nFor example, to create a 25.5% discount, set this to 2550." }, "metadata": { "additionalProperties": { "anyOf": [ { "type": "string", "maxLength": 500, "minLength": 1 }, { "type": "integer" }, { "type": "number" }, { "type": "boolean" } ] }, "propertyNames": { "maxLength": 40, "minLength": 1 }, "type": "object", "maxProperties": 50, "title": "Metadata", "description": "Key-value object allowing you to store additional information.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**." }, "name": { "type": "string", "minLength": 1, "title": "Name", "description": "Name of the discount. Will be displayed to the customer when the discount is applied." }, "code": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Code", "description": "Code customers can use to apply the discount during checkout. Must be between 3 and 256 characters long and contain only alphanumeric characters.If not provided, the discount can only be applied via the API." }, "starts_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Starts At", "description": "Optional timestamp after which the discount is redeemable." }, "ends_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Ends At", "description": "Optional timestamp after which the discount is no longer redeemable." }, "max_redemptions": { "anyOf": [ { "type": "integer", "minimum": 1 }, { "type": "null" } ], "title": "Max Redemptions", "description": "Optional maximum number of times the discount can be redeemed." }, "products": { "anyOf": [ { "items": { "type": "string", "format": "uuid4" }, "type": "array", "description": "List of product IDs the discount can be applied to." }, { "type": "null" } ], "title": "Products" }, "organization_id": { "anyOf": [ { "type": "string", "format": "uuid4", "description": "The organization ID.", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "x-polar-selector-widget": { "displayProperty": "name", "resourceName": "Organization", "resourceRoot": "/v1/organizations" } }, { "type": "null" } ], "title": "Organization Id", "description": "The ID of the organization owning the discount. **Required unless you use an organization token.**" } }, "type": "object", "required": [ "duration", "type", "basis_points", "name" ], "title": "DiscountPercentageOnceForeverDurationCreate", "description": "Schema to create a percentage discount that is applied once or forever." }, "DiscountPercentageRepeatDuration": { "properties": { "duration": { "$ref": "#/components/schemas/DiscountDuration" }, "duration_in_months": { "type": "integer", "title": "Duration In Months" }, "type": { "$ref": "#/components/schemas/DiscountType" }, "basis_points": { "type": "integer", "title": "Basis Points", "description": "Discount percentage in basis points. A basis point is 1/100th of a percent. For example, 1000 basis points equals a 10% discount.", "examples": [ 1000 ] }, "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "metadata": { "$ref": "#/components/schemas/MetadataOutputType" }, "name": { "type": "string", "title": "Name", "description": "Name of the discount. Will be displayed to the customer when the discount is applied." }, "code": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Code", "description": "Code customers can use to apply the discount during checkout." }, "starts_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Starts At", "description": "Timestamp after which the discount is redeemable." }, "ends_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Ends At", "description": "Timestamp after which the discount is no longer redeemable." }, "max_redemptions": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Max Redemptions", "description": "Maximum number of times the discount can be redeemed." }, "redemptions_count": { "type": "integer", "title": "Redemptions Count", "description": "Number of times the discount has been redeemed." }, "organization_id": { "type": "string", "format": "uuid4", "title": "Organization Id", "description": "The organization ID.", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "x-polar-selector-widget": { "displayProperty": "name", "resourceName": "Organization", "resourceRoot": "/v1/organizations" } }, "products": { "items": { "$ref": "#/components/schemas/DiscountProduct" }, "type": "array", "title": "Products" } }, "type": "object", "required": [ "duration", "duration_in_months", "type", "basis_points", "created_at", "modified_at", "id", "metadata", "name", "code", "starts_at", "ends_at", "max_redemptions", "redemptions_count", "organization_id", "products" ], "title": "DiscountPercentageRepeatDuration", "description": "Schema for a percentage discount that is applied on every invoice\nfor a certain number of months." }, "DiscountPercentageRepeatDurationBase": { "properties": { "duration": { "$ref": "#/components/schemas/DiscountDuration" }, "duration_in_months": { "type": "integer", "title": "Duration In Months" }, "type": { "$ref": "#/components/schemas/DiscountType" }, "basis_points": { "type": "integer", "title": "Basis Points", "description": "Discount percentage in basis points. A basis point is 1/100th of a percent. For example, 1000 basis points equals a 10% discount.", "examples": [ 1000 ] }, "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "metadata": { "$ref": "#/components/schemas/MetadataOutputType" }, "name": { "type": "string", "title": "Name", "description": "Name of the discount. Will be displayed to the customer when the discount is applied." }, "code": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Code", "description": "Code customers can use to apply the discount during checkout." }, "starts_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Starts At", "description": "Timestamp after which the discount is redeemable." }, "ends_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Ends At", "description": "Timestamp after which the discount is no longer redeemable." }, "max_redemptions": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Max Redemptions", "description": "Maximum number of times the discount can be redeemed." }, "redemptions_count": { "type": "integer", "title": "Redemptions Count", "description": "Number of times the discount has been redeemed." }, "organization_id": { "type": "string", "format": "uuid4", "title": "Organization Id", "description": "The organization ID.", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "x-polar-selector-widget": { "displayProperty": "name", "resourceName": "Organization", "resourceRoot": "/v1/organizations" } } }, "type": "object", "required": [ "duration", "duration_in_months", "type", "basis_points", "created_at", "modified_at", "id", "metadata", "name", "code", "starts_at", "ends_at", "max_redemptions", "redemptions_count", "organization_id" ], "title": "DiscountPercentageRepeatDurationBase" }, "DiscountPercentageRepeatDurationCreate": { "properties": { "duration": { "$ref": "#/components/schemas/DiscountDuration" }, "duration_in_months": { "type": "integer", "maximum": 999, "minimum": 1, "title": "Duration In Months", "description": "Number of months the discount should be applied.\n\nFor this to work on yearly pricing, you should multiply this by 12.\nFor example, to apply the discount for 2 years, set this to 24." }, "type": { "$ref": "#/components/schemas/DiscountType", "description": "Type of the discount." }, "basis_points": { "type": "integer", "maximum": 10000, "minimum": 1, "title": "Basis Points", "description": "Discount percentage in basis points.\n\nA basis point is 1/100th of a percent.\nFor example, to create a 25.5% discount, set this to 2550." }, "metadata": { "additionalProperties": { "anyOf": [ { "type": "string", "maxLength": 500, "minLength": 1 }, { "type": "integer" }, { "type": "number" }, { "type": "boolean" } ] }, "propertyNames": { "maxLength": 40, "minLength": 1 }, "type": "object", "maxProperties": 50, "title": "Metadata", "description": "Key-value object allowing you to store additional information.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**." }, "name": { "type": "string", "minLength": 1, "title": "Name", "description": "Name of the discount. Will be displayed to the customer when the discount is applied." }, "code": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Code", "description": "Code customers can use to apply the discount during checkout. Must be between 3 and 256 characters long and contain only alphanumeric characters.If not provided, the discount can only be applied via the API." }, "starts_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Starts At", "description": "Optional timestamp after which the discount is redeemable." }, "ends_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Ends At", "description": "Optional timestamp after which the discount is no longer redeemable." }, "max_redemptions": { "anyOf": [ { "type": "integer", "minimum": 1 }, { "type": "null" } ], "title": "Max Redemptions", "description": "Optional maximum number of times the discount can be redeemed." }, "products": { "anyOf": [ { "items": { "type": "string", "format": "uuid4" }, "type": "array", "description": "List of product IDs the discount can be applied to." }, { "type": "null" } ], "title": "Products" }, "organization_id": { "anyOf": [ { "type": "string", "format": "uuid4", "description": "The organization ID.", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "x-polar-selector-widget": { "displayProperty": "name", "resourceName": "Organization", "resourceRoot": "/v1/organizations" } }, { "type": "null" } ], "title": "Organization Id", "description": "The ID of the organization owning the discount. **Required unless you use an organization token.**" } }, "type": "object", "required": [ "duration", "duration_in_months", "type", "basis_points", "name" ], "title": "DiscountPercentageRepeatDurationCreate", "description": "Schema to create a percentage discount that is applied on every invoice\nfor a certain number of months." }, "DiscountProduct": { "properties": { "metadata": { "$ref": "#/components/schemas/MetadataOutputType" }, "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "trial_interval": { "anyOf": [ { "$ref": "#/components/schemas/TrialInterval" }, { "type": "null" } ], "description": "The interval unit for the trial period." }, "trial_interval_count": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Trial Interval Count", "description": "The number of interval units for the trial period." }, "name": { "type": "string", "title": "Name", "description": "The name of the product." }, "description": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Description", "description": "The description of the product." }, "visibility": { "$ref": "#/components/schemas/ProductVisibility", "description": "The visibility of the product." }, "recurring_interval": { "anyOf": [ { "$ref": "#/components/schemas/SubscriptionRecurringInterval" }, { "type": "null" } ], "description": "The recurring interval of the product. If `None`, the product is a one-time purchase." }, "recurring_interval_count": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Recurring Interval Count", "description": "Number of interval units of the subscription. If this is set to 1 the charge will happen every interval (e.g. every month), if set to 2 it will be every other month, and so on. None for one-time products." }, "is_recurring": { "type": "boolean", "title": "Is Recurring", "description": "Whether the product is a subscription." }, "is_archived": { "type": "boolean", "title": "Is Archived", "description": "Whether the product is archived and no longer available." }, "organization_id": { "type": "string", "format": "uuid4", "title": "Organization Id", "description": "The ID of the organization owning the product." } }, "type": "object", "required": [ "metadata", "id", "created_at", "modified_at", "trial_interval", "trial_interval_count", "name", "description", "visibility", "recurring_interval", "recurring_interval_count", "is_recurring", "is_archived", "organization_id" ], "title": "DiscountProduct", "description": "A product that a discount can be applied to." }, "DiscountSortProperty": { "type": "string", "enum": [ "created_at", "-created_at", "name", "-name", "code", "-code", "redemptions_count", "-redemptions_count" ], "title": "DiscountSortProperty" }, "DiscountType": { "type": "string", "enum": [ "fixed", "percentage" ], "title": "DiscountType" }, "DiscountUpdate": { "properties": { "metadata": { "additionalProperties": { "anyOf": [ { "type": "string", "maxLength": 500, "minLength": 1 }, { "type": "integer" }, { "type": "number" }, { "type": "boolean" } ] }, "propertyNames": { "maxLength": 40, "minLength": 1 }, "type": "object", "maxProperties": 50, "title": "Metadata", "description": "Key-value object allowing you to store additional information.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**." }, "name": { "anyOf": [ { "type": "string", "minLength": 1, "description": "Name of the discount. Will be displayed to the customer when the discount is applied." }, { "type": "null" } ], "title": "Name" }, "code": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Code", "description": "Code customers can use to apply the discount during checkout. Must be between 3 and 256 characters long and contain only alphanumeric characters.If not provided, the discount can only be applied via the API." }, "starts_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Starts At", "description": "Optional timestamp after which the discount is redeemable." }, "ends_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Ends At", "description": "Optional timestamp after which the discount is no longer redeemable." }, "max_redemptions": { "anyOf": [ { "type": "integer", "minimum": 1 }, { "type": "null" } ], "title": "Max Redemptions", "description": "Optional maximum number of times the discount can be redeemed." }, "duration": { "anyOf": [ { "$ref": "#/components/schemas/DiscountDuration" }, { "type": "null" } ] }, "duration_in_months": { "anyOf": [ { "type": "integer", "maximum": 999, "minimum": 1, "description": "Number of months the discount should be applied.\n\nFor this to work on yearly pricing, you should multiply this by 12.\nFor example, to apply the discount for 2 years, set this to 24." }, { "type": "null" } ], "title": "Duration In Months" }, "type": { "anyOf": [ { "$ref": "#/components/schemas/DiscountType" }, { "type": "null" } ] }, "amount": { "anyOf": [ { "type": "integer", "maximum": 999999999999, "minimum": 0, "description": "Fixed amount to discount from the invoice total." }, { "type": "null" } ], "title": "Amount" }, "currency": { "anyOf": [ { "$ref": "#/components/schemas/PresentmentCurrency", "description": "The currency of the fixed amount discount." }, { "type": "null" } ] }, "basis_points": { "anyOf": [ { "type": "integer", "maximum": 10000, "minimum": 1, "description": "Discount percentage in basis points.\n\nA basis point is 1/100th of a percent.\nFor example, to create a 25.5% discount, set this to 2550." }, { "type": "null" } ], "title": "Basis Points" }, "products": { "anyOf": [ { "items": { "type": "string", "format": "uuid4" }, "type": "array", "description": "List of product IDs the discount can be applied to." }, { "type": "null" } ], "title": "Products" } }, "type": "object", "title": "DiscountUpdate", "description": "Schema to update a discount." }, "Dispute": { "properties": { "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "status": { "$ref": "#/components/schemas/DisputeStatus", "description": "Status of the dispute. `prevented` means we issued a refund before the dispute was escalated, avoiding any fees.", "examples": [ "needs_response", "prevented" ] }, "resolved": { "type": "boolean", "title": "Resolved", "description": "Whether the dispute has been resolved (won or lost).", "examples": [ false ] }, "closed": { "type": "boolean", "title": "Closed", "description": "Whether the dispute is closed (prevented, won, or lost).", "examples": [ false ] }, "amount": { "type": "integer", "title": "Amount", "description": "Amount in cents disputed.", "examples": [ 1000 ] }, "tax_amount": { "type": "integer", "title": "Tax Amount", "description": "Tax amount in cents disputed.", "examples": [ 200 ] }, "currency": { "type": "string", "title": "Currency", "description": "Currency code of the dispute.", "examples": [ "usd" ] }, "order_id": { "type": "string", "format": "uuid4", "title": "Order Id", "description": "The ID of the order associated with the dispute.", "examples": [ "57107b74-8400-4d80-a2fc-54c2b4239cb3" ] }, "payment_id": { "type": "string", "format": "uuid4", "title": "Payment Id", "description": "The ID of the payment associated with the dispute.", "examples": [ "42b94870-36b9-4573-96b6-b90b1c99a353" ] } }, "type": "object", "required": [ "created_at", "modified_at", "id", "status", "resolved", "closed", "amount", "tax_amount", "currency", "order_id", "payment_id" ], "title": "Dispute", "description": "Schema representing a dispute.\n\nA dispute is a challenge raised by a customer or their bank regarding a payment." }, "DisputeSortProperty": { "type": "string", "enum": [ "created_at", "-created_at", "amount", "-amount" ], "title": "DisputeSortProperty" }, "DisputeStatus": { "type": "string", "enum": [ "prevented", "early_warning", "needs_response", "under_review", "lost", "won" ], "title": "DisputeStatus" }, "DownloadableFileCreate": { "properties": { "organization_id": { "anyOf": [ { "type": "string", "format": "uuid4", "description": "The organization ID.", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "x-polar-selector-widget": { "displayProperty": "name", "resourceName": "Organization", "resourceRoot": "/v1/organizations" } }, { "type": "null" } ], "title": "Organization Id" }, "name": { "type": "string", "title": "Name" }, "mime_type": { "type": "string", "title": "Mime Type" }, "size": { "type": "integer", "title": "Size" }, "checksum_sha256_base64": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Checksum Sha256 Base64" }, "upload": { "$ref": "#/components/schemas/S3FileCreateMultipart" }, "service": { "type": "string", "const": "downloadable", "title": "Service" }, "version": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Version" } }, "type": "object", "required": [ "name", "mime_type", "size", "upload", "service" ], "title": "DownloadableFileCreate", "description": "Schema to create a file to be associated with the downloadables benefit." }, "DownloadableFileRead": { "properties": { "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "organization_id": { "type": "string", "format": "uuid4", "title": "Organization Id" }, "name": { "type": "string", "title": "Name" }, "path": { "type": "string", "title": "Path" }, "mime_type": { "type": "string", "title": "Mime Type" }, "size": { "type": "integer", "title": "Size" }, "storage_version": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Storage Version" }, "checksum_etag": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Checksum Etag" }, "checksum_sha256_base64": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Checksum Sha256 Base64" }, "checksum_sha256_hex": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Checksum Sha256 Hex" }, "last_modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Last Modified At" }, "version": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Version" }, "service": { "type": "string", "const": "downloadable", "title": "Service" }, "is_uploaded": { "type": "boolean", "title": "Is Uploaded" }, "created_at": { "type": "string", "format": "date-time", "title": "Created At" }, "size_readable": { "type": "string", "title": "Size Readable" } }, "type": "object", "required": [ "id", "organization_id", "name", "path", "mime_type", "size", "storage_version", "checksum_etag", "checksum_sha256_base64", "checksum_sha256_hex", "last_modified_at", "version", "service", "is_uploaded", "created_at", "size_readable" ], "title": "DownloadableFileRead", "description": "File to be associated with the downloadables benefit." }, "DownloadableRead": { "properties": { "id": { "type": "string", "format": "uuid4", "title": "Id" }, "benefit_id": { "type": "string", "format": "uuid4", "title": "Benefit Id" }, "file": { "$ref": "#/components/schemas/FileDownload" } }, "type": "object", "required": [ "id", "benefit_id", "file" ], "title": "DownloadableRead" }, "Event": { "oneOf": [ { "$ref": "#/components/schemas/SystemEvent" }, { "$ref": "#/components/schemas/UserEvent" } ] }, "EventCreateCustomer": { "properties": { "timestamp": { "type": "string", "format": "date-time", "title": "Timestamp", "description": "The timestamp of the event." }, "name": { "type": "string", "title": "Name", "description": "The name of the event." }, "organization_id": { "anyOf": [ { "type": "string", "format": "uuid4", "description": "The organization ID.", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "x-polar-selector-widget": { "displayProperty": "name", "resourceName": "Organization", "resourceRoot": "/v1/organizations" } }, { "type": "null" } ], "title": "Organization Id", "description": "The ID of the organization owning the event. **Required unless you use an organization token.**" }, "external_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "External Id", "description": "Your unique identifier for this event. Useful for deduplication and parent-child relationships." }, "parent_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Parent Id", "description": "The ID of the parent event. Can be either a Polar event ID (UUID) or an external event ID." }, "metadata": { "$ref": "#/components/schemas/EventMetadataInput", "description": "Key-value object allowing you to store additional information about the event. Some keys like `_llm` are structured data that are handled specially by Polar.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**." }, "customer_id": { "type": "string", "format": "uuid4", "title": "Customer Id", "description": "ID of the customer in your Polar organization associated with the event." }, "member_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Member Id", "description": "ID of the member within the customer's organization who performed the action. Used for member-level attribution in B2B." } }, "type": "object", "required": [ "name", "customer_id" ], "title": "EventCreateCustomer" }, "EventCreateExternalCustomer": { "properties": { "timestamp": { "type": "string", "format": "date-time", "title": "Timestamp", "description": "The timestamp of the event." }, "name": { "type": "string", "title": "Name", "description": "The name of the event." }, "organization_id": { "anyOf": [ { "type": "string", "format": "uuid4", "description": "The organization ID.", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "x-polar-selector-widget": { "displayProperty": "name", "resourceName": "Organization", "resourceRoot": "/v1/organizations" } }, { "type": "null" } ], "title": "Organization Id", "description": "The ID of the organization owning the event. **Required unless you use an organization token.**" }, "external_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "External Id", "description": "Your unique identifier for this event. Useful for deduplication and parent-child relationships." }, "parent_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Parent Id", "description": "The ID of the parent event. Can be either a Polar event ID (UUID) or an external event ID." }, "metadata": { "$ref": "#/components/schemas/EventMetadataInput", "description": "Key-value object allowing you to store additional information about the event. Some keys like `_llm` are structured data that are handled specially by Polar.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**." }, "external_customer_id": { "type": "string", "title": "External Customer Id", "description": "ID of the customer in your system associated with the event." }, "external_member_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "External Member Id", "description": "ID of the member in your system within the customer's organization who performed the action. Used for member-level attribution in B2B." } }, "type": "object", "required": [ "name", "external_customer_id" ], "title": "EventCreateExternalCustomer" }, "EventMetadataInput": { "additionalProperties": { "anyOf": [ { "type": "string", "maxLength": 500, "minLength": 1 }, { "type": "integer" }, { "type": "number" }, { "type": "boolean" }, { "$ref": "#/components/schemas/CostMetadata-Input" }, { "$ref": "#/components/schemas/LLMMetadata" } ] }, "type": "object", "title": "EventMetadataInput" }, "EventMetadataOutput": { "additionalProperties": { "anyOf": [ { "type": "string" }, { "type": "integer" }, { "type": "number" }, { "type": "boolean" }, { "$ref": "#/components/schemas/CostMetadata-Output" }, { "$ref": "#/components/schemas/LLMMetadata" } ] }, "type": "object", "title": "EventMetadataOutput" }, "EventName": { "properties": { "name": { "type": "string", "title": "Name", "description": "The name of the event." }, "source": { "$ref": "#/components/schemas/EventSource", "description": "The source of the event. `system` events are created by Polar. `user` events are the one you create through our ingestion API." }, "occurrences": { "type": "integer", "title": "Occurrences", "description": "Number of times the event has occurred." }, "first_seen": { "type": "string", "format": "date-time", "title": "First Seen", "description": "The first time the event occurred." }, "last_seen": { "type": "string", "format": "date-time", "title": "Last Seen", "description": "The last time the event occurred." } }, "type": "object", "required": [ "name", "source", "occurrences", "first_seen", "last_seen" ], "title": "EventName" }, "EventNamesSortProperty": { "type": "string", "enum": [ "name", "-name", "occurrences", "-occurrences", "first_seen", "-first_seen", "last_seen", "-last_seen" ], "title": "EventNamesSortProperty" }, "EventSortProperty": { "type": "string", "enum": [ "timestamp", "-timestamp" ], "title": "EventSortProperty" }, "EventSource": { "type": "string", "enum": [ "system", "user" ], "title": "EventSource" }, "EventType": { "properties": { "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "name": { "type": "string", "title": "Name", "description": "The name of the event type." }, "label": { "type": "string", "title": "Label", "description": "The label for the event type." }, "label_property_selector": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Label Property Selector", "description": "Property path to extract dynamic label from event metadata." }, "organization_id": { "type": "string", "format": "uuid4", "title": "Organization Id", "description": "The ID of the organization owning the event type." } }, "type": "object", "required": [ "created_at", "modified_at", "id", "name", "label", "organization_id" ], "title": "EventType" }, "EventTypeUpdate": { "properties": { "label": { "type": "string", "maxLength": 128, "minLength": 1, "title": "Label", "description": "The label for the event type." }, "label_property_selector": { "anyOf": [ { "type": "string", "maxLength": 256, "minLength": 1 }, { "type": "null" } ], "title": "Label Property Selector", "description": "Property path to extract dynamic label from event metadata (e.g., 'subject' or 'metadata.subject')." } }, "type": "object", "required": [ "label" ], "title": "EventTypeUpdate" }, "EventTypeWithStats": { "properties": { "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "name": { "type": "string", "title": "Name", "description": "The name of the event type." }, "label": { "type": "string", "title": "Label", "description": "The label for the event type." }, "label_property_selector": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Label Property Selector", "description": "Property path to extract dynamic label from event metadata." }, "organization_id": { "type": "string", "format": "uuid4", "title": "Organization Id", "description": "The ID of the organization owning the event type." }, "source": { "$ref": "#/components/schemas/EventSource", "description": "The source of the events (system or user)." }, "occurrences": { "type": "integer", "title": "Occurrences", "description": "Number of times the event has occurred." }, "first_seen": { "type": "string", "format": "date-time", "title": "First Seen", "description": "The first time the event occurred." }, "last_seen": { "type": "string", "format": "date-time", "title": "Last Seen", "description": "The last time the event occurred." } }, "type": "object", "required": [ "created_at", "modified_at", "id", "name", "label", "organization_id", "source", "occurrences", "first_seen", "last_seen" ], "title": "EventTypeWithStats" }, "EventTypesSortProperty": { "type": "string", "enum": [ "name", "-name", "label", "-label", "occurrences", "-occurrences", "first_seen", "-first_seen", "last_seen", "-last_seen" ], "title": "EventTypesSortProperty" }, "EventsIngest": { "properties": { "events": { "items": { "anyOf": [ { "$ref": "#/components/schemas/EventCreateCustomer" }, { "$ref": "#/components/schemas/EventCreateExternalCustomer" } ] }, "type": "array", "title": "Events", "description": "List of events to ingest." } }, "type": "object", "required": [ "events" ], "title": "EventsIngest" }, "EventsIngestResponse": { "properties": { "inserted": { "type": "integer", "title": "Inserted", "description": "Number of events inserted." }, "duplicates": { "type": "integer", "title": "Duplicates", "description": "Number of duplicate events skipped.", "default": 0 } }, "type": "object", "required": [ "inserted" ], "title": "EventsIngestResponse" }, "ExistingProductPrice": { "properties": { "id": { "type": "string", "format": "uuid4", "title": "Id" } }, "type": "object", "required": [ "id" ], "title": "ExistingProductPrice", "description": "A price that already exists for this product.\n\nUseful when updating a product if you want to keep an existing price." }, "ExpiredCheckoutError": { "properties": { "error": { "type": "string", "const": "ExpiredCheckoutError", "title": "Error", "examples": [ "ExpiredCheckoutError" ] }, "detail": { "type": "string", "title": "Detail" } }, "type": "object", "required": [ "error", "detail" ], "title": "ExpiredCheckoutError" }, "FileCreate": { "oneOf": [ { "$ref": "#/components/schemas/DownloadableFileCreate" }, { "$ref": "#/components/schemas/ProductMediaFileCreate" }, { "$ref": "#/components/schemas/OrganizationAvatarFileCreate" } ], "discriminator": { "propertyName": "service", "mapping": { "downloadable": "#/components/schemas/DownloadableFileCreate", "organization_avatar": "#/components/schemas/OrganizationAvatarFileCreate", "product_media": "#/components/schemas/ProductMediaFileCreate" } } }, "FileDownload": { "properties": { "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "organization_id": { "type": "string", "format": "uuid4", "title": "Organization Id" }, "name": { "type": "string", "title": "Name" }, "path": { "type": "string", "title": "Path" }, "mime_type": { "type": "string", "title": "Mime Type" }, "size": { "type": "integer", "title": "Size" }, "storage_version": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Storage Version" }, "checksum_etag": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Checksum Etag" }, "checksum_sha256_base64": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Checksum Sha256 Base64" }, "checksum_sha256_hex": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Checksum Sha256 Hex" }, "last_modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Last Modified At" }, "download": { "$ref": "#/components/schemas/S3DownloadURL" }, "version": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Version" }, "is_uploaded": { "type": "boolean", "title": "Is Uploaded" }, "service": { "$ref": "#/components/schemas/FileServiceTypes" }, "size_readable": { "type": "string", "title": "Size Readable" } }, "type": "object", "required": [ "id", "organization_id", "name", "path", "mime_type", "size", "storage_version", "checksum_etag", "checksum_sha256_base64", "checksum_sha256_hex", "last_modified_at", "download", "version", "is_uploaded", "service", "size_readable" ], "title": "FileDownload" }, "FilePatch": { "properties": { "name": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Name" }, "version": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Version" } }, "type": "object", "title": "FilePatch" }, "FileServiceTypes": { "type": "string", "enum": [ "downloadable", "product_media", "organization_avatar" ], "title": "FileServiceTypes" }, "FileUpload": { "properties": { "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "organization_id": { "type": "string", "format": "uuid4", "title": "Organization Id" }, "name": { "type": "string", "title": "Name" }, "path": { "type": "string", "title": "Path" }, "mime_type": { "type": "string", "title": "Mime Type" }, "size": { "type": "integer", "title": "Size" }, "storage_version": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Storage Version" }, "checksum_etag": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Checksum Etag" }, "checksum_sha256_base64": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Checksum Sha256 Base64" }, "checksum_sha256_hex": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Checksum Sha256 Hex" }, "last_modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Last Modified At" }, "upload": { "$ref": "#/components/schemas/S3FileUploadMultipart" }, "version": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Version" }, "is_uploaded": { "type": "boolean", "title": "Is Uploaded", "default": false }, "service": { "$ref": "#/components/schemas/FileServiceTypes" }, "size_readable": { "type": "string", "title": "Size Readable" } }, "type": "object", "required": [ "id", "organization_id", "name", "path", "mime_type", "size", "storage_version", "checksum_etag", "checksum_sha256_base64", "checksum_sha256_hex", "last_modified_at", "upload", "version", "service", "size_readable" ], "title": "FileUpload" }, "FileUploadCompleted": { "properties": { "id": { "type": "string", "title": "Id" }, "path": { "type": "string", "title": "Path" }, "parts": { "items": { "$ref": "#/components/schemas/S3FileUploadCompletedPart" }, "type": "array", "title": "Parts" } }, "type": "object", "required": [ "id", "path", "parts" ], "title": "FileUploadCompleted" }, "Filter": { "properties": { "conjunction": { "$ref": "#/components/schemas/FilterConjunction" }, "clauses": { "items": { "anyOf": [ { "$ref": "#/components/schemas/FilterClause" }, { "$ref": "#/components/schemas/Filter" } ] }, "type": "array", "title": "Clauses" } }, "type": "object", "required": [ "conjunction", "clauses" ], "title": "Filter" }, "FilterClause": { "properties": { "property": { "type": "string", "title": "Property" }, "operator": { "$ref": "#/components/schemas/FilterOperator" }, "value": { "anyOf": [ { "type": "string", "maxLength": 1000 }, { "type": "integer", "maximum": 2147483647, "minimum": -2147483648 }, { "type": "boolean" } ], "title": "Value" } }, "type": "object", "required": [ "property", "operator", "value" ], "title": "FilterClause" }, "FilterConjunction": { "type": "string", "enum": [ "and", "or" ], "title": "FilterConjunction" }, "FilterOperator": { "type": "string", "enum": [ "eq", "ne", "gt", "gte", "lt", "lte", "like", "not_like" ], "title": "FilterOperator" }, "GenericPayment": { "properties": { "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "processor": { "$ref": "#/components/schemas/PaymentProcessor", "description": "The payment processor.", "examples": [ "stripe" ] }, "status": { "$ref": "#/components/schemas/PaymentStatus", "description": "The payment status.", "examples": [ "succeeded" ] }, "amount": { "type": "integer", "title": "Amount", "description": "The payment amount in cents.", "examples": [ 1000 ] }, "currency": { "type": "string", "title": "Currency", "description": "The payment currency. Currently, only `usd` is supported.", "examples": [ "usd" ] }, "method": { "type": "string", "title": "Method", "description": "The payment method used.", "examples": [ "card" ] }, "decline_reason": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Decline Reason", "description": "Error code, if the payment was declined.", "examples": [ "insufficient_funds" ] }, "decline_message": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Decline Message", "description": "Human-readable error message, if the payment was declined.", "examples": [ "Your card has insufficient funds." ] }, "organization_id": { "type": "string", "format": "uuid4", "title": "Organization Id", "description": "The ID of the organization that owns the payment.", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ] }, "checkout_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Checkout Id", "description": "The ID of the checkout session associated with this payment.", "examples": [ "e4b478fa-cd25-4253-9f1f-8a41e6370ede" ] }, "order_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Order Id", "description": "The ID of the order associated with this payment.", "examples": [ "e4b478fa-cd25-4253-9f1f-8a41e6370ede" ] }, "processor_metadata": { "additionalProperties": true, "type": "object", "title": "Processor Metadata", "description": "Additional metadata from the payment processor for internal use." } }, "type": "object", "required": [ "created_at", "modified_at", "id", "processor", "status", "amount", "currency", "method", "decline_reason", "decline_message", "organization_id", "checkout_id", "order_id" ], "title": "GenericPayment", "description": "Schema of a payment with a generic payment method." }, "HTTPValidationError": { "properties": { "detail": { "items": { "$ref": "#/components/schemas/ValidationError" }, "type": "array", "title": "Detail" } }, "type": "object", "title": "HTTPValidationError" }, "IntrospectTokenResponse": { "properties": { "active": { "type": "boolean", "title": "Active" }, "client_id": { "type": "string", "title": "Client Id" }, "token_type": { "type": "string", "enum": [ "access_token", "refresh_token" ], "title": "Token Type" }, "scope": { "type": "string", "title": "Scope" }, "sub_type": { "$ref": "#/components/schemas/SubType" }, "sub": { "type": "string", "title": "Sub" }, "aud": { "type": "string", "title": "Aud" }, "iss": { "type": "string", "title": "Iss" }, "exp": { "type": "integer", "title": "Exp" }, "iat": { "type": "integer", "title": "Iat" } }, "type": "object", "required": [ "active", "client_id", "token_type", "scope", "sub_type", "sub", "aud", "iss", "exp", "iat" ], "title": "IntrospectTokenResponse" }, "LLMMetadata": { "properties": { "vendor": { "type": "string", "title": "Vendor", "description": "The vendor of the event." }, "model": { "type": "string", "title": "Model", "description": "The model used for the event." }, "prompt": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Prompt", "description": "The LLM prompt used for the event." }, "response": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Response", "description": "The LLM response used for the event." }, "input_tokens": { "type": "integer", "title": "Input Tokens", "description": "The number of LLM input tokens used for the event." }, "cached_input_tokens": { "type": "integer", "title": "Cached Input Tokens", "description": "The number of LLM cached tokens that were used for the event." }, "output_tokens": { "type": "integer", "title": "Output Tokens", "description": "The number of LLM output tokens used for the event." }, "total_tokens": { "type": "integer", "title": "Total Tokens", "description": "The total number of LLM tokens used for the event." } }, "type": "object", "required": [ "vendor", "model", "input_tokens", "output_tokens", "total_tokens" ], "title": "LLMMetadata" }, "LegacyOrganizationStatus": { "type": "string", "enum": [ "created", "onboarding_started", "under_review", "denied", "active" ], "title": "LegacyOrganizationStatus", "description": "Legacy organization status values kept for backward compatibility in schemas\nusing OrganizationPublicBase." }, "LegacyRecurringProductPrice": { "oneOf": [ { "$ref": "#/components/schemas/LegacyRecurringProductPriceFixed" }, { "$ref": "#/components/schemas/LegacyRecurringProductPriceCustom" }, { "$ref": "#/components/schemas/LegacyRecurringProductPriceFree" } ], "discriminator": { "propertyName": "amount_type", "mapping": { "custom": "#/components/schemas/LegacyRecurringProductPriceCustom", "fixed": "#/components/schemas/LegacyRecurringProductPriceFixed", "free": "#/components/schemas/LegacyRecurringProductPriceFree" } } }, "LegacyRecurringProductPriceCustom": { "properties": { "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the price." }, "source": { "$ref": "#/components/schemas/ProductPriceSource", "description": "The source of the price . `catalog` is a predefined price, while `ad_hoc` is a price created dynamically on a Checkout session." }, "amount_type": { "type": "string", "const": "custom", "title": "Amount Type" }, "price_currency": { "type": "string", "title": "Price Currency", "description": "The currency in which the customer will be charged." }, "is_archived": { "type": "boolean", "title": "Is Archived", "description": "Whether the price is archived and no longer available." }, "product_id": { "type": "string", "format": "uuid4", "title": "Product Id", "description": "The ID of the product owning the price." }, "type": { "type": "string", "const": "recurring", "title": "Type", "description": "The type of the price." }, "recurring_interval": { "$ref": "#/components/schemas/SubscriptionRecurringInterval", "description": "The recurring interval of the price." }, "minimum_amount": { "type": "integer", "title": "Minimum Amount", "description": "The minimum amount the customer can pay. If 0, the price is 'free or pay what you want'. Defaults to 50 cents." }, "maximum_amount": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Maximum Amount", "description": "The maximum amount the customer can pay." }, "preset_amount": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Preset Amount", "description": "The initial amount shown to the customer." }, "legacy": { "type": "boolean", "const": true, "title": "Legacy" } }, "type": "object", "required": [ "created_at", "modified_at", "id", "source", "amount_type", "price_currency", "is_archived", "product_id", "type", "recurring_interval", "minimum_amount", "maximum_amount", "preset_amount", "legacy" ], "title": "LegacyRecurringProductPriceCustom", "description": "A pay-what-you-want recurring price for a product, i.e. a subscription.\n\n**Deprecated**: The recurring interval should be set on the product itself." }, "LegacyRecurringProductPriceFixed": { "properties": { "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the price." }, "source": { "$ref": "#/components/schemas/ProductPriceSource", "description": "The source of the price . `catalog` is a predefined price, while `ad_hoc` is a price created dynamically on a Checkout session." }, "amount_type": { "type": "string", "const": "fixed", "title": "Amount Type" }, "price_currency": { "type": "string", "title": "Price Currency", "description": "The currency in which the customer will be charged." }, "is_archived": { "type": "boolean", "title": "Is Archived", "description": "Whether the price is archived and no longer available." }, "product_id": { "type": "string", "format": "uuid4", "title": "Product Id", "description": "The ID of the product owning the price." }, "type": { "type": "string", "const": "recurring", "title": "Type", "description": "The type of the price." }, "recurring_interval": { "$ref": "#/components/schemas/SubscriptionRecurringInterval", "description": "The recurring interval of the price." }, "price_amount": { "type": "integer", "title": "Price Amount", "description": "The price in cents." }, "legacy": { "type": "boolean", "const": true, "title": "Legacy" } }, "type": "object", "required": [ "created_at", "modified_at", "id", "source", "amount_type", "price_currency", "is_archived", "product_id", "type", "recurring_interval", "price_amount", "legacy" ], "title": "LegacyRecurringProductPriceFixed", "description": "A recurring price for a product, i.e. a subscription.\n\n**Deprecated**: The recurring interval should be set on the product itself." }, "LegacyRecurringProductPriceFree": { "properties": { "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the price." }, "source": { "$ref": "#/components/schemas/ProductPriceSource", "description": "The source of the price . `catalog` is a predefined price, while `ad_hoc` is a price created dynamically on a Checkout session." }, "amount_type": { "type": "string", "const": "free", "title": "Amount Type" }, "price_currency": { "type": "string", "title": "Price Currency", "description": "The currency in which the customer will be charged." }, "is_archived": { "type": "boolean", "title": "Is Archived", "description": "Whether the price is archived and no longer available." }, "product_id": { "type": "string", "format": "uuid4", "title": "Product Id", "description": "The ID of the product owning the price." }, "type": { "type": "string", "const": "recurring", "title": "Type", "description": "The type of the price." }, "recurring_interval": { "$ref": "#/components/schemas/SubscriptionRecurringInterval", "description": "The recurring interval of the price." }, "legacy": { "type": "boolean", "const": true, "title": "Legacy" } }, "type": "object", "required": [ "created_at", "modified_at", "id", "source", "amount_type", "price_currency", "is_archived", "product_id", "type", "recurring_interval", "legacy" ], "title": "LegacyRecurringProductPriceFree", "description": "A free recurring price for a product, i.e. a subscription.\n\n**Deprecated**: The recurring interval should be set on the product itself." }, "LicenseKeyActivate": { "properties": { "key": { "type": "string", "title": "Key" }, "organization_id": { "type": "string", "format": "uuid4", "title": "Organization Id" }, "label": { "type": "string", "title": "Label" }, "conditions": { "additionalProperties": { "anyOf": [ { "type": "string", "maxLength": 500, "minLength": 1 }, { "type": "integer" }, { "type": "number" }, { "type": "boolean" } ] }, "propertyNames": { "maxLength": 40, "minLength": 1 }, "type": "object", "maxProperties": 50, "title": "Conditions", "description": "Key-value object allowing you to set conditions that must match when validating the license key.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**." }, "meta": { "additionalProperties": { "anyOf": [ { "type": "string", "maxLength": 500, "minLength": 1 }, { "type": "integer" }, { "type": "number" }, { "type": "boolean" } ] }, "propertyNames": { "maxLength": 40, "minLength": 1 }, "type": "object", "maxProperties": 50, "title": "Meta", "description": "Key-value object allowing you to store additional information about the activation\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**." } }, "type": "object", "required": [ "key", "organization_id", "label" ], "title": "LicenseKeyActivate" }, "LicenseKeyActivationBase": { "properties": { "id": { "type": "string", "format": "uuid4", "title": "Id" }, "license_key_id": { "type": "string", "format": "uuid4", "title": "License Key Id" }, "label": { "type": "string", "title": "Label" }, "meta": { "additionalProperties": { "anyOf": [ { "type": "string" }, { "type": "integer" }, { "type": "number" }, { "type": "boolean" } ] }, "type": "object", "title": "Meta" }, "created_at": { "type": "string", "format": "date-time", "title": "Created At" }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At" } }, "type": "object", "required": [ "id", "license_key_id", "label", "meta", "created_at", "modified_at" ], "title": "LicenseKeyActivationBase" }, "LicenseKeyActivationRead": { "properties": { "id": { "type": "string", "format": "uuid4", "title": "Id" }, "license_key_id": { "type": "string", "format": "uuid4", "title": "License Key Id" }, "label": { "type": "string", "title": "Label" }, "meta": { "additionalProperties": { "anyOf": [ { "type": "string" }, { "type": "integer" }, { "type": "number" }, { "type": "boolean" } ] }, "type": "object", "title": "Meta" }, "created_at": { "type": "string", "format": "date-time", "title": "Created At" }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At" }, "license_key": { "$ref": "#/components/schemas/LicenseKeyRead" } }, "type": "object", "required": [ "id", "license_key_id", "label", "meta", "created_at", "modified_at", "license_key" ], "title": "LicenseKeyActivationRead" }, "LicenseKeyCustomer": { "properties": { "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the customer.", "examples": [ "992fae2a-2a17-4b7a-8d9e-e287cf90131b" ] }, "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "metadata": { "$ref": "#/components/schemas/MetadataOutputType" }, "external_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "External Id", "description": "The ID of the customer in your system. This must be unique within the organization. Once set, it can't be updated.", "examples": [ "usr_1337" ] }, "email": { "type": "string", "title": "Email", "description": "The email address of the customer. This must be unique within the organization.", "examples": [ "customer@example.com" ] }, "email_verified": { "type": "boolean", "title": "Email Verified", "description": "Whether the customer email address is verified. The address is automatically verified when the customer accesses the customer portal using their email address.", "examples": [ true ] }, "type": { "anyOf": [ { "$ref": "#/components/schemas/CustomerType" }, { "type": "null" } ], "description": "The type of customer: 'individual' for single users, 'team' for customers with multiple members. Legacy customers may have NULL type which is treated as 'individual'.", "examples": [ "individual" ] }, "name": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Name", "description": "The name of the customer.", "examples": [ "John Doe" ] }, "billing_address": { "anyOf": [ { "$ref": "#/components/schemas/Address" }, { "type": "null" } ] }, "tax_id": { "anyOf": [ { "prefixItems": [ { "type": "string" }, { "$ref": "#/components/schemas/TaxIDFormat" } ], "type": "array", "maxItems": 2, "minItems": 2, "examples": [ [ "911144442", "us_ein" ], [ "FR61954506077", "eu_vat" ] ] }, { "type": "null" } ], "title": "Tax Id" }, "locale": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Locale" }, "organization_id": { "type": "string", "format": "uuid4", "title": "Organization Id", "description": "The ID of the organization owning the customer.", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ] }, "deleted_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Deleted At", "description": "Timestamp for when the customer was soft deleted." }, "avatar_url": { "type": "string", "title": "Avatar Url", "examples": [ "https://www.gravatar.com/avatar/xxx?d=404" ] } }, "type": "object", "required": [ "id", "created_at", "modified_at", "metadata", "email", "email_verified", "name", "billing_address", "tax_id", "organization_id", "deleted_at", "avatar_url" ], "title": "LicenseKeyCustomer" }, "LicenseKeyDeactivate": { "properties": { "key": { "type": "string", "title": "Key" }, "organization_id": { "type": "string", "format": "uuid4", "title": "Organization Id" }, "activation_id": { "type": "string", "format": "uuid4", "title": "Activation Id" } }, "type": "object", "required": [ "key", "organization_id", "activation_id" ], "title": "LicenseKeyDeactivate" }, "LicenseKeyRead": { "properties": { "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "organization_id": { "type": "string", "format": "uuid4", "title": "Organization Id" }, "customer_id": { "type": "string", "format": "uuid4", "title": "Customer Id" }, "customer": { "$ref": "#/components/schemas/LicenseKeyCustomer" }, "benefit_id": { "type": "string", "format": "uuid4", "title": "Benefit Id", "description": "The benefit ID.", "x-polar-selector-widget": { "displayProperty": "description", "resourceName": "Benefit", "resourceRoot": "/v1/benefits" } }, "key": { "type": "string", "title": "Key" }, "display_key": { "type": "string", "title": "Display Key" }, "status": { "$ref": "#/components/schemas/LicenseKeyStatus" }, "limit_activations": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Limit Activations" }, "usage": { "type": "integer", "title": "Usage" }, "limit_usage": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Limit Usage" }, "validations": { "type": "integer", "title": "Validations" }, "last_validated_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Last Validated At" }, "expires_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Expires At" } }, "type": "object", "required": [ "id", "created_at", "modified_at", "organization_id", "customer_id", "customer", "benefit_id", "key", "display_key", "status", "limit_activations", "usage", "limit_usage", "validations", "last_validated_at", "expires_at" ], "title": "LicenseKeyRead" }, "LicenseKeyStatus": { "type": "string", "enum": [ "granted", "revoked", "disabled" ], "title": "LicenseKeyStatus" }, "LicenseKeyUpdate": { "properties": { "status": { "anyOf": [ { "$ref": "#/components/schemas/LicenseKeyStatus" }, { "type": "null" } ] }, "usage": { "type": "integer", "title": "Usage", "default": 0 }, "limit_activations": { "anyOf": [ { "type": "integer", "maximum": 1000, "exclusiveMinimum": 0 }, { "type": "null" } ], "title": "Limit Activations" }, "limit_usage": { "anyOf": [ { "type": "integer", "exclusiveMinimum": 0 }, { "type": "null" } ], "title": "Limit Usage" }, "expires_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Expires At" } }, "type": "object", "title": "LicenseKeyUpdate" }, "LicenseKeyUser": { "properties": { "id": { "type": "string", "format": "uuid4", "title": "Id" }, "email": { "type": "string", "title": "Email" }, "public_name": { "type": "string", "title": "Public Name" }, "avatar_url": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Avatar Url" } }, "type": "object", "required": [ "id", "email", "public_name" ], "title": "LicenseKeyUser" }, "LicenseKeyValidate": { "properties": { "key": { "type": "string", "title": "Key" }, "organization_id": { "type": "string", "format": "uuid4", "title": "Organization Id" }, "activation_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Activation Id" }, "benefit_id": { "anyOf": [ { "type": "string", "format": "uuid4", "description": "The benefit ID.", "x-polar-selector-widget": { "displayProperty": "description", "resourceName": "Benefit", "resourceRoot": "/v1/benefits" } }, { "type": "null" } ], "title": "Benefit Id" }, "customer_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Customer Id" }, "increment_usage": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Increment Usage" }, "conditions": { "additionalProperties": { "anyOf": [ { "type": "string", "maxLength": 500, "minLength": 1 }, { "type": "integer" }, { "type": "number" }, { "type": "boolean" } ] }, "propertyNames": { "maxLength": 40, "minLength": 1 }, "type": "object", "maxProperties": 50, "title": "Conditions", "description": "Key-value object allowing you to set conditions that must match when validating the license key.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**." } }, "type": "object", "required": [ "key", "organization_id" ], "title": "LicenseKeyValidate" }, "LicenseKeyWithActivations": { "properties": { "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "organization_id": { "type": "string", "format": "uuid4", "title": "Organization Id" }, "customer_id": { "type": "string", "format": "uuid4", "title": "Customer Id" }, "customer": { "$ref": "#/components/schemas/LicenseKeyCustomer" }, "benefit_id": { "type": "string", "format": "uuid4", "title": "Benefit Id", "description": "The benefit ID.", "x-polar-selector-widget": { "displayProperty": "description", "resourceName": "Benefit", "resourceRoot": "/v1/benefits" } }, "key": { "type": "string", "title": "Key" }, "display_key": { "type": "string", "title": "Display Key" }, "status": { "$ref": "#/components/schemas/LicenseKeyStatus" }, "limit_activations": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Limit Activations" }, "usage": { "type": "integer", "title": "Usage" }, "limit_usage": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Limit Usage" }, "validations": { "type": "integer", "title": "Validations" }, "last_validated_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Last Validated At" }, "expires_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Expires At" }, "activations": { "items": { "$ref": "#/components/schemas/LicenseKeyActivationBase" }, "type": "array", "title": "Activations" } }, "type": "object", "required": [ "id", "created_at", "modified_at", "organization_id", "customer_id", "customer", "benefit_id", "key", "display_key", "status", "limit_activations", "usage", "limit_usage", "validations", "last_validated_at", "expires_at", "activations" ], "title": "LicenseKeyWithActivations" }, "ListResourceWithCursorPagination_Event_": { "properties": { "items": { "items": { "$ref": "#/components/schemas/Event" }, "type": "array", "title": "Items" }, "pagination": { "$ref": "#/components/schemas/CursorPagination" } }, "type": "object", "required": [ "items", "pagination" ], "title": "ListResourceWithCursorPagination[Event]" }, "ListResource_BenefitGrant_": { "properties": { "items": { "items": { "$ref": "#/components/schemas/BenefitGrant" }, "type": "array", "title": "Items" }, "pagination": { "$ref": "#/components/schemas/Pagination" } }, "type": "object", "required": [ "items", "pagination" ], "title": "ListResource[BenefitGrant]" }, "ListResource_Benefit_": { "properties": { "items": { "items": { "$ref": "#/components/schemas/Benefit", "title": "Benefit" }, "type": "array", "title": "Items" }, "pagination": { "$ref": "#/components/schemas/Pagination" } }, "type": "object", "required": [ "items", "pagination" ], "title": "ListResource[Benefit]" }, "ListResource_CheckoutLink_": { "properties": { "items": { "items": { "$ref": "#/components/schemas/CheckoutLink" }, "type": "array", "title": "Items" }, "pagination": { "$ref": "#/components/schemas/Pagination" } }, "type": "object", "required": [ "items", "pagination" ], "title": "ListResource[CheckoutLink]" }, "ListResource_Checkout_": { "properties": { "items": { "items": { "$ref": "#/components/schemas/Checkout" }, "type": "array", "title": "Items" }, "pagination": { "$ref": "#/components/schemas/Pagination" } }, "type": "object", "required": [ "items", "pagination" ], "title": "ListResource[Checkout]" }, "ListResource_CustomField_": { "properties": { "items": { "items": { "$ref": "#/components/schemas/CustomField", "title": "CustomField" }, "type": "array", "title": "Items" }, "pagination": { "$ref": "#/components/schemas/Pagination" } }, "type": "object", "required": [ "items", "pagination" ], "title": "ListResource[CustomField]" }, "ListResource_CustomerBenefitGrant_": { "properties": { "items": { "items": { "$ref": "#/components/schemas/CustomerBenefitGrant", "title": "CustomerBenefitGrant" }, "type": "array", "title": "Items" }, "pagination": { "$ref": "#/components/schemas/Pagination" } }, "type": "object", "required": [ "items", "pagination" ], "title": "ListResource[CustomerBenefitGrant]" }, "ListResource_CustomerCustomerMeter_": { "properties": { "items": { "items": { "$ref": "#/components/schemas/CustomerCustomerMeter" }, "type": "array", "title": "Items" }, "pagination": { "$ref": "#/components/schemas/Pagination" } }, "type": "object", "required": [ "items", "pagination" ], "title": "ListResource[CustomerCustomerMeter]" }, "ListResource_CustomerMeter_": { "properties": { "items": { "items": { "$ref": "#/components/schemas/CustomerMeter" }, "type": "array", "title": "Items" }, "pagination": { "$ref": "#/components/schemas/Pagination" } }, "type": "object", "required": [ "items", "pagination" ], "title": "ListResource[CustomerMeter]" }, "ListResource_CustomerOrder_": { "properties": { "items": { "items": { "$ref": "#/components/schemas/CustomerOrder" }, "type": "array", "title": "Items" }, "pagination": { "$ref": "#/components/schemas/Pagination" } }, "type": "object", "required": [ "items", "pagination" ], "title": "ListResource[CustomerOrder]" }, "ListResource_CustomerPaymentMethod_": { "properties": { "items": { "items": { "$ref": "#/components/schemas/CustomerPaymentMethod", "title": "CustomerPaymentMethod" }, "type": "array", "title": "Items" }, "pagination": { "$ref": "#/components/schemas/Pagination" } }, "type": "object", "required": [ "items", "pagination" ], "title": "ListResource[CustomerPaymentMethod]" }, "ListResource_CustomerPortalMember_": { "properties": { "items": { "items": { "$ref": "#/components/schemas/CustomerPortalMember" }, "type": "array", "title": "Items" }, "pagination": { "$ref": "#/components/schemas/Pagination" } }, "type": "object", "required": [ "items", "pagination" ], "title": "ListResource[CustomerPortalMember]" }, "ListResource_CustomerSubscription_": { "properties": { "items": { "items": { "$ref": "#/components/schemas/CustomerSubscription" }, "type": "array", "title": "Items" }, "pagination": { "$ref": "#/components/schemas/Pagination" } }, "type": "object", "required": [ "items", "pagination" ], "title": "ListResource[CustomerSubscription]" }, "ListResource_CustomerWallet_": { "properties": { "items": { "items": { "$ref": "#/components/schemas/CustomerWallet" }, "type": "array", "title": "Items" }, "pagination": { "$ref": "#/components/schemas/Pagination" } }, "type": "object", "required": [ "items", "pagination" ], "title": "ListResource[CustomerWallet]" }, "ListResource_Customer_": { "properties": { "items": { "items": { "$ref": "#/components/schemas/Customer" }, "type": "array", "title": "Items" }, "pagination": { "$ref": "#/components/schemas/Pagination" } }, "type": "object", "required": [ "items", "pagination" ], "title": "ListResource[Customer]" }, "ListResource_Discount_": { "properties": { "items": { "items": { "$ref": "#/components/schemas/Discount", "title": "Discount" }, "type": "array", "title": "Items" }, "pagination": { "$ref": "#/components/schemas/Pagination" } }, "type": "object", "required": [ "items", "pagination" ], "title": "ListResource[Discount]" }, "ListResource_Dispute_": { "properties": { "items": { "items": { "$ref": "#/components/schemas/Dispute" }, "type": "array", "title": "Items" }, "pagination": { "$ref": "#/components/schemas/Pagination" } }, "type": "object", "required": [ "items", "pagination" ], "title": "ListResource[Dispute]" }, "ListResource_DownloadableRead_": { "properties": { "items": { "items": { "$ref": "#/components/schemas/DownloadableRead" }, "type": "array", "title": "Items" }, "pagination": { "$ref": "#/components/schemas/Pagination" } }, "type": "object", "required": [ "items", "pagination" ], "title": "ListResource[DownloadableRead]" }, "ListResource_EventName_": { "properties": { "items": { "items": { "$ref": "#/components/schemas/EventName" }, "type": "array", "title": "Items" }, "pagination": { "$ref": "#/components/schemas/Pagination" } }, "type": "object", "required": [ "items", "pagination" ], "title": "ListResource[EventName]" }, "ListResource_EventTypeWithStats_": { "properties": { "items": { "items": { "$ref": "#/components/schemas/EventTypeWithStats" }, "type": "array", "title": "Items" }, "pagination": { "$ref": "#/components/schemas/Pagination" } }, "type": "object", "required": [ "items", "pagination" ], "title": "ListResource[EventTypeWithStats]" }, "ListResource_Event_": { "properties": { "items": { "items": { "$ref": "#/components/schemas/Event" }, "type": "array", "title": "Items" }, "pagination": { "$ref": "#/components/schemas/Pagination" } }, "type": "object", "required": [ "items", "pagination" ], "title": "ListResource[Event]" }, "ListResource_FileRead_": { "properties": { "items": { "items": { "oneOf": [ { "$ref": "#/components/schemas/DownloadableFileRead" }, { "$ref": "#/components/schemas/ProductMediaFileRead" }, { "$ref": "#/components/schemas/OrganizationAvatarFileRead" } ], "title": "FileRead", "discriminator": { "propertyName": "service", "mapping": { "downloadable": "#/components/schemas/DownloadableFileRead", "organization_avatar": "#/components/schemas/OrganizationAvatarFileRead", "product_media": "#/components/schemas/ProductMediaFileRead" } } }, "type": "array", "title": "Items" }, "pagination": { "$ref": "#/components/schemas/Pagination" } }, "type": "object", "required": [ "items", "pagination" ], "title": "ListResource[FileRead]" }, "ListResource_LicenseKeyRead_": { "properties": { "items": { "items": { "$ref": "#/components/schemas/LicenseKeyRead" }, "type": "array", "title": "Items" }, "pagination": { "$ref": "#/components/schemas/Pagination" } }, "type": "object", "required": [ "items", "pagination" ], "title": "ListResource[LicenseKeyRead]" }, "ListResource_Member_": { "properties": { "items": { "items": { "$ref": "#/components/schemas/Member" }, "type": "array", "title": "Items" }, "pagination": { "$ref": "#/components/schemas/Pagination" } }, "type": "object", "required": [ "items", "pagination" ], "title": "ListResource[Member]" }, "ListResource_Meter_": { "properties": { "items": { "items": { "$ref": "#/components/schemas/Meter" }, "type": "array", "title": "Items" }, "pagination": { "$ref": "#/components/schemas/Pagination" } }, "type": "object", "required": [ "items", "pagination" ], "title": "ListResource[Meter]" }, "ListResource_Order_": { "properties": { "items": { "items": { "$ref": "#/components/schemas/Order" }, "type": "array", "title": "Items" }, "pagination": { "$ref": "#/components/schemas/Pagination" } }, "type": "object", "required": [ "items", "pagination" ], "title": "ListResource[Order]" }, "ListResource_OrganizationAccessToken_": { "properties": { "items": { "items": { "$ref": "#/components/schemas/OrganizationAccessToken" }, "type": "array", "title": "Items" }, "pagination": { "$ref": "#/components/schemas/Pagination" } }, "type": "object", "required": [ "items", "pagination" ], "title": "ListResource[OrganizationAccessToken]" }, "ListResource_Organization_": { "properties": { "items": { "items": { "$ref": "#/components/schemas/Organization" }, "type": "array", "title": "Items" }, "pagination": { "$ref": "#/components/schemas/Pagination" } }, "type": "object", "required": [ "items", "pagination" ], "title": "ListResource[Organization]" }, "ListResource_Product_": { "properties": { "items": { "items": { "$ref": "#/components/schemas/Product" }, "type": "array", "title": "Items" }, "pagination": { "$ref": "#/components/schemas/Pagination" } }, "type": "object", "required": [ "items", "pagination" ], "title": "ListResource[Product]" }, "ListResource_Refund_": { "properties": { "items": { "items": { "$ref": "#/components/schemas/Refund" }, "type": "array", "title": "Items" }, "pagination": { "$ref": "#/components/schemas/Pagination" } }, "type": "object", "required": [ "items", "pagination" ], "title": "ListResource[Refund]" }, "ListResource_Subscription_": { "properties": { "items": { "items": { "$ref": "#/components/schemas/Subscription" }, "type": "array", "title": "Items" }, "pagination": { "$ref": "#/components/schemas/Pagination" } }, "type": "object", "required": [ "items", "pagination" ], "title": "ListResource[Subscription]" }, "ListResource_WebhookDelivery_": { "properties": { "items": { "items": { "$ref": "#/components/schemas/WebhookDelivery" }, "type": "array", "title": "Items" }, "pagination": { "$ref": "#/components/schemas/Pagination" } }, "type": "object", "required": [ "items", "pagination" ], "title": "ListResource[WebhookDelivery]" }, "ListResource_WebhookEndpoint_": { "properties": { "items": { "items": { "$ref": "#/components/schemas/WebhookEndpoint" }, "type": "array", "title": "Items" }, "pagination": { "$ref": "#/components/schemas/Pagination" } }, "type": "object", "required": [ "items", "pagination" ], "title": "ListResource[WebhookEndpoint]" }, "ListResource__": { "properties": { "items": { "items": { "$ref": "#/components/schemas/Payment" }, "type": "array", "title": "Items" }, "pagination": { "$ref": "#/components/schemas/Pagination" } }, "type": "object", "required": [ "items", "pagination" ], "title": "ListResource[]" }, "Member": { "properties": { "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the member." }, "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "customer_id": { "type": "string", "format": "uuid4", "title": "Customer Id", "description": "The ID of the customer this member belongs to." }, "email": { "type": "string", "title": "Email", "description": "The email address of the member.", "examples": [ "member@example.com" ] }, "name": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Name", "description": "The name of the member.", "examples": [ "Jane Doe" ] }, "external_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "External Id", "description": "The ID of the member in your system. This must be unique within the customer. ", "examples": [ "usr_1337" ] }, "role": { "$ref": "#/components/schemas/MemberRole", "description": "The role of the member within the customer.", "examples": [ "owner" ] } }, "type": "object", "required": [ "id", "created_at", "modified_at", "customer_id", "email", "name", "external_id", "role" ], "title": "Member", "description": "A member of a customer." }, "MemberCreate": { "properties": { "customer_id": { "type": "string", "format": "uuid4", "title": "Customer Id", "description": "The ID of the customer this member belongs to." }, "email": { "type": "string", "format": "email", "title": "Email", "description": "The email address of the member.", "examples": [ "member@example.com" ] }, "name": { "anyOf": [ { "type": "string", "maxLength": 256, "description": "The name of the member.", "examples": [ "Jane Doe" ] }, { "type": "null" } ], "title": "Name" }, "external_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "External Id", "description": "The ID of the member in your system. This must be unique within the customer. ", "examples": [ "usr_1337" ] }, "role": { "$ref": "#/components/schemas/MemberRole", "description": "The role of the member within the customer.", "default": "member", "examples": [ "member" ] } }, "type": "object", "required": [ "customer_id", "email" ], "title": "MemberCreate", "description": "Schema for creating a new member." }, "MemberRole": { "type": "string", "enum": [ "owner", "billing_manager", "member" ], "title": "MemberRole" }, "MemberSortProperty": { "type": "string", "enum": [ "created_at", "-created_at" ], "title": "MemberSortProperty" }, "MemberUpdate": { "properties": { "name": { "anyOf": [ { "type": "string", "maxLength": 256, "description": "The name of the member.", "examples": [ "Jane Doe" ] }, { "type": "null" } ], "title": "Name" }, "role": { "anyOf": [ { "$ref": "#/components/schemas/MemberRole" }, { "type": "null" } ], "description": "The role of the member within the customer.", "examples": [ "member" ] } }, "type": "object", "title": "MemberUpdate", "description": "Schema for updating a member." }, "MetadataOutputType": { "additionalProperties": { "anyOf": [ { "type": "string" }, { "type": "integer" }, { "type": "number" }, { "type": "boolean" } ] }, "type": "object" }, "Meter": { "properties": { "metadata": { "$ref": "#/components/schemas/MetadataOutputType" }, "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "name": { "type": "string", "title": "Name", "description": "The name of the meter. Will be shown on customer's invoices and usage." }, "filter": { "$ref": "#/components/schemas/Filter", "description": "The filter to apply on events that'll be used to calculate the meter." }, "aggregation": { "oneOf": [ { "$ref": "#/components/schemas/CountAggregation" }, { "$ref": "#/components/schemas/PropertyAggregation" }, { "$ref": "#/components/schemas/UniqueAggregation" } ], "title": "Aggregation", "description": "The aggregation to apply on the filtered events to calculate the meter.", "discriminator": { "propertyName": "func", "mapping": { "avg": "#/components/schemas/PropertyAggregation", "count": "#/components/schemas/CountAggregation", "max": "#/components/schemas/PropertyAggregation", "min": "#/components/schemas/PropertyAggregation", "sum": "#/components/schemas/PropertyAggregation", "unique": "#/components/schemas/UniqueAggregation" } } }, "organization_id": { "type": "string", "format": "uuid4", "title": "Organization Id", "description": "The ID of the organization owning the meter." }, "archived_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Archived At", "description": "Whether the meter is archived and the time it was archived." } }, "type": "object", "required": [ "metadata", "created_at", "modified_at", "id", "name", "filter", "aggregation", "organization_id" ], "title": "Meter" }, "MeterCreate": { "properties": { "metadata": { "additionalProperties": { "anyOf": [ { "type": "string", "maxLength": 500, "minLength": 1 }, { "type": "integer" }, { "type": "number" }, { "type": "boolean" } ] }, "propertyNames": { "maxLength": 40, "minLength": 1 }, "type": "object", "maxProperties": 50, "title": "Metadata", "description": "Key-value object allowing you to store additional information.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**." }, "name": { "type": "string", "minLength": 3, "title": "Name", "description": "The name of the meter. Will be shown on customer's invoices and usage." }, "filter": { "$ref": "#/components/schemas/Filter", "description": "The filter to apply on events that'll be used to calculate the meter." }, "aggregation": { "oneOf": [ { "$ref": "#/components/schemas/CountAggregation" }, { "$ref": "#/components/schemas/PropertyAggregation" }, { "$ref": "#/components/schemas/UniqueAggregation" } ], "title": "Aggregation", "description": "The aggregation to apply on the filtered events to calculate the meter.", "discriminator": { "propertyName": "func", "mapping": { "avg": "#/components/schemas/PropertyAggregation", "count": "#/components/schemas/CountAggregation", "max": "#/components/schemas/PropertyAggregation", "min": "#/components/schemas/PropertyAggregation", "sum": "#/components/schemas/PropertyAggregation", "unique": "#/components/schemas/UniqueAggregation" } } }, "organization_id": { "anyOf": [ { "type": "string", "format": "uuid4", "description": "The organization ID.", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "x-polar-selector-widget": { "displayProperty": "name", "resourceName": "Organization", "resourceRoot": "/v1/organizations" } }, { "type": "null" } ], "title": "Organization Id", "description": "The ID of the organization owning the meter. **Required unless you use an organization token.**" } }, "type": "object", "required": [ "name", "filter", "aggregation" ], "title": "MeterCreate" }, "MeterCreditEvent": { "properties": { "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "timestamp": { "type": "string", "format": "date-time", "title": "Timestamp", "description": "The timestamp of the event." }, "organization_id": { "type": "string", "format": "uuid4", "title": "Organization Id", "description": "The ID of the organization owning the event.", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "x-polar-selector-widget": { "displayProperty": "name", "resourceName": "Organization", "resourceRoot": "/v1/organizations" } }, "customer_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Customer Id", "description": "ID of the customer in your Polar organization associated with the event." }, "customer": { "anyOf": [ { "$ref": "#/components/schemas/Customer" }, { "type": "null" } ], "description": "The customer associated with the event." }, "external_customer_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "External Customer Id", "description": "ID of the customer in your system associated with the event." }, "member_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Member Id", "description": "ID of the member within the customer's organization who performed the action inside B2B." }, "external_member_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "External Member Id", "description": "ID of the member in your system within the customer's organization who performed the action inside B2B." }, "child_count": { "type": "integer", "title": "Child Count", "description": "Number of direct child events linked to this event.", "default": 0 }, "parent_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Parent Id", "description": "The ID of the parent event." }, "label": { "type": "string", "title": "Label", "description": "Human readable label of the event type." }, "source": { "type": "string", "const": "system", "title": "Source", "description": "The source of the event. `system` events are created by Polar. `user` events are the one you create through our ingestion API." }, "name": { "type": "string", "const": "meter.credited", "title": "Name", "description": "The name of the event." }, "metadata": { "$ref": "#/components/schemas/MeterCreditedMetadata" } }, "type": "object", "required": [ "id", "timestamp", "organization_id", "customer_id", "customer", "external_customer_id", "label", "source", "name", "metadata" ], "title": "MeterCreditEvent", "description": "An event created by Polar when credits are added to a customer meter." }, "MeterCreditedMetadata": { "properties": { "meter_id": { "type": "string", "title": "Meter Id" }, "units": { "type": "integer", "title": "Units" }, "rollover": { "type": "boolean", "title": "Rollover" } }, "type": "object", "required": [ "meter_id", "units", "rollover" ], "title": "MeterCreditedMetadata" }, "MeterQuantities": { "properties": { "quantities": { "items": { "$ref": "#/components/schemas/MeterQuantity" }, "type": "array", "title": "Quantities" }, "total": { "type": "number", "title": "Total", "description": "The total quantity for the period.", "examples": [ 100 ] } }, "type": "object", "required": [ "quantities", "total" ], "title": "MeterQuantities" }, "MeterQuantity": { "properties": { "timestamp": { "type": "string", "format": "date-time", "title": "Timestamp", "description": "The timestamp for the current period." }, "quantity": { "type": "number", "title": "Quantity", "description": "The quantity for the current period.", "examples": [ 10 ] } }, "type": "object", "required": [ "timestamp", "quantity" ], "title": "MeterQuantity" }, "MeterResetEvent": { "properties": { "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "timestamp": { "type": "string", "format": "date-time", "title": "Timestamp", "description": "The timestamp of the event." }, "organization_id": { "type": "string", "format": "uuid4", "title": "Organization Id", "description": "The ID of the organization owning the event.", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "x-polar-selector-widget": { "displayProperty": "name", "resourceName": "Organization", "resourceRoot": "/v1/organizations" } }, "customer_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Customer Id", "description": "ID of the customer in your Polar organization associated with the event." }, "customer": { "anyOf": [ { "$ref": "#/components/schemas/Customer" }, { "type": "null" } ], "description": "The customer associated with the event." }, "external_customer_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "External Customer Id", "description": "ID of the customer in your system associated with the event." }, "member_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Member Id", "description": "ID of the member within the customer's organization who performed the action inside B2B." }, "external_member_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "External Member Id", "description": "ID of the member in your system within the customer's organization who performed the action inside B2B." }, "child_count": { "type": "integer", "title": "Child Count", "description": "Number of direct child events linked to this event.", "default": 0 }, "parent_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Parent Id", "description": "The ID of the parent event." }, "label": { "type": "string", "title": "Label", "description": "Human readable label of the event type." }, "source": { "type": "string", "const": "system", "title": "Source", "description": "The source of the event. `system` events are created by Polar. `user` events are the one you create through our ingestion API." }, "name": { "type": "string", "const": "meter.reset", "title": "Name", "description": "The name of the event." }, "metadata": { "$ref": "#/components/schemas/MeterResetMetadata" } }, "type": "object", "required": [ "id", "timestamp", "organization_id", "customer_id", "customer", "external_customer_id", "label", "source", "name", "metadata" ], "title": "MeterResetEvent", "description": "An event created by Polar when a customer meter is reset." }, "MeterResetMetadata": { "properties": { "meter_id": { "type": "string", "title": "Meter Id" } }, "type": "object", "required": [ "meter_id" ], "title": "MeterResetMetadata" }, "MeterSortProperty": { "type": "string", "enum": [ "created_at", "-created_at", "name", "-name" ], "title": "MeterSortProperty" }, "MeterUpdate": { "properties": { "metadata": { "additionalProperties": { "anyOf": [ { "type": "string", "maxLength": 500, "minLength": 1 }, { "type": "integer" }, { "type": "number" }, { "type": "boolean" } ] }, "propertyNames": { "maxLength": 40, "minLength": 1 }, "type": "object", "maxProperties": 50, "title": "Metadata", "description": "Key-value object allowing you to store additional information.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**." }, "name": { "anyOf": [ { "type": "string", "minLength": 3 }, { "type": "null" } ], "title": "Name", "description": "The name of the meter. Will be shown on customer's invoices and usage." }, "filter": { "anyOf": [ { "$ref": "#/components/schemas/Filter", "description": "The filter to apply on events that'll be used to calculate the meter." }, { "type": "null" } ], "description": "The filter to apply on events that'll be used to calculate the meter." }, "aggregation": { "anyOf": [ { "oneOf": [ { "$ref": "#/components/schemas/CountAggregation" }, { "$ref": "#/components/schemas/PropertyAggregation" }, { "$ref": "#/components/schemas/UniqueAggregation" } ], "discriminator": { "propertyName": "func", "mapping": { "avg": "#/components/schemas/PropertyAggregation", "count": "#/components/schemas/CountAggregation", "max": "#/components/schemas/PropertyAggregation", "min": "#/components/schemas/PropertyAggregation", "sum": "#/components/schemas/PropertyAggregation", "unique": "#/components/schemas/UniqueAggregation" } } }, { "type": "null" } ], "title": "Aggregation", "description": "The aggregation to apply on the filtered events to calculate the meter." }, "is_archived": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "title": "Is Archived", "description": "Whether the meter is archived. Archived meters are no longer used for billing." } }, "type": "object", "title": "MeterUpdate" }, "Metric": { "properties": { "slug": { "type": "string", "title": "Slug", "description": "Unique identifier for the metric." }, "display_name": { "type": "string", "title": "Display Name", "description": "Human-readable name for the metric." }, "type": { "$ref": "#/components/schemas/MetricType", "description": "Type of the metric, useful to know the unit or format of the value." } }, "type": "object", "required": [ "slug", "display_name", "type" ], "title": "Metric", "description": "Information about a metric." }, "MetricPeriod": { "properties": { "timestamp": { "type": "string", "format": "date-time", "title": "Timestamp", "description": "Timestamp of this period data." }, "active_subscriptions": { "anyOf": [ { "type": "integer" }, { "type": "number" }, { "type": "null" } ], "title": "Active Subscriptions" }, "committed_subscriptions": { "anyOf": [ { "type": "integer" }, { "type": "number" }, { "type": "null" } ], "title": "Committed Subscriptions" }, "monthly_recurring_revenue": { "anyOf": [ { "type": "integer" }, { "type": "number" }, { "type": "null" } ], "title": "Monthly Recurring Revenue" }, "committed_monthly_recurring_revenue": { "anyOf": [ { "type": "integer" }, { "type": "number" }, { "type": "null" } ], "title": "Committed Monthly Recurring Revenue" }, "average_revenue_per_user": { "anyOf": [ { "type": "integer" }, { "type": "number" }, { "type": "null" } ], "title": "Average Revenue Per User" }, "checkouts": { "anyOf": [ { "type": "integer" }, { "type": "number" }, { "type": "null" } ], "title": "Checkouts" }, "succeeded_checkouts": { "anyOf": [ { "type": "integer" }, { "type": "number" }, { "type": "null" } ], "title": "Succeeded Checkouts" }, "checkouts_conversion": { "anyOf": [ { "type": "integer" }, { "type": "number" }, { "type": "null" } ], "title": "Checkouts Conversion" }, "churned_subscriptions": { "anyOf": [ { "type": "integer" }, { "type": "number" }, { "type": "null" } ], "title": "Churned Subscriptions" }, "orders": { "anyOf": [ { "type": "integer" }, { "type": "number" }, { "type": "null" } ], "title": "Orders" }, "revenue": { "anyOf": [ { "type": "integer" }, { "type": "number" }, { "type": "null" } ], "title": "Revenue" }, "net_revenue": { "anyOf": [ { "type": "integer" }, { "type": "number" }, { "type": "null" } ], "title": "Net Revenue" }, "cumulative_revenue": { "anyOf": [ { "type": "integer" }, { "type": "number" }, { "type": "null" } ], "title": "Cumulative Revenue" }, "net_cumulative_revenue": { "anyOf": [ { "type": "integer" }, { "type": "number" }, { "type": "null" } ], "title": "Net Cumulative Revenue" }, "costs": { "anyOf": [ { "type": "integer" }, { "type": "number" }, { "type": "null" } ], "title": "Costs" }, "cumulative_costs": { "anyOf": [ { "type": "integer" }, { "type": "number" }, { "type": "null" } ], "title": "Cumulative Costs" }, "average_order_value": { "anyOf": [ { "type": "integer" }, { "type": "number" }, { "type": "null" } ], "title": "Average Order Value" }, "net_average_order_value": { "anyOf": [ { "type": "integer" }, { "type": "number" }, { "type": "null" } ], "title": "Net Average Order Value" }, "cost_per_user": { "anyOf": [ { "type": "integer" }, { "type": "number" }, { "type": "null" } ], "title": "Cost Per User" }, "active_user_by_event": { "anyOf": [ { "type": "integer" }, { "type": "number" }, { "type": "null" } ], "title": "Active User By Event" }, "one_time_products": { "anyOf": [ { "type": "integer" }, { "type": "number" }, { "type": "null" } ], "title": "One Time Products" }, "one_time_products_revenue": { "anyOf": [ { "type": "integer" }, { "type": "number" }, { "type": "null" } ], "title": "One Time Products Revenue" }, "one_time_products_net_revenue": { "anyOf": [ { "type": "integer" }, { "type": "number" }, { "type": "null" } ], "title": "One Time Products Net Revenue" }, "new_subscriptions": { "anyOf": [ { "type": "integer" }, { "type": "number" }, { "type": "null" } ], "title": "New Subscriptions" }, "new_subscriptions_revenue": { "anyOf": [ { "type": "integer" }, { "type": "number" }, { "type": "null" } ], "title": "New Subscriptions Revenue" }, "new_subscriptions_net_revenue": { "anyOf": [ { "type": "integer" }, { "type": "number" }, { "type": "null" } ], "title": "New Subscriptions Net Revenue" }, "renewed_subscriptions": { "anyOf": [ { "type": "integer" }, { "type": "number" }, { "type": "null" } ], "title": "Renewed Subscriptions" }, "renewed_subscriptions_revenue": { "anyOf": [ { "type": "integer" }, { "type": "number" }, { "type": "null" } ], "title": "Renewed Subscriptions Revenue" }, "renewed_subscriptions_net_revenue": { "anyOf": [ { "type": "integer" }, { "type": "number" }, { "type": "null" } ], "title": "Renewed Subscriptions Net Revenue" }, "canceled_subscriptions": { "anyOf": [ { "type": "integer" }, { "type": "number" }, { "type": "null" } ], "title": "Canceled Subscriptions" }, "canceled_subscriptions_customer_service": { "anyOf": [ { "type": "integer" }, { "type": "number" }, { "type": "null" } ], "title": "Canceled Subscriptions Customer Service" }, "canceled_subscriptions_low_quality": { "anyOf": [ { "type": "integer" }, { "type": "number" }, { "type": "null" } ], "title": "Canceled Subscriptions Low Quality" }, "canceled_subscriptions_missing_features": { "anyOf": [ { "type": "integer" }, { "type": "number" }, { "type": "null" } ], "title": "Canceled Subscriptions Missing Features" }, "canceled_subscriptions_switched_service": { "anyOf": [ { "type": "integer" }, { "type": "number" }, { "type": "null" } ], "title": "Canceled Subscriptions Switched Service" }, "canceled_subscriptions_too_complex": { "anyOf": [ { "type": "integer" }, { "type": "number" }, { "type": "null" } ], "title": "Canceled Subscriptions Too Complex" }, "canceled_subscriptions_too_expensive": { "anyOf": [ { "type": "integer" }, { "type": "number" }, { "type": "null" } ], "title": "Canceled Subscriptions Too Expensive" }, "canceled_subscriptions_unused": { "anyOf": [ { "type": "integer" }, { "type": "number" }, { "type": "null" } ], "title": "Canceled Subscriptions Unused" }, "canceled_subscriptions_other": { "anyOf": [ { "type": "integer" }, { "type": "number" }, { "type": "null" } ], "title": "Canceled Subscriptions Other" }, "churn_rate": { "anyOf": [ { "type": "integer" }, { "type": "number" }, { "type": "null" } ], "title": "Churn Rate" }, "ltv": { "anyOf": [ { "type": "integer" }, { "type": "number" }, { "type": "null" } ], "title": "Ltv" }, "gross_margin": { "anyOf": [ { "type": "integer" }, { "type": "number" }, { "type": "null" } ], "title": "Gross Margin" }, "gross_margin_percentage": { "anyOf": [ { "type": "integer" }, { "type": "number" }, { "type": "null" } ], "title": "Gross Margin Percentage" }, "cashflow": { "anyOf": [ { "type": "integer" }, { "type": "number" }, { "type": "null" } ], "title": "Cashflow" } }, "type": "object", "required": [ "timestamp" ], "title": "MetricPeriod" }, "MetricType": { "type": "string", "enum": [ "scalar", "currency", "currency_sub_cent", "percentage" ], "title": "MetricType" }, "Metrics": { "properties": { "active_subscriptions": { "anyOf": [ { "$ref": "#/components/schemas/Metric" }, { "type": "null" } ] }, "committed_subscriptions": { "anyOf": [ { "$ref": "#/components/schemas/Metric" }, { "type": "null" } ] }, "monthly_recurring_revenue": { "anyOf": [ { "$ref": "#/components/schemas/Metric" }, { "type": "null" } ] }, "committed_monthly_recurring_revenue": { "anyOf": [ { "$ref": "#/components/schemas/Metric" }, { "type": "null" } ] }, "average_revenue_per_user": { "anyOf": [ { "$ref": "#/components/schemas/Metric" }, { "type": "null" } ] }, "checkouts": { "anyOf": [ { "$ref": "#/components/schemas/Metric" }, { "type": "null" } ] }, "succeeded_checkouts": { "anyOf": [ { "$ref": "#/components/schemas/Metric" }, { "type": "null" } ] }, "checkouts_conversion": { "anyOf": [ { "$ref": "#/components/schemas/Metric" }, { "type": "null" } ] }, "churned_subscriptions": { "anyOf": [ { "$ref": "#/components/schemas/Metric" }, { "type": "null" } ] }, "orders": { "anyOf": [ { "$ref": "#/components/schemas/Metric" }, { "type": "null" } ] }, "revenue": { "anyOf": [ { "$ref": "#/components/schemas/Metric" }, { "type": "null" } ] }, "net_revenue": { "anyOf": [ { "$ref": "#/components/schemas/Metric" }, { "type": "null" } ] }, "cumulative_revenue": { "anyOf": [ { "$ref": "#/components/schemas/Metric" }, { "type": "null" } ] }, "net_cumulative_revenue": { "anyOf": [ { "$ref": "#/components/schemas/Metric" }, { "type": "null" } ] }, "costs": { "anyOf": [ { "$ref": "#/components/schemas/Metric" }, { "type": "null" } ] }, "cumulative_costs": { "anyOf": [ { "$ref": "#/components/schemas/Metric" }, { "type": "null" } ] }, "average_order_value": { "anyOf": [ { "$ref": "#/components/schemas/Metric" }, { "type": "null" } ] }, "net_average_order_value": { "anyOf": [ { "$ref": "#/components/schemas/Metric" }, { "type": "null" } ] }, "cost_per_user": { "anyOf": [ { "$ref": "#/components/schemas/Metric" }, { "type": "null" } ] }, "active_user_by_event": { "anyOf": [ { "$ref": "#/components/schemas/Metric" }, { "type": "null" } ] }, "one_time_products": { "anyOf": [ { "$ref": "#/components/schemas/Metric" }, { "type": "null" } ] }, "one_time_products_revenue": { "anyOf": [ { "$ref": "#/components/schemas/Metric" }, { "type": "null" } ] }, "one_time_products_net_revenue": { "anyOf": [ { "$ref": "#/components/schemas/Metric" }, { "type": "null" } ] }, "new_subscriptions": { "anyOf": [ { "$ref": "#/components/schemas/Metric" }, { "type": "null" } ] }, "new_subscriptions_revenue": { "anyOf": [ { "$ref": "#/components/schemas/Metric" }, { "type": "null" } ] }, "new_subscriptions_net_revenue": { "anyOf": [ { "$ref": "#/components/schemas/Metric" }, { "type": "null" } ] }, "renewed_subscriptions": { "anyOf": [ { "$ref": "#/components/schemas/Metric" }, { "type": "null" } ] }, "renewed_subscriptions_revenue": { "anyOf": [ { "$ref": "#/components/schemas/Metric" }, { "type": "null" } ] }, "renewed_subscriptions_net_revenue": { "anyOf": [ { "$ref": "#/components/schemas/Metric" }, { "type": "null" } ] }, "canceled_subscriptions": { "anyOf": [ { "$ref": "#/components/schemas/Metric" }, { "type": "null" } ] }, "canceled_subscriptions_customer_service": { "anyOf": [ { "$ref": "#/components/schemas/Metric" }, { "type": "null" } ] }, "canceled_subscriptions_low_quality": { "anyOf": [ { "$ref": "#/components/schemas/Metric" }, { "type": "null" } ] }, "canceled_subscriptions_missing_features": { "anyOf": [ { "$ref": "#/components/schemas/Metric" }, { "type": "null" } ] }, "canceled_subscriptions_switched_service": { "anyOf": [ { "$ref": "#/components/schemas/Metric" }, { "type": "null" } ] }, "canceled_subscriptions_too_complex": { "anyOf": [ { "$ref": "#/components/schemas/Metric" }, { "type": "null" } ] }, "canceled_subscriptions_too_expensive": { "anyOf": [ { "$ref": "#/components/schemas/Metric" }, { "type": "null" } ] }, "canceled_subscriptions_unused": { "anyOf": [ { "$ref": "#/components/schemas/Metric" }, { "type": "null" } ] }, "canceled_subscriptions_other": { "anyOf": [ { "$ref": "#/components/schemas/Metric" }, { "type": "null" } ] }, "churn_rate": { "anyOf": [ { "$ref": "#/components/schemas/Metric" }, { "type": "null" } ] }, "ltv": { "anyOf": [ { "$ref": "#/components/schemas/Metric" }, { "type": "null" } ] }, "gross_margin": { "anyOf": [ { "$ref": "#/components/schemas/Metric" }, { "type": "null" } ] }, "gross_margin_percentage": { "anyOf": [ { "$ref": "#/components/schemas/Metric" }, { "type": "null" } ] }, "cashflow": { "anyOf": [ { "$ref": "#/components/schemas/Metric" }, { "type": "null" } ] } }, "type": "object", "title": "Metrics" }, "MetricsIntervalLimit": { "properties": { "min_days": { "type": "integer", "title": "Min Days", "description": "Minimum number of days for this interval." }, "max_days": { "type": "integer", "title": "Max Days", "description": "Maximum number of days for this interval." } }, "type": "object", "required": [ "min_days", "max_days" ], "title": "MetricsIntervalLimit", "description": "Date interval limit to get metrics for a given interval." }, "MetricsIntervalsLimits": { "properties": { "hour": { "$ref": "#/components/schemas/MetricsIntervalLimit", "description": "Limits for the hour interval." }, "day": { "$ref": "#/components/schemas/MetricsIntervalLimit", "description": "Limits for the day interval." }, "week": { "$ref": "#/components/schemas/MetricsIntervalLimit", "description": "Limits for the week interval." }, "month": { "$ref": "#/components/schemas/MetricsIntervalLimit", "description": "Limits for the month interval." }, "year": { "$ref": "#/components/schemas/MetricsIntervalLimit", "description": "Limits for the year interval." } }, "type": "object", "required": [ "hour", "day", "week", "month", "year" ], "title": "MetricsIntervalsLimits", "description": "Date interval limits to get metrics for each interval." }, "MetricsLimits": { "properties": { "min_date": { "type": "string", "format": "date", "title": "Min Date", "description": "Minimum date to get metrics." }, "intervals": { "$ref": "#/components/schemas/MetricsIntervalsLimits", "description": "Limits for each interval." } }, "type": "object", "required": [ "min_date", "intervals" ], "title": "MetricsLimits", "description": "Date limits to get metrics." }, "MetricsResponse": { "properties": { "periods": { "items": { "$ref": "#/components/schemas/MetricPeriod" }, "type": "array", "title": "Periods", "description": "List of data for each timestamp." }, "totals": { "$ref": "#/components/schemas/MetricsTotals", "description": "Totals for the whole selected period." }, "metrics": { "$ref": "#/components/schemas/Metrics", "description": "Information about the returned metrics." } }, "type": "object", "required": [ "periods", "totals", "metrics" ], "title": "MetricsResponse", "description": "Metrics response schema." }, "MetricsTotals": { "properties": { "active_subscriptions": { "anyOf": [ { "type": "integer" }, { "type": "number" }, { "type": "null" } ], "title": "Active Subscriptions" }, "committed_subscriptions": { "anyOf": [ { "type": "integer" }, { "type": "number" }, { "type": "null" } ], "title": "Committed Subscriptions" }, "monthly_recurring_revenue": { "anyOf": [ { "type": "integer" }, { "type": "number" }, { "type": "null" } ], "title": "Monthly Recurring Revenue" }, "committed_monthly_recurring_revenue": { "anyOf": [ { "type": "integer" }, { "type": "number" }, { "type": "null" } ], "title": "Committed Monthly Recurring Revenue" }, "average_revenue_per_user": { "anyOf": [ { "type": "integer" }, { "type": "number" }, { "type": "null" } ], "title": "Average Revenue Per User" }, "checkouts": { "anyOf": [ { "type": "integer" }, { "type": "number" }, { "type": "null" } ], "title": "Checkouts" }, "succeeded_checkouts": { "anyOf": [ { "type": "integer" }, { "type": "number" }, { "type": "null" } ], "title": "Succeeded Checkouts" }, "checkouts_conversion": { "anyOf": [ { "type": "integer" }, { "type": "number" }, { "type": "null" } ], "title": "Checkouts Conversion" }, "churned_subscriptions": { "anyOf": [ { "type": "integer" }, { "type": "number" }, { "type": "null" } ], "title": "Churned Subscriptions" }, "orders": { "anyOf": [ { "type": "integer" }, { "type": "number" }, { "type": "null" } ], "title": "Orders" }, "revenue": { "anyOf": [ { "type": "integer" }, { "type": "number" }, { "type": "null" } ], "title": "Revenue" }, "net_revenue": { "anyOf": [ { "type": "integer" }, { "type": "number" }, { "type": "null" } ], "title": "Net Revenue" }, "cumulative_revenue": { "anyOf": [ { "type": "integer" }, { "type": "number" }, { "type": "null" } ], "title": "Cumulative Revenue" }, "net_cumulative_revenue": { "anyOf": [ { "type": "integer" }, { "type": "number" }, { "type": "null" } ], "title": "Net Cumulative Revenue" }, "costs": { "anyOf": [ { "type": "integer" }, { "type": "number" }, { "type": "null" } ], "title": "Costs" }, "cumulative_costs": { "anyOf": [ { "type": "integer" }, { "type": "number" }, { "type": "null" } ], "title": "Cumulative Costs" }, "average_order_value": { "anyOf": [ { "type": "integer" }, { "type": "number" }, { "type": "null" } ], "title": "Average Order Value" }, "net_average_order_value": { "anyOf": [ { "type": "integer" }, { "type": "number" }, { "type": "null" } ], "title": "Net Average Order Value" }, "cost_per_user": { "anyOf": [ { "type": "integer" }, { "type": "number" }, { "type": "null" } ], "title": "Cost Per User" }, "active_user_by_event": { "anyOf": [ { "type": "integer" }, { "type": "number" }, { "type": "null" } ], "title": "Active User By Event" }, "one_time_products": { "anyOf": [ { "type": "integer" }, { "type": "number" }, { "type": "null" } ], "title": "One Time Products" }, "one_time_products_revenue": { "anyOf": [ { "type": "integer" }, { "type": "number" }, { "type": "null" } ], "title": "One Time Products Revenue" }, "one_time_products_net_revenue": { "anyOf": [ { "type": "integer" }, { "type": "number" }, { "type": "null" } ], "title": "One Time Products Net Revenue" }, "new_subscriptions": { "anyOf": [ { "type": "integer" }, { "type": "number" }, { "type": "null" } ], "title": "New Subscriptions" }, "new_subscriptions_revenue": { "anyOf": [ { "type": "integer" }, { "type": "number" }, { "type": "null" } ], "title": "New Subscriptions Revenue" }, "new_subscriptions_net_revenue": { "anyOf": [ { "type": "integer" }, { "type": "number" }, { "type": "null" } ], "title": "New Subscriptions Net Revenue" }, "renewed_subscriptions": { "anyOf": [ { "type": "integer" }, { "type": "number" }, { "type": "null" } ], "title": "Renewed Subscriptions" }, "renewed_subscriptions_revenue": { "anyOf": [ { "type": "integer" }, { "type": "number" }, { "type": "null" } ], "title": "Renewed Subscriptions Revenue" }, "renewed_subscriptions_net_revenue": { "anyOf": [ { "type": "integer" }, { "type": "number" }, { "type": "null" } ], "title": "Renewed Subscriptions Net Revenue" }, "canceled_subscriptions": { "anyOf": [ { "type": "integer" }, { "type": "number" }, { "type": "null" } ], "title": "Canceled Subscriptions" }, "canceled_subscriptions_customer_service": { "anyOf": [ { "type": "integer" }, { "type": "number" }, { "type": "null" } ], "title": "Canceled Subscriptions Customer Service" }, "canceled_subscriptions_low_quality": { "anyOf": [ { "type": "integer" }, { "type": "number" }, { "type": "null" } ], "title": "Canceled Subscriptions Low Quality" }, "canceled_subscriptions_missing_features": { "anyOf": [ { "type": "integer" }, { "type": "number" }, { "type": "null" } ], "title": "Canceled Subscriptions Missing Features" }, "canceled_subscriptions_switched_service": { "anyOf": [ { "type": "integer" }, { "type": "number" }, { "type": "null" } ], "title": "Canceled Subscriptions Switched Service" }, "canceled_subscriptions_too_complex": { "anyOf": [ { "type": "integer" }, { "type": "number" }, { "type": "null" } ], "title": "Canceled Subscriptions Too Complex" }, "canceled_subscriptions_too_expensive": { "anyOf": [ { "type": "integer" }, { "type": "number" }, { "type": "null" } ], "title": "Canceled Subscriptions Too Expensive" }, "canceled_subscriptions_unused": { "anyOf": [ { "type": "integer" }, { "type": "number" }, { "type": "null" } ], "title": "Canceled Subscriptions Unused" }, "canceled_subscriptions_other": { "anyOf": [ { "type": "integer" }, { "type": "number" }, { "type": "null" } ], "title": "Canceled Subscriptions Other" }, "churn_rate": { "anyOf": [ { "type": "integer" }, { "type": "number" }, { "type": "null" } ], "title": "Churn Rate" }, "ltv": { "anyOf": [ { "type": "integer" }, { "type": "number" }, { "type": "null" } ], "title": "Ltv" }, "gross_margin": { "anyOf": [ { "type": "integer" }, { "type": "number" }, { "type": "null" } ], "title": "Gross Margin" }, "gross_margin_percentage": { "anyOf": [ { "type": "integer" }, { "type": "number" }, { "type": "null" } ], "title": "Gross Margin Percentage" }, "cashflow": { "anyOf": [ { "type": "integer" }, { "type": "number" }, { "type": "null" } ], "title": "Cashflow" } }, "type": "object", "title": "MetricsTotals" }, "MissingInvoiceBillingDetails": { "properties": { "error": { "type": "string", "const": "MissingInvoiceBillingDetails", "title": "Error", "examples": [ "MissingInvoiceBillingDetails" ] }, "detail": { "type": "string", "title": "Detail" } }, "type": "object", "required": [ "error", "detail" ], "title": "MissingInvoiceBillingDetails" }, "NotOpenCheckout": { "properties": { "error": { "type": "string", "const": "NotOpenCheckout", "title": "Error", "examples": [ "NotOpenCheckout" ] }, "detail": { "type": "string", "title": "Detail" } }, "type": "object", "required": [ "error", "detail" ], "title": "NotOpenCheckout" }, "NotPaidOrder": { "properties": { "error": { "type": "string", "const": "NotPaidOrder", "title": "Error", "examples": [ "NotPaidOrder" ] }, "detail": { "type": "string", "title": "Detail" } }, "type": "object", "required": [ "error", "detail" ], "title": "NotPaidOrder" }, "NotPermitted": { "properties": { "error": { "type": "string", "const": "NotPermitted", "title": "Error", "examples": [ "NotPermitted" ] }, "detail": { "type": "string", "title": "Detail" } }, "type": "object", "required": [ "error", "detail" ], "title": "NotPermitted" }, "OAuth2ClientConfiguration": { "properties": { "redirect_uris": { "items": { "type": "string", "minLength": 1, "format": "uri" }, "type": "array", "title": "Redirect Uris" }, "token_endpoint_auth_method": { "type": "string", "enum": [ "client_secret_basic", "client_secret_post", "none" ], "title": "Token Endpoint Auth Method", "default": "client_secret_post" }, "grant_types": { "items": { "type": "string", "enum": [ "authorization_code", "refresh_token" ] }, "type": "array", "title": "Grant Types", "default": [ "authorization_code", "refresh_token" ] }, "response_types": { "items": { "type": "string", "const": "code" }, "type": "array", "title": "Response Types", "default": [ "code" ] }, "scope": { "type": "string", "title": "Scope", "default": "openid profile email user:read user:write organizations:read organizations:write custom_fields:read custom_fields:write discounts:read discounts:write checkout_links:read checkout_links:write checkouts:read checkouts:write transactions:read transactions:write payouts:read payouts:write products:read products:write benefits:read benefits:write events:read events:write meters:read meters:write files:read files:write subscriptions:read subscriptions:write customers:read customers:write members:read members:write wallets:read wallets:write disputes:read customer_meters:read customer_sessions:write member_sessions:write customer_seats:read customer_seats:write orders:read orders:write refunds:read refunds:write payments:read metrics:read webhooks:read webhooks:write license_keys:read license_keys:write customer_portal:read customer_portal:write notifications:read notifications:write notification_recipients:read notification_recipients:write organization_access_tokens:read organization_access_tokens:write" }, "client_name": { "type": "string", "title": "Client Name" }, "client_uri": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Client Uri" }, "logo_uri": { "anyOf": [ { "type": "string", "maxLength": 2083, "minLength": 1, "format": "uri" }, { "type": "null" } ], "title": "Logo Uri" }, "tos_uri": { "anyOf": [ { "type": "string", "maxLength": 2083, "minLength": 1, "format": "uri" }, { "type": "null" } ], "title": "Tos Uri" }, "policy_uri": { "anyOf": [ { "type": "string", "maxLength": 2083, "minLength": 1, "format": "uri" }, { "type": "null" } ], "title": "Policy Uri" }, "default_sub_type": { "$ref": "#/components/schemas/SubType", "default": "organization" } }, "type": "object", "required": [ "redirect_uris", "client_name" ], "title": "OAuth2ClientConfiguration" }, "OAuth2ClientConfigurationUpdate": { "properties": { "redirect_uris": { "items": { "type": "string", "minLength": 1, "format": "uri" }, "type": "array", "title": "Redirect Uris" }, "token_endpoint_auth_method": { "type": "string", "enum": [ "client_secret_basic", "client_secret_post", "none" ], "title": "Token Endpoint Auth Method", "default": "client_secret_post" }, "grant_types": { "items": { "type": "string", "enum": [ "authorization_code", "refresh_token" ] }, "type": "array", "title": "Grant Types", "default": [ "authorization_code", "refresh_token" ] }, "response_types": { "items": { "type": "string", "const": "code" }, "type": "array", "title": "Response Types", "default": [ "code" ] }, "scope": { "type": "string", "title": "Scope", "default": "openid profile email user:read user:write organizations:read organizations:write custom_fields:read custom_fields:write discounts:read discounts:write checkout_links:read checkout_links:write checkouts:read checkouts:write transactions:read transactions:write payouts:read payouts:write products:read products:write benefits:read benefits:write events:read events:write meters:read meters:write files:read files:write subscriptions:read subscriptions:write customers:read customers:write members:read members:write wallets:read wallets:write disputes:read customer_meters:read customer_sessions:write member_sessions:write customer_seats:read customer_seats:write orders:read orders:write refunds:read refunds:write payments:read metrics:read webhooks:read webhooks:write license_keys:read license_keys:write customer_portal:read customer_portal:write notifications:read notifications:write notification_recipients:read notification_recipients:write organization_access_tokens:read organization_access_tokens:write" }, "client_name": { "type": "string", "title": "Client Name" }, "client_uri": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Client Uri" }, "logo_uri": { "anyOf": [ { "type": "string", "maxLength": 2083, "minLength": 1, "format": "uri" }, { "type": "null" } ], "title": "Logo Uri" }, "tos_uri": { "anyOf": [ { "type": "string", "maxLength": 2083, "minLength": 1, "format": "uri" }, { "type": "null" } ], "title": "Tos Uri" }, "policy_uri": { "anyOf": [ { "type": "string", "maxLength": 2083, "minLength": 1, "format": "uri" }, { "type": "null" } ], "title": "Policy Uri" }, "default_sub_type": { "$ref": "#/components/schemas/SubType", "default": "organization" }, "client_id": { "type": "string", "title": "Client Id" } }, "type": "object", "required": [ "redirect_uris", "client_name", "client_id" ], "title": "OAuth2ClientConfigurationUpdate" }, "OAuth2ClientPublic": { "properties": { "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "client_id": { "type": "string", "title": "Client Id" }, "client_name": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Client Name" }, "client_uri": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Client Uri" }, "logo_uri": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Logo Uri" }, "tos_uri": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Tos Uri" }, "policy_uri": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Policy Uri" } }, "type": "object", "required": [ "created_at", "modified_at", "client_id", "client_name", "client_uri", "logo_uri", "tos_uri", "policy_uri" ], "title": "OAuth2ClientPublic" }, "Order": { "properties": { "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "status": { "$ref": "#/components/schemas/OrderStatus", "examples": [ "paid" ] }, "paid": { "type": "boolean", "title": "Paid", "description": "Whether the order has been paid for.", "examples": [ true ] }, "subtotal_amount": { "type": "integer", "title": "Subtotal Amount", "description": "Amount in cents, before discounts and taxes.", "examples": [ 10000 ] }, "discount_amount": { "type": "integer", "title": "Discount Amount", "description": "Discount amount in cents.", "examples": [ 1000 ] }, "net_amount": { "type": "integer", "title": "Net Amount", "description": "Amount in cents, after discounts but before taxes.", "examples": [ 9000 ] }, "tax_amount": { "type": "integer", "title": "Tax Amount", "description": "Sales tax amount in cents.", "examples": [ 720 ] }, "total_amount": { "type": "integer", "title": "Total Amount", "description": "Amount in cents, after discounts and taxes.", "examples": [ 9720 ] }, "applied_balance_amount": { "type": "integer", "title": "Applied Balance Amount", "description": "Customer's balance amount applied to this invoice. Can increase the total amount paid, if the customer has a negative balance, or decrease it, if the customer has a positive balance.Amount in cents.", "examples": [ 0 ] }, "due_amount": { "type": "integer", "title": "Due Amount", "description": "Amount in cents that is due for this order.", "examples": [ 0 ] }, "refunded_amount": { "type": "integer", "title": "Refunded Amount", "description": "Amount refunded in cents.", "examples": [ 0 ] }, "refunded_tax_amount": { "type": "integer", "title": "Refunded Tax Amount", "description": "Sales tax refunded in cents.", "examples": [ 0 ] }, "currency": { "type": "string", "title": "Currency", "examples": [ "usd" ] }, "billing_reason": { "$ref": "#/components/schemas/OrderBillingReason" }, "billing_name": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Billing Name", "description": "The name of the customer that should appear on the invoice. " }, "billing_address": { "anyOf": [ { "$ref": "#/components/schemas/Address" }, { "type": "null" } ] }, "invoice_number": { "type": "string", "title": "Invoice Number", "description": "The invoice number associated with this order." }, "is_invoice_generated": { "type": "boolean", "title": "Is Invoice Generated", "description": "Whether an invoice has been generated for this order." }, "seats": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Seats", "description": "Number of seats purchased (for seat-based one-time orders)." }, "customer_id": { "type": "string", "format": "uuid4", "title": "Customer Id" }, "product_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Product Id" }, "discount_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Discount Id" }, "subscription_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Subscription Id" }, "checkout_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Checkout Id" }, "metadata": { "$ref": "#/components/schemas/MetadataOutputType" }, "custom_field_data": { "additionalProperties": { "anyOf": [ { "type": "string" }, { "type": "integer" }, { "type": "boolean" }, { "type": "string", "format": "date-time" }, { "type": "null" } ] }, "type": "object", "title": "Custom Field Data", "description": "Key-value object storing custom field values." }, "platform_fee_amount": { "type": "integer", "title": "Platform Fee Amount", "description": "Platform fee amount in cents.", "examples": [ 500 ] }, "platform_fee_currency": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Platform Fee Currency", "description": "Currency of the platform fee.", "examples": [ "usd" ] }, "customer": { "$ref": "#/components/schemas/OrderCustomer" }, "product": { "anyOf": [ { "$ref": "#/components/schemas/OrderProduct" }, { "type": "null" } ] }, "discount": { "anyOf": [ { "oneOf": [ { "$ref": "#/components/schemas/DiscountFixedOnceForeverDurationBase" }, { "$ref": "#/components/schemas/DiscountFixedRepeatDurationBase" }, { "$ref": "#/components/schemas/DiscountPercentageOnceForeverDurationBase" }, { "$ref": "#/components/schemas/DiscountPercentageRepeatDurationBase" } ], "title": "OrderDiscount" }, { "type": "null" } ], "title": "Discount" }, "subscription": { "anyOf": [ { "$ref": "#/components/schemas/OrderSubscription" }, { "type": "null" } ] }, "items": { "items": { "$ref": "#/components/schemas/OrderItemSchema" }, "type": "array", "title": "Items", "description": "Line items composing the order." }, "description": { "type": "string", "title": "Description", "description": "A summary description of the order.", "examples": [ "Pro Plan" ] } }, "type": "object", "required": [ "id", "created_at", "modified_at", "status", "paid", "subtotal_amount", "discount_amount", "net_amount", "tax_amount", "total_amount", "applied_balance_amount", "due_amount", "refunded_amount", "refunded_tax_amount", "currency", "billing_reason", "billing_name", "billing_address", "invoice_number", "is_invoice_generated", "customer_id", "product_id", "discount_id", "subscription_id", "checkout_id", "metadata", "platform_fee_amount", "platform_fee_currency", "customer", "product", "discount", "subscription", "items", "description" ], "title": "Order" }, "OrderBillingReason": { "type": "string", "enum": [ "purchase", "subscription_create", "subscription_cycle", "subscription_update" ], "title": "OrderBillingReason" }, "OrderBillingReasonInternal": { "type": "string", "enum": [ "purchase", "subscription_create", "subscription_cycle", "subscription_cycle_after_trial", "subscription_update" ], "title": "OrderBillingReasonInternal", "description": "Internal billing reasons with additional granularity." }, "OrderCustomer": { "properties": { "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the customer.", "examples": [ "992fae2a-2a17-4b7a-8d9e-e287cf90131b" ] }, "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "metadata": { "$ref": "#/components/schemas/MetadataOutputType" }, "external_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "External Id", "description": "The ID of the customer in your system. This must be unique within the organization. Once set, it can't be updated.", "examples": [ "usr_1337" ] }, "email": { "type": "string", "title": "Email", "description": "The email address of the customer. This must be unique within the organization.", "examples": [ "customer@example.com" ] }, "email_verified": { "type": "boolean", "title": "Email Verified", "description": "Whether the customer email address is verified. The address is automatically verified when the customer accesses the customer portal using their email address.", "examples": [ true ] }, "type": { "anyOf": [ { "$ref": "#/components/schemas/CustomerType" }, { "type": "null" } ], "description": "The type of customer: 'individual' for single users, 'team' for customers with multiple members. Legacy customers may have NULL type which is treated as 'individual'.", "examples": [ "individual" ] }, "name": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Name", "description": "The name of the customer.", "examples": [ "John Doe" ] }, "billing_address": { "anyOf": [ { "$ref": "#/components/schemas/Address" }, { "type": "null" } ] }, "tax_id": { "anyOf": [ { "prefixItems": [ { "type": "string" }, { "$ref": "#/components/schemas/TaxIDFormat" } ], "type": "array", "maxItems": 2, "minItems": 2, "examples": [ [ "911144442", "us_ein" ], [ "FR61954506077", "eu_vat" ] ] }, { "type": "null" } ], "title": "Tax Id" }, "locale": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Locale" }, "organization_id": { "type": "string", "format": "uuid4", "title": "Organization Id", "description": "The ID of the organization owning the customer.", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ] }, "deleted_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Deleted At", "description": "Timestamp for when the customer was soft deleted." }, "avatar_url": { "type": "string", "title": "Avatar Url", "examples": [ "https://www.gravatar.com/avatar/xxx?d=404" ] } }, "type": "object", "required": [ "id", "created_at", "modified_at", "metadata", "email", "email_verified", "name", "billing_address", "tax_id", "organization_id", "deleted_at", "avatar_url" ], "title": "OrderCustomer" }, "OrderInvoice": { "properties": { "url": { "type": "string", "title": "Url", "description": "The URL to the invoice." } }, "type": "object", "required": [ "url" ], "title": "OrderInvoice", "description": "Order's invoice data." }, "OrderItemSchema": { "properties": { "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "label": { "type": "string", "title": "Label", "description": "Description of the line item charge.", "examples": [ "Pro Plan" ] }, "amount": { "type": "integer", "title": "Amount", "description": "Amount in cents, before discounts and taxes.", "examples": [ 10000 ] }, "tax_amount": { "type": "integer", "title": "Tax Amount", "description": "Sales tax amount in cents.", "examples": [ 720 ] }, "proration": { "type": "boolean", "title": "Proration", "description": "Whether this charge is due to a proration.", "examples": [ false ] }, "product_price_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Product Price Id", "description": "Associated price ID, if any." } }, "type": "object", "required": [ "created_at", "modified_at", "id", "label", "amount", "tax_amount", "proration", "product_price_id" ], "title": "OrderItemSchema", "description": "An order line item." }, "OrderNotEligibleForRetry": { "properties": { "error": { "type": "string", "const": "OrderNotEligibleForRetry", "title": "Error", "examples": [ "OrderNotEligibleForRetry" ] }, "detail": { "type": "string", "title": "Detail" } }, "type": "object", "required": [ "error", "detail" ], "title": "OrderNotEligibleForRetry" }, "OrderPaidEvent": { "properties": { "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "timestamp": { "type": "string", "format": "date-time", "title": "Timestamp", "description": "The timestamp of the event." }, "organization_id": { "type": "string", "format": "uuid4", "title": "Organization Id", "description": "The ID of the organization owning the event.", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "x-polar-selector-widget": { "displayProperty": "name", "resourceName": "Organization", "resourceRoot": "/v1/organizations" } }, "customer_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Customer Id", "description": "ID of the customer in your Polar organization associated with the event." }, "customer": { "anyOf": [ { "$ref": "#/components/schemas/Customer" }, { "type": "null" } ], "description": "The customer associated with the event." }, "external_customer_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "External Customer Id", "description": "ID of the customer in your system associated with the event." }, "member_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Member Id", "description": "ID of the member within the customer's organization who performed the action inside B2B." }, "external_member_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "External Member Id", "description": "ID of the member in your system within the customer's organization who performed the action inside B2B." }, "child_count": { "type": "integer", "title": "Child Count", "description": "Number of direct child events linked to this event.", "default": 0 }, "parent_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Parent Id", "description": "The ID of the parent event." }, "label": { "type": "string", "title": "Label", "description": "Human readable label of the event type." }, "source": { "type": "string", "const": "system", "title": "Source", "description": "The source of the event. `system` events are created by Polar. `user` events are the one you create through our ingestion API." }, "name": { "type": "string", "const": "order.paid", "title": "Name", "description": "The name of the event." }, "metadata": { "$ref": "#/components/schemas/OrderPaidMetadata" } }, "type": "object", "required": [ "id", "timestamp", "organization_id", "customer_id", "customer", "external_customer_id", "label", "source", "name", "metadata" ], "title": "OrderPaidEvent", "description": "An event created by Polar when an order is paid." }, "OrderPaidMetadata": { "properties": { "order_id": { "type": "string", "title": "Order Id" }, "product_id": { "type": "string", "title": "Product Id" }, "billing_type": { "type": "string", "title": "Billing Type" }, "amount": { "type": "integer", "title": "Amount" }, "currency": { "type": "string", "title": "Currency" }, "net_amount": { "type": "integer", "title": "Net Amount" }, "tax_amount": { "type": "integer", "title": "Tax Amount" }, "applied_balance_amount": { "type": "integer", "title": "Applied Balance Amount" }, "discount_amount": { "type": "integer", "title": "Discount Amount" }, "discount_id": { "type": "string", "title": "Discount Id" }, "platform_fee": { "type": "integer", "title": "Platform Fee" }, "subscription_id": { "type": "string", "title": "Subscription Id" }, "recurring_interval": { "type": "string", "title": "Recurring Interval" }, "recurring_interval_count": { "type": "integer", "title": "Recurring Interval Count" } }, "type": "object", "required": [ "order_id", "amount" ], "title": "OrderPaidMetadata" }, "OrderProduct": { "properties": { "metadata": { "$ref": "#/components/schemas/MetadataOutputType" }, "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "trial_interval": { "anyOf": [ { "$ref": "#/components/schemas/TrialInterval" }, { "type": "null" } ], "description": "The interval unit for the trial period." }, "trial_interval_count": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Trial Interval Count", "description": "The number of interval units for the trial period." }, "name": { "type": "string", "title": "Name", "description": "The name of the product." }, "description": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Description", "description": "The description of the product." }, "visibility": { "$ref": "#/components/schemas/ProductVisibility", "description": "The visibility of the product." }, "recurring_interval": { "anyOf": [ { "$ref": "#/components/schemas/SubscriptionRecurringInterval" }, { "type": "null" } ], "description": "The recurring interval of the product. If `None`, the product is a one-time purchase." }, "recurring_interval_count": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Recurring Interval Count", "description": "Number of interval units of the subscription. If this is set to 1 the charge will happen every interval (e.g. every month), if set to 2 it will be every other month, and so on. None for one-time products." }, "is_recurring": { "type": "boolean", "title": "Is Recurring", "description": "Whether the product is a subscription." }, "is_archived": { "type": "boolean", "title": "Is Archived", "description": "Whether the product is archived and no longer available." }, "organization_id": { "type": "string", "format": "uuid4", "title": "Organization Id", "description": "The ID of the organization owning the product." } }, "type": "object", "required": [ "metadata", "id", "created_at", "modified_at", "trial_interval", "trial_interval_count", "name", "description", "visibility", "recurring_interval", "recurring_interval_count", "is_recurring", "is_archived", "organization_id" ], "title": "OrderProduct" }, "OrderRefundedEvent": { "properties": { "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "timestamp": { "type": "string", "format": "date-time", "title": "Timestamp", "description": "The timestamp of the event." }, "organization_id": { "type": "string", "format": "uuid4", "title": "Organization Id", "description": "The ID of the organization owning the event.", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "x-polar-selector-widget": { "displayProperty": "name", "resourceName": "Organization", "resourceRoot": "/v1/organizations" } }, "customer_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Customer Id", "description": "ID of the customer in your Polar organization associated with the event." }, "customer": { "anyOf": [ { "$ref": "#/components/schemas/Customer" }, { "type": "null" } ], "description": "The customer associated with the event." }, "external_customer_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "External Customer Id", "description": "ID of the customer in your system associated with the event." }, "member_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Member Id", "description": "ID of the member within the customer's organization who performed the action inside B2B." }, "external_member_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "External Member Id", "description": "ID of the member in your system within the customer's organization who performed the action inside B2B." }, "child_count": { "type": "integer", "title": "Child Count", "description": "Number of direct child events linked to this event.", "default": 0 }, "parent_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Parent Id", "description": "The ID of the parent event." }, "label": { "type": "string", "title": "Label", "description": "Human readable label of the event type." }, "source": { "type": "string", "const": "system", "title": "Source", "description": "The source of the event. `system` events are created by Polar. `user` events are the one you create through our ingestion API." }, "name": { "type": "string", "const": "order.refunded", "title": "Name", "description": "The name of the event." }, "metadata": { "$ref": "#/components/schemas/OrderRefundedMetadata" } }, "type": "object", "required": [ "id", "timestamp", "organization_id", "customer_id", "customer", "external_customer_id", "label", "source", "name", "metadata" ], "title": "OrderRefundedEvent", "description": "An event created by Polar when an order is refunded." }, "OrderRefundedMetadata": { "properties": { "order_id": { "type": "string", "title": "Order Id" }, "refunded_amount": { "type": "integer", "title": "Refunded Amount" }, "currency": { "type": "string", "title": "Currency" } }, "type": "object", "required": [ "order_id", "refunded_amount", "currency" ], "title": "OrderRefundedMetadata" }, "OrderSortProperty": { "type": "string", "enum": [ "created_at", "-created_at", "status", "-status", "invoice_number", "-invoice_number", "amount", "-amount", "net_amount", "-net_amount", "customer", "-customer", "product", "-product", "discount", "-discount", "subscription", "-subscription" ], "title": "OrderSortProperty" }, "OrderStatus": { "type": "string", "enum": [ "pending", "paid", "refunded", "partially_refunded", "void" ], "title": "OrderStatus" }, "OrderSubscription": { "properties": { "metadata": { "$ref": "#/components/schemas/MetadataOutputType" }, "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "amount": { "type": "integer", "title": "Amount", "description": "The amount of the subscription.", "examples": [ 10000 ] }, "currency": { "type": "string", "title": "Currency", "description": "The currency of the subscription.", "examples": [ "usd" ] }, "recurring_interval": { "$ref": "#/components/schemas/SubscriptionRecurringInterval", "description": "The interval at which the subscription recurs.", "examples": [ "month" ] }, "recurring_interval_count": { "type": "integer", "title": "Recurring Interval Count", "description": "Number of interval units of the subscription. If this is set to 1 the charge will happen every interval (e.g. every month), if set to 2 it will be every other month, and so on." }, "status": { "$ref": "#/components/schemas/SubscriptionStatus", "description": "The status of the subscription.", "examples": [ "active" ] }, "current_period_start": { "type": "string", "format": "date-time", "title": "Current Period Start", "description": "The start timestamp of the current billing period." }, "current_period_end": { "type": "string", "format": "date-time", "title": "Current Period End", "description": "The end timestamp of the current billing period." }, "trial_start": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Trial Start", "description": "The start timestamp of the trial period, if any." }, "trial_end": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Trial End", "description": "The end timestamp of the trial period, if any." }, "cancel_at_period_end": { "type": "boolean", "title": "Cancel At Period End", "description": "Whether the subscription will be canceled at the end of the current period." }, "canceled_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Canceled At", "description": "The timestamp when the subscription was canceled. The subscription might still be active if `cancel_at_period_end` is `true`." }, "started_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Started At", "description": "The timestamp when the subscription started." }, "ends_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Ends At", "description": "The timestamp when the subscription will end." }, "ended_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Ended At", "description": "The timestamp when the subscription ended." }, "customer_id": { "type": "string", "format": "uuid4", "title": "Customer Id", "description": "The ID of the subscribed customer." }, "product_id": { "type": "string", "format": "uuid4", "title": "Product Id", "description": "The ID of the subscribed product." }, "discount_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Discount Id", "description": "The ID of the applied discount, if any." }, "checkout_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Checkout Id" }, "seats": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Seats", "description": "The number of seats for seat-based subscriptions. None for non-seat subscriptions." }, "customer_cancellation_reason": { "anyOf": [ { "$ref": "#/components/schemas/CustomerCancellationReason" }, { "type": "null" } ] }, "customer_cancellation_comment": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Customer Cancellation Comment" } }, "type": "object", "required": [ "metadata", "created_at", "modified_at", "id", "amount", "currency", "recurring_interval", "recurring_interval_count", "status", "current_period_start", "current_period_end", "trial_start", "trial_end", "cancel_at_period_end", "canceled_at", "started_at", "ends_at", "ended_at", "customer_id", "product_id", "discount_id", "checkout_id", "customer_cancellation_reason", "customer_cancellation_comment" ], "title": "OrderSubscription" }, "OrderUpdate": { "properties": { "billing_name": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Billing Name", "description": "The name of the customer that should appear on the invoice." }, "billing_address": { "anyOf": [ { "$ref": "#/components/schemas/AddressInput" }, { "type": "null" } ], "description": "The address of the customer that should appear on the invoice. Country and state fields cannot be updated." } }, "type": "object", "title": "OrderUpdate", "description": "Schema to update an order." }, "OrderUser": { "properties": { "id": { "type": "string", "format": "uuid4", "title": "Id" }, "email": { "type": "string", "title": "Email" }, "public_name": { "type": "string", "title": "Public Name" }, "avatar_url": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Avatar Url" }, "github_username": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Github Username" } }, "type": "object", "required": [ "id", "email", "public_name" ], "title": "OrderUser" }, "Organization": { "properties": { "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "name": { "type": "string", "title": "Name", "description": "Organization name shown in checkout, customer portal, emails etc." }, "slug": { "type": "string", "title": "Slug", "description": "Unique organization slug in checkout, customer portal and credit card statements." }, "avatar_url": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Avatar Url", "description": "Avatar URL shown in checkout, customer portal, emails etc." }, "proration_behavior": { "$ref": "#/components/schemas/SubscriptionProrationBehavior", "description": "Proration behavior applied when customer updates their subscription from the portal." }, "allow_customer_updates": { "type": "boolean", "title": "Allow Customer Updates", "description": "Whether customers can update their subscriptions from the customer portal." }, "email": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Email", "description": "Public support email." }, "website": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Website", "description": "Official website of the organization." }, "socials": { "items": { "$ref": "#/components/schemas/OrganizationSocialLink" }, "type": "array", "title": "Socials", "description": "Links to social profiles." }, "status": { "$ref": "#/components/schemas/OrganizationStatus", "description": "Current organization status" }, "details_submitted_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Details Submitted At", "description": "When the business details were submitted." }, "default_presentment_currency": { "type": "string", "title": "Default Presentment Currency", "description": "Default presentment currency. Used as fallback in checkout and customer portal, if the customer's local currency is not available." }, "feature_settings": { "anyOf": [ { "$ref": "#/components/schemas/OrganizationFeatureSettings" }, { "type": "null" } ], "description": "Organization feature settings" }, "subscription_settings": { "$ref": "#/components/schemas/OrganizationSubscriptionSettings", "description": "Settings related to subscriptions management" }, "notification_settings": { "$ref": "#/components/schemas/OrganizationNotificationSettings", "description": "Settings related to notifications" }, "customer_email_settings": { "$ref": "#/components/schemas/OrganizationCustomerEmailSettings", "description": "Settings related to customer emails" }, "customer_portal_settings": { "$ref": "#/components/schemas/OrganizationCustomerPortalSettings", "description": "Settings related to the customer portal" } }, "type": "object", "required": [ "created_at", "modified_at", "id", "name", "slug", "avatar_url", "proration_behavior", "allow_customer_updates", "email", "website", "socials", "status", "details_submitted_at", "default_presentment_currency", "feature_settings", "subscription_settings", "notification_settings", "customer_email_settings", "customer_portal_settings" ], "title": "Organization" }, "OrganizationAccessToken": { "properties": { "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "id": { "type": "string", "format": "uuid4", "title": "Id" }, "scopes": { "items": { "$ref": "#/components/schemas/Scope" }, "type": "array", "title": "Scopes" }, "expires_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Expires At" }, "comment": { "type": "string", "title": "Comment" }, "last_used_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Last Used At" }, "organization_id": { "type": "string", "format": "uuid4", "title": "Organization Id", "description": "The organization ID.", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "x-polar-selector-widget": { "displayProperty": "name", "resourceName": "Organization", "resourceRoot": "/v1/organizations" } } }, "type": "object", "required": [ "created_at", "modified_at", "id", "scopes", "expires_at", "comment", "last_used_at", "organization_id" ], "title": "OrganizationAccessToken" }, "OrganizationAccessTokenCreate": { "properties": { "organization_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Organization Id" }, "comment": { "type": "string", "title": "Comment" }, "expires_in": { "anyOf": [ { "type": "string", "format": "duration" }, { "type": "null" } ], "title": "Expires In" }, "scopes": { "items": { "$ref": "#/components/schemas/AvailableScope" }, "type": "array", "title": "Scopes" } }, "type": "object", "required": [ "comment", "scopes" ], "title": "OrganizationAccessTokenCreate" }, "OrganizationAccessTokenCreateResponse": { "properties": { "organization_access_token": { "$ref": "#/components/schemas/OrganizationAccessToken" }, "token": { "type": "string", "title": "Token" } }, "type": "object", "required": [ "organization_access_token", "token" ], "title": "OrganizationAccessTokenCreateResponse" }, "OrganizationAccessTokenSortProperty": { "type": "string", "enum": [ "created_at", "-created_at", "comment", "-comment", "last_used_at", "-last_used_at", "organization_id", "-organization_id" ], "title": "OrganizationAccessTokenSortProperty" }, "OrganizationAccessTokenUpdate": { "properties": { "comment": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Comment" }, "scopes": { "anyOf": [ { "items": { "$ref": "#/components/schemas/AvailableScope" }, "type": "array" }, { "type": "null" } ], "title": "Scopes" } }, "type": "object", "title": "OrganizationAccessTokenUpdate" }, "OrganizationAvatarFileCreate": { "properties": { "organization_id": { "anyOf": [ { "type": "string", "format": "uuid4", "description": "The organization ID.", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "x-polar-selector-widget": { "displayProperty": "name", "resourceName": "Organization", "resourceRoot": "/v1/organizations" } }, { "type": "null" } ], "title": "Organization Id" }, "name": { "type": "string", "title": "Name" }, "mime_type": { "type": "string", "pattern": "^image\\/(jpeg|png|gif|webp|svg\\+xml)$", "title": "Mime Type", "description": "MIME type of the file. Only images are supported for this type of file." }, "size": { "type": "integer", "maximum": 1048576, "title": "Size", "description": "Size of the file. A maximum of 1 MB is allowed for this type of file." }, "checksum_sha256_base64": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Checksum Sha256 Base64" }, "upload": { "$ref": "#/components/schemas/S3FileCreateMultipart" }, "service": { "type": "string", "const": "organization_avatar", "title": "Service" }, "version": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Version" } }, "type": "object", "required": [ "name", "mime_type", "size", "upload", "service" ], "title": "OrganizationAvatarFileCreate", "description": "Schema to create a file to be used as an organization avatar." }, "OrganizationAvatarFileRead": { "properties": { "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "organization_id": { "type": "string", "format": "uuid4", "title": "Organization Id" }, "name": { "type": "string", "title": "Name" }, "path": { "type": "string", "title": "Path" }, "mime_type": { "type": "string", "title": "Mime Type" }, "size": { "type": "integer", "title": "Size" }, "storage_version": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Storage Version" }, "checksum_etag": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Checksum Etag" }, "checksum_sha256_base64": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Checksum Sha256 Base64" }, "checksum_sha256_hex": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Checksum Sha256 Hex" }, "last_modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Last Modified At" }, "version": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Version" }, "service": { "type": "string", "const": "organization_avatar", "title": "Service" }, "is_uploaded": { "type": "boolean", "title": "Is Uploaded" }, "created_at": { "type": "string", "format": "date-time", "title": "Created At" }, "size_readable": { "type": "string", "title": "Size Readable" }, "public_url": { "type": "string", "title": "Public Url" } }, "type": "object", "required": [ "id", "organization_id", "name", "path", "mime_type", "size", "storage_version", "checksum_etag", "checksum_sha256_base64", "checksum_sha256_hex", "last_modified_at", "version", "service", "is_uploaded", "created_at", "size_readable", "public_url" ], "title": "OrganizationAvatarFileRead", "description": "File to be used as an organization avatar." }, "OrganizationCreate": { "properties": { "name": { "type": "string", "minLength": 3, "title": "Name" }, "slug": { "type": "string", "minLength": 3, "title": "Slug" }, "avatar_url": { "anyOf": [ { "type": "string", "maxLength": 2083, "minLength": 1, "format": "uri" }, { "type": "null" } ], "title": "Avatar Url" }, "email": { "anyOf": [ { "type": "string", "format": "email" }, { "type": "null" } ], "title": "Email", "description": "Public support email." }, "website": { "anyOf": [ { "type": "string", "maxLength": 2083, "minLength": 1, "format": "uri" }, { "type": "null" } ], "title": "Website", "description": "Official website of the organization." }, "socials": { "anyOf": [ { "items": { "$ref": "#/components/schemas/OrganizationSocialLink" }, "type": "array" }, { "type": "null" } ], "title": "Socials", "description": "Link to social profiles." }, "details": { "anyOf": [ { "$ref": "#/components/schemas/OrganizationDetails" }, { "type": "null" } ], "description": "Additional, private, business details Polar needs about active organizations for compliance (KYC)." }, "feature_settings": { "anyOf": [ { "$ref": "#/components/schemas/OrganizationFeatureSettings" }, { "type": "null" } ] }, "subscription_settings": { "anyOf": [ { "$ref": "#/components/schemas/OrganizationSubscriptionSettings" }, { "type": "null" } ] }, "notification_settings": { "anyOf": [ { "$ref": "#/components/schemas/OrganizationNotificationSettings" }, { "type": "null" } ] }, "customer_email_settings": { "anyOf": [ { "$ref": "#/components/schemas/OrganizationCustomerEmailSettings" }, { "type": "null" } ] }, "customer_portal_settings": { "anyOf": [ { "$ref": "#/components/schemas/OrganizationCustomerPortalSettings" }, { "type": "null" } ] }, "default_presentment_currency": { "$ref": "#/components/schemas/PresentmentCurrency", "description": "Default presentment currency for the organization", "default": "usd" } }, "type": "object", "required": [ "name", "slug" ], "title": "OrganizationCreate" }, "OrganizationCustomerEmailSettings": { "properties": { "order_confirmation": { "type": "boolean", "title": "Order Confirmation" }, "subscription_cancellation": { "type": "boolean", "title": "Subscription Cancellation" }, "subscription_confirmation": { "type": "boolean", "title": "Subscription Confirmation" }, "subscription_cycled": { "type": "boolean", "title": "Subscription Cycled" }, "subscription_cycled_after_trial": { "type": "boolean", "title": "Subscription Cycled After Trial" }, "subscription_past_due": { "type": "boolean", "title": "Subscription Past Due" }, "subscription_revoked": { "type": "boolean", "title": "Subscription Revoked" }, "subscription_uncanceled": { "type": "boolean", "title": "Subscription Uncanceled" }, "subscription_updated": { "type": "boolean", "title": "Subscription Updated" } }, "type": "object", "required": [ "order_confirmation", "subscription_cancellation", "subscription_confirmation", "subscription_cycled", "subscription_cycled_after_trial", "subscription_past_due", "subscription_revoked", "subscription_uncanceled", "subscription_updated" ], "title": "OrganizationCustomerEmailSettings" }, "OrganizationCustomerPortalSettings": { "properties": { "usage": { "$ref": "#/components/schemas/CustomerPortalUsageSettings" }, "subscription": { "$ref": "#/components/schemas/CustomerPortalSubscriptionSettings" } }, "type": "object", "required": [ "usage", "subscription" ], "title": "OrganizationCustomerPortalSettings" }, "OrganizationDetails": { "properties": { "about": { "type": "string", "title": "About", "description": "Brief information about you and your business." }, "product_description": { "type": "string", "title": "Product Description", "description": "Description of digital products being sold." }, "intended_use": { "type": "string", "title": "Intended Use", "description": "How the organization will integrate and use Polar." }, "customer_acquisition": { "items": { "type": "string" }, "type": "array", "title": "Customer Acquisition", "description": "Main customer acquisition channels." }, "future_annual_revenue": { "type": "integer", "minimum": 0, "title": "Future Annual Revenue", "description": "Estimated revenue in the next 12 months" }, "switching": { "type": "boolean", "title": "Switching", "description": "Switching from another platform?", "default": true }, "switching_from": { "anyOf": [ { "type": "string", "enum": [ "paddle", "lemon_squeezy", "gumroad", "stripe", "other" ] }, { "type": "null" } ], "title": "Switching From", "description": "Which platform the organization is migrating from." }, "previous_annual_revenue": { "type": "integer", "minimum": 0, "title": "Previous Annual Revenue", "description": "Revenue from last year if applicable.", "default": 0 } }, "type": "object", "required": [ "about", "product_description", "intended_use", "customer_acquisition", "future_annual_revenue" ], "title": "OrganizationDetails" }, "OrganizationFeatureSettings": { "properties": { "issue_funding_enabled": { "type": "boolean", "title": "Issue Funding Enabled", "description": "If this organization has issue funding enabled", "default": false }, "seat_based_pricing_enabled": { "type": "boolean", "title": "Seat Based Pricing Enabled", "description": "If this organization has seat-based pricing enabled", "default": false }, "revops_enabled": { "type": "boolean", "title": "Revops Enabled", "description": "If this organization has RevOps enabled", "default": false }, "wallets_enabled": { "type": "boolean", "title": "Wallets Enabled", "description": "If this organization has Wallets enabled", "default": false }, "member_model_enabled": { "type": "boolean", "title": "Member Model Enabled", "description": "If this organization has the Member model enabled", "default": false }, "tinybird_read": { "type": "boolean", "title": "Tinybird Read", "description": "If this organization reads from Tinybird", "default": false }, "tinybird_compare": { "type": "boolean", "title": "Tinybird Compare", "description": "If this organization compares Tinybird results with database", "default": false }, "checkout_localization_enabled": { "type": "boolean", "title": "Checkout Localization Enabled", "description": "If this organization has checkout localization enabled", "default": false }, "overview_metrics": { "anyOf": [ { "items": { "type": "string" }, "type": "array" }, { "type": "null" } ], "title": "Overview Metrics", "description": "Ordered list of metric slugs shown on the dashboard overview." } }, "type": "object", "title": "OrganizationFeatureSettings" }, "OrganizationNotificationSettings": { "properties": { "new_order": { "type": "boolean", "title": "New Order" }, "new_subscription": { "type": "boolean", "title": "New Subscription" } }, "type": "object", "required": [ "new_order", "new_subscription" ], "title": "OrganizationNotificationSettings" }, "OrganizationSocialLink": { "properties": { "platform": { "$ref": "#/components/schemas/OrganizationSocialPlatforms", "description": "The social platform of the URL" }, "url": { "type": "string", "maxLength": 2083, "minLength": 1, "format": "uri", "title": "Url", "description": "The URL to the organization profile" } }, "type": "object", "required": [ "platform", "url" ], "title": "OrganizationSocialLink" }, "OrganizationSocialPlatforms": { "type": "string", "enum": [ "x", "github", "facebook", "instagram", "youtube", "tiktok", "linkedin", "threads", "discord", "other" ], "title": "OrganizationSocialPlatforms" }, "OrganizationSortProperty": { "type": "string", "enum": [ "created_at", "-created_at", "slug", "-slug", "name", "-name", "next_review_threshold", "-next_review_threshold", "days_in_status", "-days_in_status" ], "title": "OrganizationSortProperty" }, "OrganizationStatus": { "type": "string", "enum": [ "created", "onboarding_started", "initial_review", "ongoing_review", "denied", "active" ], "title": "OrganizationStatus" }, "OrganizationSubscriptionSettings": { "properties": { "allow_multiple_subscriptions": { "type": "boolean", "title": "Allow Multiple Subscriptions" }, "allow_customer_updates": { "type": "boolean", "title": "Allow Customer Updates" }, "proration_behavior": { "$ref": "#/components/schemas/SubscriptionProrationBehavior" }, "benefit_revocation_grace_period": { "type": "integer", "title": "Benefit Revocation Grace Period" }, "prevent_trial_abuse": { "type": "boolean", "title": "Prevent Trial Abuse" } }, "type": "object", "required": [ "allow_multiple_subscriptions", "allow_customer_updates", "proration_behavior", "benefit_revocation_grace_period", "prevent_trial_abuse" ], "title": "OrganizationSubscriptionSettings" }, "OrganizationUpdate": { "properties": { "name": { "anyOf": [ { "type": "string", "minLength": 3 }, { "type": "null" } ], "title": "Name" }, "avatar_url": { "anyOf": [ { "type": "string", "maxLength": 2083, "minLength": 1, "format": "uri" }, { "type": "null" } ], "title": "Avatar Url" }, "email": { "anyOf": [ { "type": "string", "format": "email" }, { "type": "null" } ], "title": "Email", "description": "Public support email." }, "website": { "anyOf": [ { "type": "string", "maxLength": 2083, "minLength": 1, "format": "uri" }, { "type": "null" } ], "title": "Website", "description": "Official website of the organization." }, "socials": { "anyOf": [ { "items": { "$ref": "#/components/schemas/OrganizationSocialLink" }, "type": "array" }, { "type": "null" } ], "title": "Socials", "description": "Links to social profiles." }, "details": { "anyOf": [ { "$ref": "#/components/schemas/OrganizationDetails" }, { "type": "null" } ], "description": "Additional, private, business details Polar needs about active organizations for compliance (KYC)." }, "feature_settings": { "anyOf": [ { "$ref": "#/components/schemas/OrganizationFeatureSettings" }, { "type": "null" } ] }, "subscription_settings": { "anyOf": [ { "$ref": "#/components/schemas/OrganizationSubscriptionSettings" }, { "type": "null" } ] }, "notification_settings": { "anyOf": [ { "$ref": "#/components/schemas/OrganizationNotificationSettings" }, { "type": "null" } ] }, "customer_email_settings": { "anyOf": [ { "$ref": "#/components/schemas/OrganizationCustomerEmailSettings" }, { "type": "null" } ] }, "customer_portal_settings": { "anyOf": [ { "$ref": "#/components/schemas/OrganizationCustomerPortalSettings" }, { "type": "null" } ] }, "default_presentment_currency": { "anyOf": [ { "$ref": "#/components/schemas/PresentmentCurrency" }, { "type": "null" } ], "description": "Default presentment currency for the organization" } }, "type": "object", "title": "OrganizationUpdate" }, "OwnerCreate": { "properties": { "email": { "anyOf": [ { "type": "string", "format": "email" }, { "type": "null" } ], "title": "Email", "description": "The email address of the member.", "examples": [ "member@example.com" ] }, "name": { "anyOf": [ { "type": "string", "maxLength": 256, "description": "The name of the member.", "examples": [ "Jane Doe" ] }, { "type": "null" } ], "title": "Name" }, "external_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "External Id", "description": "The ID of the member in your system. This must be unique within the customer. ", "examples": [ "usr_1337" ] } }, "type": "object", "title": "OwnerCreate", "description": "Schema for creating an owner member during customer creation." }, "Pagination": { "properties": { "total_count": { "type": "integer", "title": "Total Count" }, "max_page": { "type": "integer", "title": "Max Page" } }, "type": "object", "required": [ "total_count", "max_page" ], "title": "Pagination" }, "Payment": { "anyOf": [ { "$ref": "#/components/schemas/CardPayment" }, { "$ref": "#/components/schemas/GenericPayment" } ] }, "PaymentAlreadyInProgress": { "properties": { "error": { "type": "string", "const": "PaymentAlreadyInProgress", "title": "Error", "examples": [ "PaymentAlreadyInProgress" ] }, "detail": { "type": "string", "title": "Detail" } }, "type": "object", "required": [ "error", "detail" ], "title": "PaymentAlreadyInProgress" }, "PaymentError": { "properties": { "error": { "type": "string", "const": "PaymentError", "title": "Error", "examples": [ "PaymentError" ] }, "detail": { "type": "string", "title": "Detail" } }, "type": "object", "required": [ "error", "detail" ], "title": "PaymentError" }, "PaymentMethodCard": { "properties": { "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "processor": { "$ref": "#/components/schemas/PaymentProcessor" }, "customer_id": { "type": "string", "format": "uuid4", "title": "Customer Id" }, "type": { "type": "string", "const": "card", "title": "Type" }, "method_metadata": { "$ref": "#/components/schemas/PaymentMethodCardMetadata" } }, "type": "object", "required": [ "id", "created_at", "modified_at", "processor", "customer_id", "type", "method_metadata" ], "title": "PaymentMethodCard" }, "PaymentMethodCardMetadata": { "properties": { "brand": { "type": "string", "title": "Brand" }, "last4": { "type": "string", "title": "Last4" }, "exp_month": { "type": "integer", "title": "Exp Month" }, "exp_year": { "type": "integer", "title": "Exp Year" }, "wallet": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Wallet" } }, "type": "object", "required": [ "brand", "last4", "exp_month", "exp_year" ], "title": "PaymentMethodCardMetadata" }, "PaymentMethodGeneric": { "properties": { "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "processor": { "$ref": "#/components/schemas/PaymentProcessor" }, "customer_id": { "type": "string", "format": "uuid4", "title": "Customer Id" }, "type": { "type": "string", "title": "Type" } }, "type": "object", "required": [ "id", "created_at", "modified_at", "processor", "customer_id", "type" ], "title": "PaymentMethodGeneric" }, "PaymentMethodInUseByActiveSubscription": { "properties": { "error": { "type": "string", "const": "PaymentMethodInUseByActiveSubscription", "title": "Error", "examples": [ "PaymentMethodInUseByActiveSubscription" ] }, "detail": { "type": "string", "title": "Detail" } }, "type": "object", "required": [ "error", "detail" ], "title": "PaymentMethodInUseByActiveSubscription" }, "PaymentNotReady": { "properties": { "error": { "type": "string", "const": "PaymentNotReady", "title": "Error", "examples": [ "PaymentNotReady" ] }, "detail": { "type": "string", "title": "Detail" } }, "type": "object", "required": [ "error", "detail" ], "title": "PaymentNotReady" }, "PaymentProcessor": { "type": "string", "enum": [ "stripe" ], "title": "PaymentProcessor" }, "PaymentSortProperty": { "type": "string", "enum": [ "created_at", "-created_at", "status", "-status", "amount", "-amount", "method", "-method" ], "title": "PaymentSortProperty" }, "PaymentStatus": { "type": "string", "enum": [ "pending", "succeeded", "failed" ], "title": "PaymentStatus" }, "PortalAuthenticatedUser": { "properties": { "type": { "type": "string", "title": "Type", "description": "Type of authenticated user: 'customer' or 'member'" }, "name": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Name", "description": "User's name, if available." }, "email": { "type": "string", "title": "Email", "description": "User's email address." }, "customer_id": { "type": "string", "format": "uuid4", "title": "Customer Id", "description": "Associated customer ID." }, "member_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Member Id", "description": "Member ID. Only set for members." }, "role": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Role", "description": "Member role (owner, billing_manager, member). Only set for members." } }, "type": "object", "required": [ "type", "name", "email", "customer_id" ], "title": "PortalAuthenticatedUser", "description": "Information about the authenticated portal user." }, "PresentmentCurrency": { "type": "string", "enum": [ "aud", "brl", "cad", "chf", "eur", "inr", "gbp", "jpy", "sek", "usd" ], "title": "PresentmentCurrency" }, "Product": { "properties": { "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "trial_interval": { "anyOf": [ { "$ref": "#/components/schemas/TrialInterval" }, { "type": "null" } ], "description": "The interval unit for the trial period." }, "trial_interval_count": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Trial Interval Count", "description": "The number of interval units for the trial period." }, "name": { "type": "string", "title": "Name", "description": "The name of the product." }, "description": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Description", "description": "The description of the product." }, "visibility": { "$ref": "#/components/schemas/ProductVisibility", "description": "The visibility of the product." }, "recurring_interval": { "anyOf": [ { "$ref": "#/components/schemas/SubscriptionRecurringInterval" }, { "type": "null" } ], "description": "The recurring interval of the product. If `None`, the product is a one-time purchase." }, "recurring_interval_count": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Recurring Interval Count", "description": "Number of interval units of the subscription. If this is set to 1 the charge will happen every interval (e.g. every month), if set to 2 it will be every other month, and so on. None for one-time products." }, "is_recurring": { "type": "boolean", "title": "Is Recurring", "description": "Whether the product is a subscription." }, "is_archived": { "type": "boolean", "title": "Is Archived", "description": "Whether the product is archived and no longer available." }, "organization_id": { "type": "string", "format": "uuid4", "title": "Organization Id", "description": "The ID of the organization owning the product." }, "metadata": { "$ref": "#/components/schemas/MetadataOutputType" }, "prices": { "items": { "oneOf": [ { "$ref": "#/components/schemas/LegacyRecurringProductPrice" }, { "$ref": "#/components/schemas/ProductPrice" } ] }, "type": "array", "title": "Prices", "description": "List of prices for this product." }, "benefits": { "items": { "$ref": "#/components/schemas/Benefit", "title": "Benefit" }, "type": "array", "title": "Benefits", "description": "List of benefits granted by the product." }, "medias": { "items": { "$ref": "#/components/schemas/ProductMediaFileRead" }, "type": "array", "title": "Medias", "description": "List of medias associated to the product." }, "attached_custom_fields": { "items": { "$ref": "#/components/schemas/AttachedCustomField" }, "type": "array", "title": "Attached Custom Fields", "description": "List of custom fields attached to the product." } }, "type": "object", "required": [ "id", "created_at", "modified_at", "trial_interval", "trial_interval_count", "name", "description", "visibility", "recurring_interval", "recurring_interval_count", "is_recurring", "is_archived", "organization_id", "metadata", "prices", "benefits", "medias", "attached_custom_fields" ], "title": "Product", "description": "A product." }, "ProductBenefitsUpdate": { "properties": { "benefits": { "items": { "type": "string", "format": "uuid4", "description": "The benefit ID.", "x-polar-selector-widget": { "displayProperty": "description", "resourceName": "Benefit", "resourceRoot": "/v1/benefits" } }, "type": "array", "title": "Benefits", "description": "List of benefit IDs. Each one must be on the same organization as the product." } }, "type": "object", "required": [ "benefits" ], "title": "ProductBenefitsUpdate", "description": "Schema to update the benefits granted by a product." }, "ProductBillingType": { "type": "string", "enum": [ "one_time", "recurring" ], "title": "ProductBillingType" }, "ProductCreate": { "anyOf": [ { "$ref": "#/components/schemas/ProductCreateRecurring" }, { "$ref": "#/components/schemas/ProductCreateOneTime" } ] }, "ProductCreateOneTime": { "properties": { "metadata": { "additionalProperties": { "anyOf": [ { "type": "string", "maxLength": 500, "minLength": 1 }, { "type": "integer" }, { "type": "number" }, { "type": "boolean" } ] }, "propertyNames": { "maxLength": 40, "minLength": 1 }, "type": "object", "maxProperties": 50, "title": "Metadata", "description": "Key-value object allowing you to store additional information.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**." }, "name": { "type": "string", "maxLength": 64, "minLength": 3, "title": "Name", "description": "The name of the product." }, "description": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Description", "description": "The description of the product." }, "visibility": { "$ref": "#/components/schemas/ProductVisibility", "description": "The visibility of the product.", "default": "public" }, "prices": { "items": { "oneOf": [ { "$ref": "#/components/schemas/ProductPriceFixedCreate" }, { "$ref": "#/components/schemas/ProductPriceCustomCreate" }, { "$ref": "#/components/schemas/ProductPriceFreeCreate" }, { "$ref": "#/components/schemas/ProductPriceSeatBasedCreate" }, { "$ref": "#/components/schemas/ProductPriceMeteredUnitCreate" } ], "discriminator": { "propertyName": "amount_type", "mapping": { "custom": "#/components/schemas/ProductPriceCustomCreate", "fixed": "#/components/schemas/ProductPriceFixedCreate", "free": "#/components/schemas/ProductPriceFreeCreate", "metered_unit": "#/components/schemas/ProductPriceMeteredUnitCreate", "seat_based": "#/components/schemas/ProductPriceSeatBasedCreate" } } }, "type": "array", "minItems": 1, "title": "ProductPriceCreateList", "description": "List of available prices for this product. It should contain at most one static price (fixed, custom or free), and any number of metered prices. Metered prices are not supported on one-time purchase products." }, "medias": { "anyOf": [ { "items": { "type": "string", "format": "uuid4" }, "type": "array" }, { "type": "null" } ], "title": "Medias", "description": "List of file IDs. Each one must be on the same organization as the product, of type `product_media` and correctly uploaded." }, "attached_custom_fields": { "items": { "$ref": "#/components/schemas/AttachedCustomFieldCreate" }, "type": "array", "title": "Attached Custom Fields", "description": "List of custom fields to attach." }, "organization_id": { "anyOf": [ { "type": "string", "format": "uuid4", "description": "The organization ID.", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "x-polar-selector-widget": { "displayProperty": "name", "resourceName": "Organization", "resourceRoot": "/v1/organizations" } }, { "type": "null" } ], "title": "Organization Id", "description": "The ID of the organization owning the product. **Required unless you use an organization token.**" }, "recurring_interval": { "type": "null", "title": "Recurring Interval", "description": "States that the product is a one-time purchase." }, "recurring_interval_count": { "type": "null", "title": "Recurring Interval Count", "description": "One-time products don't have a recurring interval count." } }, "type": "object", "required": [ "name", "prices" ], "title": "ProductCreateOneTime" }, "ProductCreateRecurring": { "properties": { "metadata": { "additionalProperties": { "anyOf": [ { "type": "string", "maxLength": 500, "minLength": 1 }, { "type": "integer" }, { "type": "number" }, { "type": "boolean" } ] }, "propertyNames": { "maxLength": 40, "minLength": 1 }, "type": "object", "maxProperties": 50, "title": "Metadata", "description": "Key-value object allowing you to store additional information.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**." }, "name": { "type": "string", "maxLength": 64, "minLength": 3, "title": "Name", "description": "The name of the product." }, "description": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Description", "description": "The description of the product." }, "visibility": { "$ref": "#/components/schemas/ProductVisibility", "description": "The visibility of the product.", "default": "public" }, "prices": { "items": { "oneOf": [ { "$ref": "#/components/schemas/ProductPriceFixedCreate" }, { "$ref": "#/components/schemas/ProductPriceCustomCreate" }, { "$ref": "#/components/schemas/ProductPriceFreeCreate" }, { "$ref": "#/components/schemas/ProductPriceSeatBasedCreate" }, { "$ref": "#/components/schemas/ProductPriceMeteredUnitCreate" } ], "discriminator": { "propertyName": "amount_type", "mapping": { "custom": "#/components/schemas/ProductPriceCustomCreate", "fixed": "#/components/schemas/ProductPriceFixedCreate", "free": "#/components/schemas/ProductPriceFreeCreate", "metered_unit": "#/components/schemas/ProductPriceMeteredUnitCreate", "seat_based": "#/components/schemas/ProductPriceSeatBasedCreate" } } }, "type": "array", "minItems": 1, "title": "ProductPriceCreateList", "description": "List of available prices for this product. It should contain at most one static price (fixed, custom or free), and any number of metered prices. Metered prices are not supported on one-time purchase products." }, "medias": { "anyOf": [ { "items": { "type": "string", "format": "uuid4" }, "type": "array" }, { "type": "null" } ], "title": "Medias", "description": "List of file IDs. Each one must be on the same organization as the product, of type `product_media` and correctly uploaded." }, "attached_custom_fields": { "items": { "$ref": "#/components/schemas/AttachedCustomFieldCreate" }, "type": "array", "title": "Attached Custom Fields", "description": "List of custom fields to attach." }, "organization_id": { "anyOf": [ { "type": "string", "format": "uuid4", "description": "The organization ID.", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "x-polar-selector-widget": { "displayProperty": "name", "resourceName": "Organization", "resourceRoot": "/v1/organizations" } }, { "type": "null" } ], "title": "Organization Id", "description": "The ID of the organization owning the product. **Required unless you use an organization token.**" }, "trial_interval": { "anyOf": [ { "$ref": "#/components/schemas/TrialInterval" }, { "type": "null" } ], "description": "The interval unit for the trial period." }, "trial_interval_count": { "anyOf": [ { "type": "integer", "maximum": 1000, "minimum": 1 }, { "type": "null" } ], "title": "Trial Interval Count", "description": "The number of interval units for the trial period." }, "recurring_interval": { "$ref": "#/components/schemas/SubscriptionRecurringInterval", "description": "The recurring interval of the product." }, "recurring_interval_count": { "type": "integer", "maximum": 999, "minimum": 1, "title": "Recurring Interval Count", "description": "Number of interval units of the subscription. If this is set to 1 the charge will happen every interval (e.g. every month), if set to 2 it will be every other month, and so on.", "default": 1 } }, "type": "object", "required": [ "name", "prices", "recurring_interval" ], "title": "ProductCreateRecurring" }, "ProductMediaFileCreate": { "properties": { "organization_id": { "anyOf": [ { "type": "string", "format": "uuid4", "description": "The organization ID.", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "x-polar-selector-widget": { "displayProperty": "name", "resourceName": "Organization", "resourceRoot": "/v1/organizations" } }, { "type": "null" } ], "title": "Organization Id" }, "name": { "type": "string", "title": "Name" }, "mime_type": { "type": "string", "pattern": "^image\\/(jpeg|png|gif|webp|svg\\+xml)$", "title": "Mime Type", "description": "MIME type of the file. Only images are supported for this type of file." }, "size": { "type": "integer", "maximum": 10485760, "title": "Size", "description": "Size of the file. A maximum of 10 MB is allowed for this type of file." }, "checksum_sha256_base64": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Checksum Sha256 Base64" }, "upload": { "$ref": "#/components/schemas/S3FileCreateMultipart" }, "service": { "type": "string", "const": "product_media", "title": "Service" }, "version": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Version" } }, "type": "object", "required": [ "name", "mime_type", "size", "upload", "service" ], "title": "ProductMediaFileCreate", "description": "Schema to create a file to be used as a product media file." }, "ProductMediaFileRead": { "properties": { "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "organization_id": { "type": "string", "format": "uuid4", "title": "Organization Id" }, "name": { "type": "string", "title": "Name" }, "path": { "type": "string", "title": "Path" }, "mime_type": { "type": "string", "title": "Mime Type" }, "size": { "type": "integer", "title": "Size" }, "storage_version": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Storage Version" }, "checksum_etag": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Checksum Etag" }, "checksum_sha256_base64": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Checksum Sha256 Base64" }, "checksum_sha256_hex": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Checksum Sha256 Hex" }, "last_modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Last Modified At" }, "version": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Version" }, "service": { "type": "string", "const": "product_media", "title": "Service" }, "is_uploaded": { "type": "boolean", "title": "Is Uploaded" }, "created_at": { "type": "string", "format": "date-time", "title": "Created At" }, "size_readable": { "type": "string", "title": "Size Readable" }, "public_url": { "type": "string", "title": "Public Url" } }, "type": "object", "required": [ "id", "organization_id", "name", "path", "mime_type", "size", "storage_version", "checksum_etag", "checksum_sha256_base64", "checksum_sha256_hex", "last_modified_at", "version", "service", "is_uploaded", "created_at", "size_readable", "public_url" ], "title": "ProductMediaFileRead", "description": "File to be used as a product media file." }, "ProductPrice": { "oneOf": [ { "$ref": "#/components/schemas/ProductPriceFixed" }, { "$ref": "#/components/schemas/ProductPriceCustom" }, { "$ref": "#/components/schemas/ProductPriceFree" }, { "$ref": "#/components/schemas/ProductPriceSeatBased" }, { "$ref": "#/components/schemas/ProductPriceMeteredUnit" } ], "discriminator": { "propertyName": "amount_type", "mapping": { "custom": "#/components/schemas/ProductPriceCustom", "fixed": "#/components/schemas/ProductPriceFixed", "free": "#/components/schemas/ProductPriceFree", "metered_unit": "#/components/schemas/ProductPriceMeteredUnit", "seat_based": "#/components/schemas/ProductPriceSeatBased" } } }, "ProductPriceCustom": { "properties": { "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the price." }, "source": { "$ref": "#/components/schemas/ProductPriceSource", "description": "The source of the price . `catalog` is a predefined price, while `ad_hoc` is a price created dynamically on a Checkout session." }, "amount_type": { "type": "string", "const": "custom", "title": "Amount Type" }, "price_currency": { "type": "string", "title": "Price Currency", "description": "The currency in which the customer will be charged." }, "is_archived": { "type": "boolean", "title": "Is Archived", "description": "Whether the price is archived and no longer available." }, "product_id": { "type": "string", "format": "uuid4", "title": "Product Id", "description": "The ID of the product owning the price." }, "minimum_amount": { "type": "integer", "title": "Minimum Amount", "description": "The minimum amount the customer can pay. If 0, the price is 'free or pay what you want'. Defaults to 50 cents." }, "maximum_amount": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Maximum Amount", "description": "The maximum amount the customer can pay." }, "preset_amount": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Preset Amount", "description": "The initial amount shown to the customer." } }, "type": "object", "required": [ "created_at", "modified_at", "id", "source", "amount_type", "price_currency", "is_archived", "product_id", "minimum_amount", "maximum_amount", "preset_amount" ], "title": "ProductPriceCustom", "description": "A pay-what-you-want price for a product." }, "ProductPriceCustomCreate": { "properties": { "amount_type": { "type": "string", "const": "custom", "title": "Amount Type" }, "price_currency": { "$ref": "#/components/schemas/PresentmentCurrency", "description": "The currency in which the customer will be charged.", "default": "usd" }, "minimum_amount": { "type": "integer", "minimum": 0, "title": "Minimum Amount", "description": "The minimum amount the customer can pay. If set to 0, the price is 'free or pay what you want' and $0 is accepted. If set to a value between 1-49, it will be rejected. Defaults to 50 cents.", "default": 50 }, "maximum_amount": { "anyOf": [ { "type": "integer", "maximum": 1000000, "minimum": 50, "description": "The price in cents." }, { "type": "null" } ], "title": "Maximum Amount", "description": "The maximum amount the customer can pay." }, "preset_amount": { "anyOf": [ { "type": "integer", "maximum": 1000000, "minimum": 0, "description": "The price in cents." }, { "type": "null" } ], "title": "Preset Amount", "description": "The initial amount shown to the customer. If 0, the customer will see $0 as the default. Values between 1-49 are rejected." } }, "type": "object", "required": [ "amount_type" ], "title": "ProductPriceCustomCreate", "description": "Schema to create a pay-what-you-want price." }, "ProductPriceFixed": { "properties": { "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the price." }, "source": { "$ref": "#/components/schemas/ProductPriceSource", "description": "The source of the price . `catalog` is a predefined price, while `ad_hoc` is a price created dynamically on a Checkout session." }, "amount_type": { "type": "string", "const": "fixed", "title": "Amount Type" }, "price_currency": { "type": "string", "title": "Price Currency", "description": "The currency in which the customer will be charged." }, "is_archived": { "type": "boolean", "title": "Is Archived", "description": "Whether the price is archived and no longer available." }, "product_id": { "type": "string", "format": "uuid4", "title": "Product Id", "description": "The ID of the product owning the price." }, "price_amount": { "type": "integer", "title": "Price Amount", "description": "The price in cents." } }, "type": "object", "required": [ "created_at", "modified_at", "id", "source", "amount_type", "price_currency", "is_archived", "product_id", "price_amount" ], "title": "ProductPriceFixed", "description": "A fixed price for a product." }, "ProductPriceFixedCreate": { "properties": { "amount_type": { "type": "string", "const": "fixed", "title": "Amount Type" }, "price_currency": { "$ref": "#/components/schemas/PresentmentCurrency", "description": "The currency in which the customer will be charged.", "default": "usd" }, "price_amount": { "type": "integer", "maximum": 99999999, "minimum": 50, "title": "Price Amount", "description": "The price in cents." } }, "type": "object", "required": [ "amount_type", "price_amount" ], "title": "ProductPriceFixedCreate", "description": "Schema to create a fixed price." }, "ProductPriceFree": { "properties": { "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the price." }, "source": { "$ref": "#/components/schemas/ProductPriceSource", "description": "The source of the price . `catalog` is a predefined price, while `ad_hoc` is a price created dynamically on a Checkout session." }, "amount_type": { "type": "string", "const": "free", "title": "Amount Type" }, "price_currency": { "type": "string", "title": "Price Currency", "description": "The currency in which the customer will be charged." }, "is_archived": { "type": "boolean", "title": "Is Archived", "description": "Whether the price is archived and no longer available." }, "product_id": { "type": "string", "format": "uuid4", "title": "Product Id", "description": "The ID of the product owning the price." } }, "type": "object", "required": [ "created_at", "modified_at", "id", "source", "amount_type", "price_currency", "is_archived", "product_id" ], "title": "ProductPriceFree", "description": "A free price for a product." }, "ProductPriceFreeCreate": { "properties": { "amount_type": { "type": "string", "const": "free", "title": "Amount Type" }, "price_currency": { "$ref": "#/components/schemas/PresentmentCurrency", "description": "The currency in which the customer will be charged.", "default": "usd" } }, "type": "object", "required": [ "amount_type" ], "title": "ProductPriceFreeCreate", "description": "Schema to create a free price." }, "ProductPriceMeter": { "properties": { "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "name": { "type": "string", "title": "Name", "description": "The name of the meter." } }, "type": "object", "required": [ "id", "name" ], "title": "ProductPriceMeter", "description": "A meter associated to a metered price." }, "ProductPriceMeteredUnit": { "properties": { "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the price." }, "source": { "$ref": "#/components/schemas/ProductPriceSource", "description": "The source of the price . `catalog` is a predefined price, while `ad_hoc` is a price created dynamically on a Checkout session." }, "amount_type": { "type": "string", "const": "metered_unit", "title": "Amount Type" }, "price_currency": { "type": "string", "title": "Price Currency", "description": "The currency in which the customer will be charged." }, "is_archived": { "type": "boolean", "title": "Is Archived", "description": "Whether the price is archived and no longer available." }, "product_id": { "type": "string", "format": "uuid4", "title": "Product Id", "description": "The ID of the product owning the price." }, "unit_amount": { "type": "string", "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "title": "Unit Amount", "description": "The price per unit in cents." }, "cap_amount": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Cap Amount", "description": "The maximum amount in cents that can be charged, regardless of the number of units consumed." }, "meter_id": { "type": "string", "format": "uuid4", "title": "Meter Id", "description": "The ID of the meter associated to the price." }, "meter": { "$ref": "#/components/schemas/ProductPriceMeter", "description": "The meter associated to the price." } }, "type": "object", "required": [ "created_at", "modified_at", "id", "source", "amount_type", "price_currency", "is_archived", "product_id", "unit_amount", "cap_amount", "meter_id", "meter" ], "title": "ProductPriceMeteredUnit", "description": "A metered, usage-based, price for a product, with a fixed unit price." }, "ProductPriceMeteredUnitCreate": { "properties": { "amount_type": { "type": "string", "const": "metered_unit", "title": "Amount Type" }, "price_currency": { "$ref": "#/components/schemas/PresentmentCurrency", "description": "The currency in which the customer will be charged.", "default": "usd" }, "meter_id": { "type": "string", "format": "uuid4", "title": "Meter Id", "description": "The ID of the meter associated to the price." }, "unit_amount": { "anyOf": [ { "type": "number", "exclusiveMinimum": 0 }, { "type": "string", "pattern": "^(?!^[-+.]*$)[+-]?0*(?:\\d{0,5}|(?=[\\d.]{1,18}0*$)\\d{0,5}\\.\\d{0,12}0*$)" } ], "title": "Unit Amount", "description": "The price per unit in cents. Supports up to 12 decimal places." }, "cap_amount": { "anyOf": [ { "type": "integer", "maximum": 2147483647, "minimum": 0 }, { "type": "null" } ], "title": "Cap Amount", "description": "Optional maximum amount in cents that can be charged, regardless of the number of units consumed." } }, "type": "object", "required": [ "amount_type", "meter_id", "unit_amount" ], "title": "ProductPriceMeteredUnitCreate", "description": "Schema to create a metered price with a fixed unit price." }, "ProductPriceSeatBased": { "properties": { "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the price." }, "source": { "$ref": "#/components/schemas/ProductPriceSource", "description": "The source of the price . `catalog` is a predefined price, while `ad_hoc` is a price created dynamically on a Checkout session." }, "amount_type": { "type": "string", "const": "seat_based", "title": "Amount Type" }, "price_currency": { "type": "string", "title": "Price Currency", "description": "The currency in which the customer will be charged." }, "is_archived": { "type": "boolean", "title": "Is Archived", "description": "Whether the price is archived and no longer available." }, "product_id": { "type": "string", "format": "uuid4", "title": "Product Id", "description": "The ID of the product owning the price." }, "seat_tiers": { "$ref": "#/components/schemas/ProductPriceSeatTiers-Output", "description": "Tiered pricing based on seat quantity" } }, "type": "object", "required": [ "created_at", "modified_at", "id", "source", "amount_type", "price_currency", "is_archived", "product_id", "seat_tiers" ], "title": "ProductPriceSeatBased", "description": "A seat-based price for a product." }, "ProductPriceSeatBasedCreate": { "properties": { "amount_type": { "type": "string", "const": "seat_based", "title": "Amount Type" }, "price_currency": { "$ref": "#/components/schemas/PresentmentCurrency", "description": "The currency in which the customer will be charged.", "default": "usd" }, "seat_tiers": { "$ref": "#/components/schemas/ProductPriceSeatTiers-Input", "description": "Tiered pricing based on seat quantity" } }, "type": "object", "required": [ "amount_type", "seat_tiers" ], "title": "ProductPriceSeatBasedCreate", "description": "Schema to create a seat-based price with volume-based tiers." }, "ProductPriceSeatTier": { "properties": { "min_seats": { "type": "integer", "minimum": 1, "title": "Min Seats", "description": "Minimum number of seats (inclusive)" }, "max_seats": { "anyOf": [ { "type": "integer", "minimum": 1 }, { "type": "null" } ], "title": "Max Seats", "description": "Maximum number of seats (inclusive). None for unlimited." }, "price_per_seat": { "type": "integer", "maximum": 99999999, "minimum": 0, "title": "Price Per Seat", "description": "Price per seat in cents for this tier" } }, "type": "object", "required": [ "min_seats", "price_per_seat" ], "title": "ProductPriceSeatTier", "description": "A pricing tier for seat-based pricing." }, "ProductPriceSeatTiers-Input": { "properties": { "tiers": { "items": { "$ref": "#/components/schemas/ProductPriceSeatTier" }, "type": "array", "minItems": 1, "title": "Tiers", "description": "List of pricing tiers" } }, "type": "object", "required": [ "tiers" ], "title": "ProductPriceSeatTiers", "description": "List of pricing tiers for seat-based pricing.\n\nThe minimum and maximum seat limits are derived from the tiers:\n- minimum_seats = first tier's min_seats\n- maximum_seats = last tier's max_seats (None for unlimited)" }, "ProductPriceSeatTiers-Output": { "properties": { "tiers": { "items": { "$ref": "#/components/schemas/ProductPriceSeatTier" }, "type": "array", "minItems": 1, "title": "Tiers", "description": "List of pricing tiers" }, "minimum_seats": { "type": "integer", "title": "Minimum Seats", "description": "Minimum number of seats required for purchase, derived from first tier." }, "maximum_seats": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Maximum Seats", "description": "Maximum number of seats allowed for purchase, derived from last tier. None for unlimited." } }, "type": "object", "required": [ "tiers", "minimum_seats", "maximum_seats" ], "title": "ProductPriceSeatTiers", "description": "List of pricing tiers for seat-based pricing.\n\nThe minimum and maximum seat limits are derived from the tiers:\n- minimum_seats = first tier's min_seats\n- maximum_seats = last tier's max_seats (None for unlimited)" }, "ProductPriceSource": { "type": "string", "enum": [ "catalog", "ad_hoc" ], "title": "ProductPriceSource" }, "ProductPriceType": { "type": "string", "enum": [ "one_time", "recurring" ], "title": "ProductPriceType" }, "ProductSortProperty": { "type": "string", "enum": [ "created_at", "-created_at", "name", "-name", "price_amount_type", "-price_amount_type", "price_amount", "-price_amount" ], "title": "ProductSortProperty" }, "ProductUpdate": { "properties": { "metadata": { "additionalProperties": { "anyOf": [ { "type": "string", "maxLength": 500, "minLength": 1 }, { "type": "integer" }, { "type": "number" }, { "type": "boolean" } ] }, "propertyNames": { "maxLength": 40, "minLength": 1 }, "type": "object", "maxProperties": 50, "title": "Metadata", "description": "Key-value object allowing you to store additional information.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**." }, "trial_interval": { "anyOf": [ { "$ref": "#/components/schemas/TrialInterval" }, { "type": "null" } ], "description": "The interval unit for the trial period." }, "trial_interval_count": { "anyOf": [ { "type": "integer", "maximum": 1000, "minimum": 1 }, { "type": "null" } ], "title": "Trial Interval Count", "description": "The number of interval units for the trial period." }, "name": { "anyOf": [ { "type": "string", "maxLength": 64, "minLength": 3, "description": "The name of the product." }, { "type": "null" } ], "title": "Name" }, "description": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Description", "description": "The description of the product." }, "recurring_interval": { "anyOf": [ { "$ref": "#/components/schemas/SubscriptionRecurringInterval" }, { "type": "null" } ], "description": "The recurring interval of the product. If `None`, the product is a one-time purchase. **Can only be set on legacy recurring products. Once set, it can't be changed.**" }, "recurring_interval_count": { "anyOf": [ { "type": "integer", "maximum": 999, "minimum": 1 }, { "type": "null" } ], "title": "Recurring Interval Count", "description": "Number of interval units of the subscription. If this is set to 1 the charge will happen every interval (e.g. every month), if set to 2 it will be every other month, and so on. Once set, it can't be changed.**" }, "is_archived": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "title": "Is Archived", "description": "Whether the product is archived. If `true`, the product won't be available for purchase anymore. Existing customers will still have access to their benefits, and subscriptions will continue normally." }, "visibility": { "anyOf": [ { "$ref": "#/components/schemas/ProductVisibility" }, { "type": "null" } ], "description": "The visibility of the product." }, "prices": { "anyOf": [ { "items": { "anyOf": [ { "$ref": "#/components/schemas/ExistingProductPrice" }, { "oneOf": [ { "$ref": "#/components/schemas/ProductPriceFixedCreate" }, { "$ref": "#/components/schemas/ProductPriceCustomCreate" }, { "$ref": "#/components/schemas/ProductPriceFreeCreate" }, { "$ref": "#/components/schemas/ProductPriceSeatBasedCreate" }, { "$ref": "#/components/schemas/ProductPriceMeteredUnitCreate" } ], "discriminator": { "propertyName": "amount_type", "mapping": { "custom": "#/components/schemas/ProductPriceCustomCreate", "fixed": "#/components/schemas/ProductPriceFixedCreate", "free": "#/components/schemas/ProductPriceFreeCreate", "metered_unit": "#/components/schemas/ProductPriceMeteredUnitCreate", "seat_based": "#/components/schemas/ProductPriceSeatBasedCreate" } } } ] }, "type": "array" }, { "type": "null" } ], "title": "Prices", "description": "List of available prices for this product. If you want to keep existing prices, include them in the list as an `ExistingProductPrice` object." }, "medias": { "anyOf": [ { "items": { "type": "string", "format": "uuid4" }, "type": "array" }, { "type": "null" } ], "title": "Medias", "description": "List of file IDs. Each one must be on the same organization as the product, of type `product_media` and correctly uploaded." }, "attached_custom_fields": { "anyOf": [ { "items": { "$ref": "#/components/schemas/AttachedCustomFieldCreate" }, "type": "array", "description": "List of custom fields to attach." }, { "type": "null" } ], "title": "Attached Custom Fields" } }, "type": "object", "title": "ProductUpdate", "description": "Schema to update a product." }, "ProductVisibility": { "type": "string", "enum": [ "draft", "private", "public" ], "title": "ProductVisibility" }, "PropertyAggregation": { "properties": { "func": { "type": "string", "enum": [ "sum", "max", "min", "avg" ], "title": "Func" }, "property": { "type": "string", "title": "Property" } }, "type": "object", "required": [ "func", "property" ], "title": "PropertyAggregation" }, "Refund": { "properties": { "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "metadata": { "$ref": "#/components/schemas/MetadataOutputType" }, "status": { "$ref": "#/components/schemas/RefundStatus" }, "reason": { "$ref": "#/components/schemas/RefundReason" }, "amount": { "type": "integer", "title": "Amount" }, "tax_amount": { "type": "integer", "title": "Tax Amount" }, "currency": { "type": "string", "title": "Currency" }, "organization_id": { "type": "string", "format": "uuid4", "title": "Organization Id" }, "order_id": { "type": "string", "format": "uuid4", "title": "Order Id" }, "subscription_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Subscription Id" }, "customer_id": { "type": "string", "format": "uuid4", "title": "Customer Id" }, "revoke_benefits": { "type": "boolean", "title": "Revoke Benefits" }, "dispute": { "anyOf": [ { "$ref": "#/components/schemas/RefundDispute" }, { "type": "null" } ] } }, "type": "object", "required": [ "created_at", "modified_at", "id", "metadata", "status", "reason", "amount", "tax_amount", "currency", "organization_id", "order_id", "subscription_id", "customer_id", "revoke_benefits", "dispute" ], "title": "Refund" }, "RefundCreate": { "properties": { "metadata": { "additionalProperties": { "anyOf": [ { "type": "string", "maxLength": 500, "minLength": 1 }, { "type": "integer" }, { "type": "number" }, { "type": "boolean" } ] }, "propertyNames": { "maxLength": 40, "minLength": 1 }, "type": "object", "maxProperties": 50, "title": "Metadata", "description": "Key-value object allowing you to store additional information.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**." }, "order_id": { "type": "string", "format": "uuid4", "title": "Order Id" }, "reason": { "$ref": "#/components/schemas/RefundReason" }, "amount": { "type": "integer", "exclusiveMinimum": 0, "title": "Amount", "description": "Amount to refund in cents. Minimum is 1." }, "comment": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Comment", "description": "An internal comment about the refund." }, "revoke_benefits": { "type": "boolean", "title": "Revoke Benefits", "description": "Should this refund trigger the associated customer benefits to be revoked?\n\n**Note:**\nOnly allowed in case the `order` is a one-time purchase.\nSubscriptions automatically revoke customer benefits once the\nsubscription itself is revoked, i.e fully canceled.", "default": false } }, "type": "object", "required": [ "order_id", "reason", "amount" ], "title": "RefundCreate" }, "RefundDispute": { "properties": { "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "status": { "$ref": "#/components/schemas/DisputeStatus", "description": "Status of the dispute. `prevented` means we issued a refund before the dispute was escalated, avoiding any fees.", "examples": [ "needs_response", "prevented" ] }, "resolved": { "type": "boolean", "title": "Resolved", "description": "Whether the dispute has been resolved (won or lost).", "examples": [ false ] }, "closed": { "type": "boolean", "title": "Closed", "description": "Whether the dispute is closed (prevented, won, or lost).", "examples": [ false ] }, "amount": { "type": "integer", "title": "Amount", "description": "Amount in cents disputed.", "examples": [ 1000 ] }, "tax_amount": { "type": "integer", "title": "Tax Amount", "description": "Tax amount in cents disputed.", "examples": [ 200 ] }, "currency": { "type": "string", "title": "Currency", "description": "Currency code of the dispute.", "examples": [ "usd" ] }, "order_id": { "type": "string", "format": "uuid4", "title": "Order Id", "description": "The ID of the order associated with the dispute.", "examples": [ "57107b74-8400-4d80-a2fc-54c2b4239cb3" ] }, "payment_id": { "type": "string", "format": "uuid4", "title": "Payment Id", "description": "The ID of the payment associated with the dispute.", "examples": [ "42b94870-36b9-4573-96b6-b90b1c99a353" ] } }, "type": "object", "required": [ "created_at", "modified_at", "id", "status", "resolved", "closed", "amount", "tax_amount", "currency", "order_id", "payment_id" ], "title": "RefundDispute", "description": "Dispute associated with a refund,\nin case we prevented a dispute by issuing a refund." }, "RefundReason": { "type": "string", "enum": [ "duplicate", "fraudulent", "customer_request", "service_disruption", "satisfaction_guarantee", "dispute_prevention", "other" ], "title": "RefundReason" }, "RefundSortProperty": { "type": "string", "enum": [ "created_at", "-created_at", "amount", "-amount" ], "title": "RefundSortProperty" }, "RefundStatus": { "type": "string", "enum": [ "pending", "succeeded", "failed", "canceled" ], "title": "RefundStatus" }, "RefundedAlready": { "properties": { "error": { "type": "string", "const": "RefundedAlready", "title": "Error", "examples": [ "RefundedAlready" ] }, "detail": { "type": "string", "title": "Detail" } }, "type": "object", "required": [ "error", "detail" ], "title": "RefundedAlready" }, "ResourceNotFound": { "properties": { "error": { "type": "string", "const": "ResourceNotFound", "title": "Error", "examples": [ "ResourceNotFound" ] }, "detail": { "type": "string", "title": "Detail" } }, "type": "object", "required": [ "error", "detail" ], "title": "ResourceNotFound" }, "RevokeTokenResponse": { "properties": {}, "type": "object", "title": "RevokeTokenResponse" }, "S3DownloadURL": { "properties": { "url": { "type": "string", "title": "Url" }, "headers": { "additionalProperties": { "type": "string" }, "type": "object", "title": "Headers", "default": {} }, "expires_at": { "type": "string", "format": "date-time", "title": "Expires At" } }, "type": "object", "required": [ "url", "expires_at" ], "title": "S3DownloadURL" }, "S3FileCreateMultipart": { "properties": { "parts": { "items": { "$ref": "#/components/schemas/S3FileCreatePart" }, "type": "array", "title": "Parts" } }, "type": "object", "required": [ "parts" ], "title": "S3FileCreateMultipart" }, "S3FileCreatePart": { "properties": { "number": { "type": "integer", "title": "Number" }, "chunk_start": { "type": "integer", "title": "Chunk Start" }, "chunk_end": { "type": "integer", "title": "Chunk End" }, "checksum_sha256_base64": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Checksum Sha256 Base64" } }, "type": "object", "required": [ "number", "chunk_start", "chunk_end" ], "title": "S3FileCreatePart" }, "S3FileUploadCompletedPart": { "properties": { "number": { "type": "integer", "title": "Number" }, "checksum_etag": { "type": "string", "title": "Checksum Etag" }, "checksum_sha256_base64": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Checksum Sha256 Base64" } }, "type": "object", "required": [ "number", "checksum_etag", "checksum_sha256_base64" ], "title": "S3FileUploadCompletedPart" }, "S3FileUploadMultipart": { "properties": { "id": { "type": "string", "title": "Id" }, "path": { "type": "string", "title": "Path" }, "parts": { "items": { "$ref": "#/components/schemas/S3FileUploadPart" }, "type": "array", "title": "Parts" } }, "type": "object", "required": [ "id", "path", "parts" ], "title": "S3FileUploadMultipart" }, "S3FileUploadPart": { "properties": { "number": { "type": "integer", "title": "Number" }, "chunk_start": { "type": "integer", "title": "Chunk Start" }, "chunk_end": { "type": "integer", "title": "Chunk End" }, "checksum_sha256_base64": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Checksum Sha256 Base64" }, "url": { "type": "string", "title": "Url" }, "expires_at": { "type": "string", "format": "date-time", "title": "Expires At" }, "headers": { "additionalProperties": { "type": "string" }, "type": "object", "title": "Headers", "default": {} } }, "type": "object", "required": [ "number", "chunk_start", "chunk_end", "url", "expires_at" ], "title": "S3FileUploadPart" }, "Scope": { "type": "string", "enum": [ "openid", "profile", "email", "user:read", "user:write", "web:read", "web:write", "organizations:read", "organizations:write", "custom_fields:read", "custom_fields:write", "discounts:read", "discounts:write", "checkout_links:read", "checkout_links:write", "checkouts:read", "checkouts:write", "transactions:read", "transactions:write", "payouts:read", "payouts:write", "products:read", "products:write", "benefits:read", "benefits:write", "events:read", "events:write", "meters:read", "meters:write", "files:read", "files:write", "subscriptions:read", "subscriptions:write", "customers:read", "customers:write", "members:read", "members:write", "wallets:read", "wallets:write", "disputes:read", "customer_meters:read", "customer_sessions:write", "member_sessions:write", "customer_seats:read", "customer_seats:write", "orders:read", "orders:write", "refunds:read", "refunds:write", "payments:read", "metrics:read", "webhooks:read", "webhooks:write", "license_keys:read", "license_keys:write", "customer_portal:read", "customer_portal:write", "notifications:read", "notifications:write", "notification_recipients:read", "notification_recipients:write", "organization_access_tokens:read", "organization_access_tokens:write" ], "title": "Scope", "enumNames": { "benefits:read": "Read benefits", "benefits:write": "Create or modify benefits", "checkout_links:read": "Read checkout links", "checkout_links:write": "Create or modify checkout links", "checkouts:read": "Read checkout sessions", "checkouts:write": "Create or modify checkout sessions", "custom_fields:read": "Read custom fields", "custom_fields:write": "Create or modify custom fields", "customer_meters:read": "Read customer meters", "customer_portal:read": "Read your orders, subscriptions and benefits", "customer_portal:write": "Create or modify your orders, subscriptions and benefits", "customer_seats:read": "Read customer seats", "customer_seats:write": "Create or modify customer seats", "customer_sessions:write": "Create or modify customer sessions", "customers:read": "Read customers", "customers:write": "Create or modify customers", "discounts:read": "Read discounts", "discounts:write": "Create or modify discounts", "disputes:read": "Read disputes", "email": "Read your email address", "events:read": "Read events", "events:write": "Create events", "files:read": "Read file uploads", "files:write": "Create or modify file uploads", "license_keys:read": "Read license keys", "license_keys:write": "Modify license keys", "member_sessions:write": "Create or modify member sessions", "members:read": "Read members", "members:write": "Create or modify members", "meters:read": "Read meters", "meters:write": "Create or modify meters", "metrics:read": "Read metrics", "notification_recipients:read": "Read notification recipients", "notification_recipients:write": "Create or modify notification recipients", "notifications:read": "Read notifications", "notifications:write": "Mark notifications as read", "openid": "OpenID", "orders:read": "Read orders made on your organizations", "orders:write": "Modify orders made on your organizations", "organization_access_tokens:read": "Read organization access tokens", "organization_access_tokens:write": "Create or modify organization access tokens", "organizations:read": "Read your organizations", "organizations:write": "Create or modify organizations", "payments:read": "Read payments made on your organizations", "payouts:read": "Read payouts", "payouts:write": "Create or modify payouts", "products:read": "Read products", "products:write": "Create or modify products", "profile": "Read your profile", "refunds:read": "Read refunds made on your organizations", "refunds:write": "Create or modify refunds", "subscriptions:read": "Read subscriptions made on your organizations", "subscriptions:write": "Create or modify subscriptions made on your organizations", "transactions:read": "Read transactions", "transactions:write": "Create or modify transactions", "user:read": "User Read", "user:write": "Delete your user account", "wallets:read": "Read wallets", "wallets:write": "Create or modify wallets", "web:read": "Web Read Access", "web:write": "Web Write Access", "webhooks:read": "Read webhooks", "webhooks:write": "Create or modify webhooks" } }, "SeatAssign": { "properties": { "subscription_id": { "anyOf": [ { "type": "string", "format": "uuid" }, { "type": "null" } ], "title": "Subscription Id", "description": "Subscription ID. Required if checkout_id and order_id are not provided." }, "checkout_id": { "anyOf": [ { "type": "string", "format": "uuid" }, { "type": "null" } ], "title": "Checkout Id", "description": "Checkout ID. Used to look up subscription or order from the checkout page." }, "order_id": { "anyOf": [ { "type": "string", "format": "uuid" }, { "type": "null" } ], "title": "Order Id", "description": "Order ID for one-time purchases. Required if subscription_id and checkout_id are not provided." }, "email": { "anyOf": [ { "type": "string", "format": "email" }, { "type": "null" } ], "title": "Email", "description": "Email of the customer to assign the seat to" }, "external_customer_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "External Customer Id", "description": "External customer ID for the seat assignment" }, "customer_id": { "anyOf": [ { "type": "string", "format": "uuid" }, { "type": "null" } ], "title": "Customer Id", "description": "Customer ID for the seat assignment" }, "external_member_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "External Member Id", "description": "External member ID for the seat assignment. Only supported when member_model_enabled is true. Can be used alone (lookup existing member) or with email (create/validate member)." }, "member_id": { "anyOf": [ { "type": "string", "format": "uuid" }, { "type": "null" } ], "title": "Member Id", "description": "Member ID for the seat assignment. Only supported when member_model_enabled is true." }, "metadata": { "anyOf": [ { "additionalProperties": true, "type": "object" }, { "type": "null" } ], "title": "Metadata", "description": "Additional metadata for the seat (max 10 keys, 1KB total)" }, "immediate_claim": { "type": "boolean", "title": "Immediate Claim", "description": "If true, the seat will be immediately claimed without sending an invitation email. API-only feature.", "default": false } }, "type": "object", "title": "SeatAssign" }, "SeatClaim": { "properties": { "invitation_token": { "type": "string", "title": "Invitation Token", "description": "Invitation token to claim the seat" } }, "type": "object", "required": [ "invitation_token" ], "title": "SeatClaim" }, "SeatClaimInfo": { "properties": { "product_name": { "type": "string", "title": "Product Name", "description": "Name of the product" }, "product_id": { "type": "string", "format": "uuid", "title": "Product Id", "description": "ID of the product" }, "organization_name": { "type": "string", "title": "Organization Name", "description": "Name of the organization" }, "organization_slug": { "type": "string", "title": "Organization Slug", "description": "Slug of the organization" }, "customer_email": { "type": "string", "title": "Customer Email", "description": "Email of the customer assigned to this seat" }, "can_claim": { "type": "boolean", "title": "Can Claim", "description": "Whether the seat can be claimed" } }, "type": "object", "required": [ "product_name", "product_id", "organization_name", "organization_slug", "customer_email", "can_claim" ], "title": "SeatClaimInfo", "description": "Read-only information about a seat claim invitation.\nSafe for email scanners - no side effects when fetched." }, "SeatStatus": { "type": "string", "enum": [ "pending", "claimed", "revoked" ], "title": "SeatStatus" }, "SeatsList": { "properties": { "seats": { "items": { "$ref": "#/components/schemas/CustomerSeat" }, "type": "array", "title": "Seats", "description": "List of seats" }, "available_seats": { "type": "integer", "title": "Available Seats", "description": "Number of available seats" }, "total_seats": { "type": "integer", "title": "Total Seats", "description": "Total number of seats for the subscription" } }, "type": "object", "required": [ "seats", "available_seats", "total_seats" ], "title": "SeatsList" }, "SubType": { "type": "string", "enum": [ "user", "organization" ], "title": "SubType" }, "Subscription": { "properties": { "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "amount": { "type": "integer", "title": "Amount", "description": "The amount of the subscription.", "examples": [ 10000 ] }, "currency": { "type": "string", "title": "Currency", "description": "The currency of the subscription.", "examples": [ "usd" ] }, "recurring_interval": { "$ref": "#/components/schemas/SubscriptionRecurringInterval", "description": "The interval at which the subscription recurs.", "examples": [ "month" ] }, "recurring_interval_count": { "type": "integer", "title": "Recurring Interval Count", "description": "Number of interval units of the subscription. If this is set to 1 the charge will happen every interval (e.g. every month), if set to 2 it will be every other month, and so on." }, "status": { "$ref": "#/components/schemas/SubscriptionStatus", "description": "The status of the subscription.", "examples": [ "active" ] }, "current_period_start": { "type": "string", "format": "date-time", "title": "Current Period Start", "description": "The start timestamp of the current billing period." }, "current_period_end": { "type": "string", "format": "date-time", "title": "Current Period End", "description": "The end timestamp of the current billing period." }, "trial_start": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Trial Start", "description": "The start timestamp of the trial period, if any." }, "trial_end": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Trial End", "description": "The end timestamp of the trial period, if any." }, "cancel_at_period_end": { "type": "boolean", "title": "Cancel At Period End", "description": "Whether the subscription will be canceled at the end of the current period." }, "canceled_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Canceled At", "description": "The timestamp when the subscription was canceled. The subscription might still be active if `cancel_at_period_end` is `true`." }, "started_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Started At", "description": "The timestamp when the subscription started." }, "ends_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Ends At", "description": "The timestamp when the subscription will end." }, "ended_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Ended At", "description": "The timestamp when the subscription ended." }, "customer_id": { "type": "string", "format": "uuid4", "title": "Customer Id", "description": "The ID of the subscribed customer." }, "product_id": { "type": "string", "format": "uuid4", "title": "Product Id", "description": "The ID of the subscribed product." }, "discount_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Discount Id", "description": "The ID of the applied discount, if any." }, "checkout_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Checkout Id" }, "seats": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Seats", "description": "The number of seats for seat-based subscriptions. None for non-seat subscriptions." }, "customer_cancellation_reason": { "anyOf": [ { "$ref": "#/components/schemas/CustomerCancellationReason" }, { "type": "null" } ] }, "customer_cancellation_comment": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Customer Cancellation Comment" }, "metadata": { "$ref": "#/components/schemas/MetadataOutputType" }, "custom_field_data": { "additionalProperties": { "anyOf": [ { "type": "string" }, { "type": "integer" }, { "type": "boolean" }, { "type": "string", "format": "date-time" }, { "type": "null" } ] }, "type": "object", "title": "Custom Field Data", "description": "Key-value object storing custom field values." }, "customer": { "$ref": "#/components/schemas/SubscriptionCustomer" }, "product": { "$ref": "#/components/schemas/Product" }, "discount": { "anyOf": [ { "oneOf": [ { "$ref": "#/components/schemas/DiscountFixedOnceForeverDurationBase" }, { "$ref": "#/components/schemas/DiscountFixedRepeatDurationBase" }, { "$ref": "#/components/schemas/DiscountPercentageOnceForeverDurationBase" }, { "$ref": "#/components/schemas/DiscountPercentageRepeatDurationBase" } ], "title": "SubscriptionDiscount" }, { "type": "null" } ], "title": "Discount" }, "prices": { "items": { "oneOf": [ { "$ref": "#/components/schemas/LegacyRecurringProductPrice" }, { "$ref": "#/components/schemas/ProductPrice" } ] }, "type": "array", "title": "Prices", "description": "List of enabled prices for the subscription." }, "meters": { "items": { "$ref": "#/components/schemas/SubscriptionMeter" }, "type": "array", "title": "Meters", "description": "List of meters associated with the subscription." } }, "type": "object", "required": [ "created_at", "modified_at", "id", "amount", "currency", "recurring_interval", "recurring_interval_count", "status", "current_period_start", "current_period_end", "trial_start", "trial_end", "cancel_at_period_end", "canceled_at", "started_at", "ends_at", "ended_at", "customer_id", "product_id", "discount_id", "checkout_id", "customer_cancellation_reason", "customer_cancellation_comment", "metadata", "customer", "product", "discount", "prices", "meters" ], "title": "Subscription" }, "SubscriptionBillingPeriodUpdatedEvent": { "properties": { "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "timestamp": { "type": "string", "format": "date-time", "title": "Timestamp", "description": "The timestamp of the event." }, "organization_id": { "type": "string", "format": "uuid4", "title": "Organization Id", "description": "The ID of the organization owning the event.", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "x-polar-selector-widget": { "displayProperty": "name", "resourceName": "Organization", "resourceRoot": "/v1/organizations" } }, "customer_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Customer Id", "description": "ID of the customer in your Polar organization associated with the event." }, "customer": { "anyOf": [ { "$ref": "#/components/schemas/Customer" }, { "type": "null" } ], "description": "The customer associated with the event." }, "external_customer_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "External Customer Id", "description": "ID of the customer in your system associated with the event." }, "member_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Member Id", "description": "ID of the member within the customer's organization who performed the action inside B2B." }, "external_member_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "External Member Id", "description": "ID of the member in your system within the customer's organization who performed the action inside B2B." }, "child_count": { "type": "integer", "title": "Child Count", "description": "Number of direct child events linked to this event.", "default": 0 }, "parent_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Parent Id", "description": "The ID of the parent event." }, "label": { "type": "string", "title": "Label", "description": "Human readable label of the event type." }, "source": { "type": "string", "const": "system", "title": "Source", "description": "The source of the event. `system` events are created by Polar. `user` events are the one you create through our ingestion API." }, "name": { "type": "string", "const": "subscription.billing_period_updated", "title": "Name", "description": "The name of the event." }, "metadata": { "$ref": "#/components/schemas/SubscriptionBillingPeriodUpdatedMetadata" } }, "type": "object", "required": [ "id", "timestamp", "organization_id", "customer_id", "customer", "external_customer_id", "label", "source", "name", "metadata" ], "title": "SubscriptionBillingPeriodUpdatedEvent", "description": "An event created by Polar when a subscription billing period is updated." }, "SubscriptionBillingPeriodUpdatedMetadata": { "properties": { "subscription_id": { "type": "string", "title": "Subscription Id" }, "old_period_end": { "type": "string", "title": "Old Period End" }, "new_period_end": { "type": "string", "title": "New Period End" } }, "type": "object", "required": [ "subscription_id", "old_period_end", "new_period_end" ], "title": "SubscriptionBillingPeriodUpdatedMetadata" }, "SubscriptionCancel": { "properties": { "customer_cancellation_reason": { "anyOf": [ { "$ref": "#/components/schemas/CustomerCancellationReason" }, { "type": "null" } ], "description": "Customer reason for cancellation.\n\nHelpful to monitor reasons behind churn for future improvements.\n\nOnly set this in case your own service is requesting the reason from the\ncustomer. Or you know based on direct conversations, i.e support, with\nthe customer.\n\n* `too_expensive`: Too expensive for the customer.\n* `missing_features`: Customer is missing certain features.\n* `switched_service`: Customer switched to another service.\n* `unused`: Customer is not using it enough.\n* `customer_service`: Customer is not satisfied with the customer service.\n* `low_quality`: Customer is unhappy with the quality.\n* `too_complex`: Customer considers the service too complicated.\n* `other`: Other reason(s)." }, "customer_cancellation_comment": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Customer Cancellation Comment", "description": "Customer feedback and why they decided to cancel.\n\n**IMPORTANT:**\nDo not use this to store internal notes! It's intended to be input\nfrom the customer and is therefore also available in their Polar\npurchases library.\n\nOnly set this in case your own service is requesting the reason from the\ncustomer. Or you copy a message directly from a customer\nconversation, i.e support." }, "cancel_at_period_end": { "type": "boolean", "title": "Cancel At Period End", "description": "Cancel an active subscription once the current period ends.\n\nOr uncancel a subscription currently set to be revoked at period end." } }, "type": "object", "required": [ "cancel_at_period_end" ], "title": "SubscriptionCancel" }, "SubscriptionCanceledEvent": { "properties": { "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "timestamp": { "type": "string", "format": "date-time", "title": "Timestamp", "description": "The timestamp of the event." }, "organization_id": { "type": "string", "format": "uuid4", "title": "Organization Id", "description": "The ID of the organization owning the event.", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "x-polar-selector-widget": { "displayProperty": "name", "resourceName": "Organization", "resourceRoot": "/v1/organizations" } }, "customer_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Customer Id", "description": "ID of the customer in your Polar organization associated with the event." }, "customer": { "anyOf": [ { "$ref": "#/components/schemas/Customer" }, { "type": "null" } ], "description": "The customer associated with the event." }, "external_customer_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "External Customer Id", "description": "ID of the customer in your system associated with the event." }, "member_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Member Id", "description": "ID of the member within the customer's organization who performed the action inside B2B." }, "external_member_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "External Member Id", "description": "ID of the member in your system within the customer's organization who performed the action inside B2B." }, "child_count": { "type": "integer", "title": "Child Count", "description": "Number of direct child events linked to this event.", "default": 0 }, "parent_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Parent Id", "description": "The ID of the parent event." }, "label": { "type": "string", "title": "Label", "description": "Human readable label of the event type." }, "source": { "type": "string", "const": "system", "title": "Source", "description": "The source of the event. `system` events are created by Polar. `user` events are the one you create through our ingestion API." }, "name": { "type": "string", "const": "subscription.canceled", "title": "Name", "description": "The name of the event." }, "metadata": { "$ref": "#/components/schemas/SubscriptionCanceledMetadata" } }, "type": "object", "required": [ "id", "timestamp", "organization_id", "customer_id", "customer", "external_customer_id", "label", "source", "name", "metadata" ], "title": "SubscriptionCanceledEvent", "description": "An event created by Polar when a subscription is canceled." }, "SubscriptionCanceledMetadata": { "properties": { "subscription_id": { "type": "string", "title": "Subscription Id" }, "product_id": { "type": "string", "title": "Product Id" }, "amount": { "type": "integer", "title": "Amount" }, "currency": { "type": "string", "title": "Currency" }, "recurring_interval": { "type": "string", "title": "Recurring Interval" }, "recurring_interval_count": { "type": "integer", "title": "Recurring Interval Count" }, "customer_cancellation_reason": { "type": "string", "title": "Customer Cancellation Reason" }, "customer_cancellation_comment": { "type": "string", "title": "Customer Cancellation Comment" }, "canceled_at": { "type": "string", "title": "Canceled At" }, "ends_at": { "type": "string", "title": "Ends At" }, "cancel_at_period_end": { "type": "boolean", "title": "Cancel At Period End" } }, "type": "object", "required": [ "subscription_id", "amount", "currency", "recurring_interval", "recurring_interval_count", "canceled_at" ], "title": "SubscriptionCanceledMetadata" }, "SubscriptionCreateCustomer": { "properties": { "metadata": { "additionalProperties": { "anyOf": [ { "type": "string", "maxLength": 500, "minLength": 1 }, { "type": "integer" }, { "type": "number" }, { "type": "boolean" } ] }, "propertyNames": { "maxLength": 40, "minLength": 1 }, "type": "object", "maxProperties": 50, "title": "Metadata", "description": "Key-value object allowing you to store additional information.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**." }, "product_id": { "type": "string", "format": "uuid4", "title": "Product Id", "description": "The ID of the recurring product to subscribe to. Must be a free product, otherwise the customer should go through a checkout flow.", "examples": [ "d8dd2de1-21b7-4a41-8bc3-ce909c0cfe23" ] }, "customer_id": { "type": "string", "format": "uuid4", "title": "Customer Id", "description": "The ID of the customer to create the subscription for.", "examples": [ "992fae2a-2a17-4b7a-8d9e-e287cf90131b" ] } }, "type": "object", "required": [ "product_id", "customer_id" ], "title": "SubscriptionCreateCustomer", "description": "Create a subscription for an existing customer." }, "SubscriptionCreateExternalCustomer": { "properties": { "metadata": { "additionalProperties": { "anyOf": [ { "type": "string", "maxLength": 500, "minLength": 1 }, { "type": "integer" }, { "type": "number" }, { "type": "boolean" } ] }, "propertyNames": { "maxLength": 40, "minLength": 1 }, "type": "object", "maxProperties": 50, "title": "Metadata", "description": "Key-value object allowing you to store additional information.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**." }, "product_id": { "type": "string", "format": "uuid4", "title": "Product Id", "description": "The ID of the recurring product to subscribe to. Must be a free product, otherwise the customer should go through a checkout flow.", "examples": [ "d8dd2de1-21b7-4a41-8bc3-ce909c0cfe23" ] }, "external_customer_id": { "type": "string", "title": "External Customer Id", "description": "The ID of the customer in your system to create the subscription for. It must already exist in Polar." } }, "type": "object", "required": [ "product_id", "external_customer_id" ], "title": "SubscriptionCreateExternalCustomer", "description": "Create a subscription for an existing customer identified by an external ID." }, "SubscriptionCreatedEvent": { "properties": { "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "timestamp": { "type": "string", "format": "date-time", "title": "Timestamp", "description": "The timestamp of the event." }, "organization_id": { "type": "string", "format": "uuid4", "title": "Organization Id", "description": "The ID of the organization owning the event.", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "x-polar-selector-widget": { "displayProperty": "name", "resourceName": "Organization", "resourceRoot": "/v1/organizations" } }, "customer_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Customer Id", "description": "ID of the customer in your Polar organization associated with the event." }, "customer": { "anyOf": [ { "$ref": "#/components/schemas/Customer" }, { "type": "null" } ], "description": "The customer associated with the event." }, "external_customer_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "External Customer Id", "description": "ID of the customer in your system associated with the event." }, "member_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Member Id", "description": "ID of the member within the customer's organization who performed the action inside B2B." }, "external_member_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "External Member Id", "description": "ID of the member in your system within the customer's organization who performed the action inside B2B." }, "child_count": { "type": "integer", "title": "Child Count", "description": "Number of direct child events linked to this event.", "default": 0 }, "parent_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Parent Id", "description": "The ID of the parent event." }, "label": { "type": "string", "title": "Label", "description": "Human readable label of the event type." }, "source": { "type": "string", "const": "system", "title": "Source", "description": "The source of the event. `system` events are created by Polar. `user` events are the one you create through our ingestion API." }, "name": { "type": "string", "const": "subscription.created", "title": "Name", "description": "The name of the event." }, "metadata": { "$ref": "#/components/schemas/SubscriptionCreatedMetadata" } }, "type": "object", "required": [ "id", "timestamp", "organization_id", "customer_id", "customer", "external_customer_id", "label", "source", "name", "metadata" ], "title": "SubscriptionCreatedEvent", "description": "An event created by Polar when a subscription is created." }, "SubscriptionCreatedMetadata": { "properties": { "subscription_id": { "type": "string", "title": "Subscription Id" }, "product_id": { "type": "string", "title": "Product Id" }, "amount": { "type": "integer", "title": "Amount" }, "currency": { "type": "string", "title": "Currency" }, "recurring_interval": { "type": "string", "title": "Recurring Interval" }, "recurring_interval_count": { "type": "integer", "title": "Recurring Interval Count" }, "started_at": { "type": "string", "title": "Started At" } }, "type": "object", "required": [ "subscription_id", "product_id", "amount", "currency", "recurring_interval", "recurring_interval_count", "started_at" ], "title": "SubscriptionCreatedMetadata" }, "SubscriptionCustomer": { "properties": { "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the customer.", "examples": [ "992fae2a-2a17-4b7a-8d9e-e287cf90131b" ] }, "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "metadata": { "$ref": "#/components/schemas/MetadataOutputType" }, "external_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "External Id", "description": "The ID of the customer in your system. This must be unique within the organization. Once set, it can't be updated.", "examples": [ "usr_1337" ] }, "email": { "type": "string", "title": "Email", "description": "The email address of the customer. This must be unique within the organization.", "examples": [ "customer@example.com" ] }, "email_verified": { "type": "boolean", "title": "Email Verified", "description": "Whether the customer email address is verified. The address is automatically verified when the customer accesses the customer portal using their email address.", "examples": [ true ] }, "type": { "anyOf": [ { "$ref": "#/components/schemas/CustomerType" }, { "type": "null" } ], "description": "The type of customer: 'individual' for single users, 'team' for customers with multiple members. Legacy customers may have NULL type which is treated as 'individual'.", "examples": [ "individual" ] }, "name": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Name", "description": "The name of the customer.", "examples": [ "John Doe" ] }, "billing_address": { "anyOf": [ { "$ref": "#/components/schemas/Address" }, { "type": "null" } ] }, "tax_id": { "anyOf": [ { "prefixItems": [ { "type": "string" }, { "$ref": "#/components/schemas/TaxIDFormat" } ], "type": "array", "maxItems": 2, "minItems": 2, "examples": [ [ "911144442", "us_ein" ], [ "FR61954506077", "eu_vat" ] ] }, { "type": "null" } ], "title": "Tax Id" }, "locale": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Locale" }, "organization_id": { "type": "string", "format": "uuid4", "title": "Organization Id", "description": "The ID of the organization owning the customer.", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ] }, "deleted_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Deleted At", "description": "Timestamp for when the customer was soft deleted." }, "avatar_url": { "type": "string", "title": "Avatar Url", "examples": [ "https://www.gravatar.com/avatar/xxx?d=404" ] } }, "type": "object", "required": [ "id", "created_at", "modified_at", "metadata", "email", "email_verified", "name", "billing_address", "tax_id", "organization_id", "deleted_at", "avatar_url" ], "title": "SubscriptionCustomer" }, "SubscriptionCycledEvent": { "properties": { "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "timestamp": { "type": "string", "format": "date-time", "title": "Timestamp", "description": "The timestamp of the event." }, "organization_id": { "type": "string", "format": "uuid4", "title": "Organization Id", "description": "The ID of the organization owning the event.", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "x-polar-selector-widget": { "displayProperty": "name", "resourceName": "Organization", "resourceRoot": "/v1/organizations" } }, "customer_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Customer Id", "description": "ID of the customer in your Polar organization associated with the event." }, "customer": { "anyOf": [ { "$ref": "#/components/schemas/Customer" }, { "type": "null" } ], "description": "The customer associated with the event." }, "external_customer_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "External Customer Id", "description": "ID of the customer in your system associated with the event." }, "member_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Member Id", "description": "ID of the member within the customer's organization who performed the action inside B2B." }, "external_member_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "External Member Id", "description": "ID of the member in your system within the customer's organization who performed the action inside B2B." }, "child_count": { "type": "integer", "title": "Child Count", "description": "Number of direct child events linked to this event.", "default": 0 }, "parent_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Parent Id", "description": "The ID of the parent event." }, "label": { "type": "string", "title": "Label", "description": "Human readable label of the event type." }, "source": { "type": "string", "const": "system", "title": "Source", "description": "The source of the event. `system` events are created by Polar. `user` events are the one you create through our ingestion API." }, "name": { "type": "string", "const": "subscription.cycled", "title": "Name", "description": "The name of the event." }, "metadata": { "$ref": "#/components/schemas/SubscriptionCycledMetadata" } }, "type": "object", "required": [ "id", "timestamp", "organization_id", "customer_id", "customer", "external_customer_id", "label", "source", "name", "metadata" ], "title": "SubscriptionCycledEvent", "description": "An event created by Polar when a subscription is cycled." }, "SubscriptionCycledMetadata": { "properties": { "subscription_id": { "type": "string", "title": "Subscription Id" }, "product_id": { "type": "string", "title": "Product Id" }, "amount": { "type": "integer", "title": "Amount" }, "currency": { "type": "string", "title": "Currency" }, "recurring_interval": { "type": "string", "title": "Recurring Interval" }, "recurring_interval_count": { "type": "integer", "title": "Recurring Interval Count" } }, "type": "object", "required": [ "subscription_id" ], "title": "SubscriptionCycledMetadata" }, "SubscriptionLocked": { "properties": { "error": { "type": "string", "const": "SubscriptionLocked", "title": "Error", "examples": [ "SubscriptionLocked" ] }, "detail": { "type": "string", "title": "Detail" } }, "type": "object", "required": [ "error", "detail" ], "title": "SubscriptionLocked" }, "SubscriptionMeter": { "properties": { "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "consumed_units": { "type": "number", "title": "Consumed Units", "description": "The number of consumed units so far in this billing period.", "examples": [ 25 ] }, "credited_units": { "type": "integer", "title": "Credited Units", "description": "The number of credited units so far in this billing period.", "examples": [ 100 ] }, "amount": { "type": "integer", "title": "Amount", "description": "The amount due in cents so far in this billing period.", "examples": [ 0 ] }, "meter_id": { "type": "string", "format": "uuid4", "title": "Meter Id", "description": "The ID of the meter.", "examples": [ "d498a884-e2cd-4d3e-8002-f536468a8b22" ] }, "meter": { "$ref": "#/components/schemas/Meter", "description": "The meter associated with this subscription." } }, "type": "object", "required": [ "created_at", "modified_at", "id", "consumed_units", "credited_units", "amount", "meter_id", "meter" ], "title": "SubscriptionMeter", "description": "Current consumption and spending for a subscription meter." }, "SubscriptionProductUpdatedEvent": { "properties": { "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "timestamp": { "type": "string", "format": "date-time", "title": "Timestamp", "description": "The timestamp of the event." }, "organization_id": { "type": "string", "format": "uuid4", "title": "Organization Id", "description": "The ID of the organization owning the event.", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "x-polar-selector-widget": { "displayProperty": "name", "resourceName": "Organization", "resourceRoot": "/v1/organizations" } }, "customer_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Customer Id", "description": "ID of the customer in your Polar organization associated with the event." }, "customer": { "anyOf": [ { "$ref": "#/components/schemas/Customer" }, { "type": "null" } ], "description": "The customer associated with the event." }, "external_customer_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "External Customer Id", "description": "ID of the customer in your system associated with the event." }, "member_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Member Id", "description": "ID of the member within the customer's organization who performed the action inside B2B." }, "external_member_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "External Member Id", "description": "ID of the member in your system within the customer's organization who performed the action inside B2B." }, "child_count": { "type": "integer", "title": "Child Count", "description": "Number of direct child events linked to this event.", "default": 0 }, "parent_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Parent Id", "description": "The ID of the parent event." }, "label": { "type": "string", "title": "Label", "description": "Human readable label of the event type." }, "source": { "type": "string", "const": "system", "title": "Source", "description": "The source of the event. `system` events are created by Polar. `user` events are the one you create through our ingestion API." }, "name": { "type": "string", "const": "subscription.product_updated", "title": "Name", "description": "The name of the event." }, "metadata": { "$ref": "#/components/schemas/SubscriptionProductUpdatedMetadata" } }, "type": "object", "required": [ "id", "timestamp", "organization_id", "customer_id", "customer", "external_customer_id", "label", "source", "name", "metadata" ], "title": "SubscriptionProductUpdatedEvent", "description": "An event created by Polar when a subscription changes the product." }, "SubscriptionProductUpdatedMetadata": { "properties": { "subscription_id": { "type": "string", "title": "Subscription Id" }, "old_product_id": { "type": "string", "title": "Old Product Id" }, "new_product_id": { "type": "string", "title": "New Product Id" } }, "type": "object", "required": [ "subscription_id", "old_product_id", "new_product_id" ], "title": "SubscriptionProductUpdatedMetadata" }, "SubscriptionProrationBehavior": { "type": "string", "enum": [ "invoice", "prorate" ], "title": "SubscriptionProrationBehavior" }, "SubscriptionRecurringInterval": { "type": "string", "enum": [ "day", "week", "month", "year" ], "title": "SubscriptionRecurringInterval" }, "SubscriptionRevoke": { "properties": { "customer_cancellation_reason": { "anyOf": [ { "$ref": "#/components/schemas/CustomerCancellationReason" }, { "type": "null" } ], "description": "Customer reason for cancellation.\n\nHelpful to monitor reasons behind churn for future improvements.\n\nOnly set this in case your own service is requesting the reason from the\ncustomer. Or you know based on direct conversations, i.e support, with\nthe customer.\n\n* `too_expensive`: Too expensive for the customer.\n* `missing_features`: Customer is missing certain features.\n* `switched_service`: Customer switched to another service.\n* `unused`: Customer is not using it enough.\n* `customer_service`: Customer is not satisfied with the customer service.\n* `low_quality`: Customer is unhappy with the quality.\n* `too_complex`: Customer considers the service too complicated.\n* `other`: Other reason(s)." }, "customer_cancellation_comment": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Customer Cancellation Comment", "description": "Customer feedback and why they decided to cancel.\n\n**IMPORTANT:**\nDo not use this to store internal notes! It's intended to be input\nfrom the customer and is therefore also available in their Polar\npurchases library.\n\nOnly set this in case your own service is requesting the reason from the\ncustomer. Or you copy a message directly from a customer\nconversation, i.e support." }, "revoke": { "type": "boolean", "const": true, "title": "Revoke", "description": "Cancel and revoke an active subscription immediately" } }, "type": "object", "required": [ "revoke" ], "title": "SubscriptionRevoke" }, "SubscriptionRevokedEvent": { "properties": { "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "timestamp": { "type": "string", "format": "date-time", "title": "Timestamp", "description": "The timestamp of the event." }, "organization_id": { "type": "string", "format": "uuid4", "title": "Organization Id", "description": "The ID of the organization owning the event.", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "x-polar-selector-widget": { "displayProperty": "name", "resourceName": "Organization", "resourceRoot": "/v1/organizations" } }, "customer_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Customer Id", "description": "ID of the customer in your Polar organization associated with the event." }, "customer": { "anyOf": [ { "$ref": "#/components/schemas/Customer" }, { "type": "null" } ], "description": "The customer associated with the event." }, "external_customer_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "External Customer Id", "description": "ID of the customer in your system associated with the event." }, "member_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Member Id", "description": "ID of the member within the customer's organization who performed the action inside B2B." }, "external_member_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "External Member Id", "description": "ID of the member in your system within the customer's organization who performed the action inside B2B." }, "child_count": { "type": "integer", "title": "Child Count", "description": "Number of direct child events linked to this event.", "default": 0 }, "parent_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Parent Id", "description": "The ID of the parent event." }, "label": { "type": "string", "title": "Label", "description": "Human readable label of the event type." }, "source": { "type": "string", "const": "system", "title": "Source", "description": "The source of the event. `system` events are created by Polar. `user` events are the one you create through our ingestion API." }, "name": { "type": "string", "const": "subscription.revoked", "title": "Name", "description": "The name of the event." }, "metadata": { "$ref": "#/components/schemas/SubscriptionRevokedMetadata" } }, "type": "object", "required": [ "id", "timestamp", "organization_id", "customer_id", "customer", "external_customer_id", "label", "source", "name", "metadata" ], "title": "SubscriptionRevokedEvent", "description": "An event created by Polar when a subscription is revoked from a customer." }, "SubscriptionRevokedMetadata": { "properties": { "subscription_id": { "type": "string", "title": "Subscription Id" }, "product_id": { "type": "string", "title": "Product Id" }, "amount": { "type": "integer", "title": "Amount" }, "currency": { "type": "string", "title": "Currency" }, "recurring_interval": { "type": "string", "title": "Recurring Interval" }, "recurring_interval_count": { "type": "integer", "title": "Recurring Interval Count" } }, "type": "object", "required": [ "subscription_id" ], "title": "SubscriptionRevokedMetadata" }, "SubscriptionSeatsUpdatedEvent": { "properties": { "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "timestamp": { "type": "string", "format": "date-time", "title": "Timestamp", "description": "The timestamp of the event." }, "organization_id": { "type": "string", "format": "uuid4", "title": "Organization Id", "description": "The ID of the organization owning the event.", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "x-polar-selector-widget": { "displayProperty": "name", "resourceName": "Organization", "resourceRoot": "/v1/organizations" } }, "customer_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Customer Id", "description": "ID of the customer in your Polar organization associated with the event." }, "customer": { "anyOf": [ { "$ref": "#/components/schemas/Customer" }, { "type": "null" } ], "description": "The customer associated with the event." }, "external_customer_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "External Customer Id", "description": "ID of the customer in your system associated with the event." }, "member_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Member Id", "description": "ID of the member within the customer's organization who performed the action inside B2B." }, "external_member_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "External Member Id", "description": "ID of the member in your system within the customer's organization who performed the action inside B2B." }, "child_count": { "type": "integer", "title": "Child Count", "description": "Number of direct child events linked to this event.", "default": 0 }, "parent_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Parent Id", "description": "The ID of the parent event." }, "label": { "type": "string", "title": "Label", "description": "Human readable label of the event type." }, "source": { "type": "string", "const": "system", "title": "Source", "description": "The source of the event. `system` events are created by Polar. `user` events are the one you create through our ingestion API." }, "name": { "type": "string", "const": "subscription.seats_updated", "title": "Name", "description": "The name of the event." }, "metadata": { "$ref": "#/components/schemas/SubscriptionSeatsUpdatedMetadata" } }, "type": "object", "required": [ "id", "timestamp", "organization_id", "customer_id", "customer", "external_customer_id", "label", "source", "name", "metadata" ], "title": "SubscriptionSeatsUpdatedEvent", "description": "An event created by Polar when a the seats on a subscription is changed." }, "SubscriptionSeatsUpdatedMetadata": { "properties": { "subscription_id": { "type": "string", "title": "Subscription Id" }, "old_seats": { "type": "integer", "title": "Old Seats" }, "new_seats": { "type": "integer", "title": "New Seats" }, "proration_behavior": { "type": "string", "title": "Proration Behavior" } }, "type": "object", "required": [ "subscription_id", "old_seats", "new_seats", "proration_behavior" ], "title": "SubscriptionSeatsUpdatedMetadata" }, "SubscriptionSortProperty": { "type": "string", "enum": [ "customer", "-customer", "status", "-status", "started_at", "-started_at", "current_period_end", "-current_period_end", "ended_at", "-ended_at", "ends_at", "-ends_at", "amount", "-amount", "product", "-product", "discount", "-discount" ], "title": "SubscriptionSortProperty" }, "SubscriptionStatus": { "type": "string", "enum": [ "incomplete", "incomplete_expired", "trialing", "active", "past_due", "canceled", "unpaid" ], "title": "SubscriptionStatus" }, "SubscriptionUncanceledEvent": { "properties": { "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "timestamp": { "type": "string", "format": "date-time", "title": "Timestamp", "description": "The timestamp of the event." }, "organization_id": { "type": "string", "format": "uuid4", "title": "Organization Id", "description": "The ID of the organization owning the event.", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "x-polar-selector-widget": { "displayProperty": "name", "resourceName": "Organization", "resourceRoot": "/v1/organizations" } }, "customer_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Customer Id", "description": "ID of the customer in your Polar organization associated with the event." }, "customer": { "anyOf": [ { "$ref": "#/components/schemas/Customer" }, { "type": "null" } ], "description": "The customer associated with the event." }, "external_customer_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "External Customer Id", "description": "ID of the customer in your system associated with the event." }, "member_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Member Id", "description": "ID of the member within the customer's organization who performed the action inside B2B." }, "external_member_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "External Member Id", "description": "ID of the member in your system within the customer's organization who performed the action inside B2B." }, "child_count": { "type": "integer", "title": "Child Count", "description": "Number of direct child events linked to this event.", "default": 0 }, "parent_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Parent Id", "description": "The ID of the parent event." }, "label": { "type": "string", "title": "Label", "description": "Human readable label of the event type." }, "source": { "type": "string", "const": "system", "title": "Source", "description": "The source of the event. `system` events are created by Polar. `user` events are the one you create through our ingestion API." }, "name": { "type": "string", "const": "subscription.uncanceled", "title": "Name", "description": "The name of the event." }, "metadata": { "$ref": "#/components/schemas/SubscriptionUncanceledMetadata" } }, "type": "object", "required": [ "id", "timestamp", "organization_id", "customer_id", "customer", "external_customer_id", "label", "source", "name", "metadata" ], "title": "SubscriptionUncanceledEvent", "description": "An event created by Polar when a subscription cancellation is reversed." }, "SubscriptionUncanceledMetadata": { "properties": { "subscription_id": { "type": "string", "title": "Subscription Id" }, "product_id": { "type": "string", "title": "Product Id" }, "amount": { "type": "integer", "title": "Amount" }, "currency": { "type": "string", "title": "Currency" }, "recurring_interval": { "type": "string", "title": "Recurring Interval" }, "recurring_interval_count": { "type": "integer", "title": "Recurring Interval Count" } }, "type": "object", "required": [ "subscription_id", "product_id", "amount", "currency", "recurring_interval", "recurring_interval_count" ], "title": "SubscriptionUncanceledMetadata" }, "SubscriptionUpdate": { "anyOf": [ { "$ref": "#/components/schemas/SubscriptionUpdateProduct" }, { "$ref": "#/components/schemas/SubscriptionUpdateDiscount" }, { "$ref": "#/components/schemas/SubscriptionUpdateTrial" }, { "$ref": "#/components/schemas/SubscriptionUpdateSeats" }, { "$ref": "#/components/schemas/SubscriptionUpdateBillingPeriod" }, { "$ref": "#/components/schemas/SubscriptionCancel" }, { "$ref": "#/components/schemas/SubscriptionRevoke" } ] }, "SubscriptionUpdateBillingPeriod": { "properties": { "current_billing_period_end": { "type": "string", "format": "date-time", "title": "Current Billing Period End", "description": "Set a new date for the end of the current billing period. The subscription will renew on this date. Needs to be later than the current value.\n\nIt is not possible to update the current billing period on a canceled subscription." } }, "type": "object", "required": [ "current_billing_period_end" ], "title": "SubscriptionUpdateBillingPeriod" }, "SubscriptionUpdateDiscount": { "properties": { "discount_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Discount Id", "description": "Update the subscription to apply a new discount. If set to `null`, the discount will be removed. The change will be applied on the next billing cycle." } }, "type": "object", "required": [ "discount_id" ], "title": "SubscriptionUpdateDiscount" }, "SubscriptionUpdateProduct": { "properties": { "product_id": { "type": "string", "format": "uuid4", "title": "Product Id", "description": "Update subscription to another product.", "examples": [ "d8dd2de1-21b7-4a41-8bc3-ce909c0cfe23" ] }, "proration_behavior": { "anyOf": [ { "$ref": "#/components/schemas/SubscriptionProrationBehavior" }, { "type": "null" } ], "description": "Determine how to handle the proration billing. If not provided, will use the default organization setting." } }, "type": "object", "required": [ "product_id" ], "title": "SubscriptionUpdateProduct" }, "SubscriptionUpdateSeats": { "properties": { "seats": { "type": "integer", "minimum": 1, "title": "Seats", "description": "Update the number of seats for this subscription." }, "proration_behavior": { "anyOf": [ { "$ref": "#/components/schemas/SubscriptionProrationBehavior" }, { "type": "null" } ], "description": "Determine how to handle the proration billing. If not provided, will use the default organization setting." } }, "type": "object", "required": [ "seats" ], "title": "SubscriptionUpdateSeats" }, "SubscriptionUpdateTrial": { "properties": { "trial_end": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "string", "const": "now" } ], "title": "Trial End", "description": "Set or extend the trial period of the subscription. If set to `now`, the trial will end immediately." } }, "type": "object", "required": [ "trial_end" ], "title": "SubscriptionUpdateTrial" }, "SubscriptionUser": { "properties": { "id": { "type": "string", "format": "uuid4", "title": "Id" }, "email": { "type": "string", "title": "Email" }, "public_name": { "type": "string", "title": "Public Name" }, "avatar_url": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Avatar Url" }, "github_username": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Github Username" } }, "type": "object", "required": [ "id", "email", "public_name" ], "title": "SubscriptionUser" }, "SystemEvent": { "oneOf": [ { "$ref": "#/components/schemas/MeterCreditEvent" }, { "$ref": "#/components/schemas/MeterResetEvent" }, { "$ref": "#/components/schemas/BenefitGrantedEvent" }, { "$ref": "#/components/schemas/BenefitCycledEvent" }, { "$ref": "#/components/schemas/BenefitUpdatedEvent" }, { "$ref": "#/components/schemas/BenefitRevokedEvent" }, { "$ref": "#/components/schemas/SubscriptionCreatedEvent" }, { "$ref": "#/components/schemas/SubscriptionCycledEvent" }, { "$ref": "#/components/schemas/SubscriptionCanceledEvent" }, { "$ref": "#/components/schemas/SubscriptionRevokedEvent" }, { "$ref": "#/components/schemas/SubscriptionUncanceledEvent" }, { "$ref": "#/components/schemas/SubscriptionProductUpdatedEvent" }, { "$ref": "#/components/schemas/SubscriptionSeatsUpdatedEvent" }, { "$ref": "#/components/schemas/SubscriptionBillingPeriodUpdatedEvent" }, { "$ref": "#/components/schemas/OrderPaidEvent" }, { "$ref": "#/components/schemas/OrderRefundedEvent" }, { "$ref": "#/components/schemas/CheckoutCreatedEvent" }, { "$ref": "#/components/schemas/CustomerCreatedEvent" }, { "$ref": "#/components/schemas/CustomerUpdatedEvent" }, { "$ref": "#/components/schemas/CustomerDeletedEvent" }, { "$ref": "#/components/schemas/BalanceOrderEvent" }, { "$ref": "#/components/schemas/BalanceCreditOrderEvent" }, { "$ref": "#/components/schemas/BalanceRefundEvent" }, { "$ref": "#/components/schemas/BalanceRefundReversalEvent" }, { "$ref": "#/components/schemas/BalanceDisputeEvent" }, { "$ref": "#/components/schemas/BalanceDisputeReversalEvent" } ], "discriminator": { "propertyName": "name", "mapping": { "balance.credit_order": "#/components/schemas/BalanceCreditOrderEvent", "balance.dispute": "#/components/schemas/BalanceDisputeEvent", "balance.dispute_reversal": "#/components/schemas/BalanceDisputeReversalEvent", "balance.order": "#/components/schemas/BalanceOrderEvent", "balance.refund": "#/components/schemas/BalanceRefundEvent", "balance.refund_reversal": "#/components/schemas/BalanceRefundReversalEvent", "benefit.cycled": "#/components/schemas/BenefitCycledEvent", "benefit.granted": "#/components/schemas/BenefitGrantedEvent", "benefit.revoked": "#/components/schemas/BenefitRevokedEvent", "benefit.updated": "#/components/schemas/BenefitUpdatedEvent", "checkout.created": "#/components/schemas/CheckoutCreatedEvent", "customer.created": "#/components/schemas/CustomerCreatedEvent", "customer.deleted": "#/components/schemas/CustomerDeletedEvent", "customer.updated": "#/components/schemas/CustomerUpdatedEvent", "meter.credited": "#/components/schemas/MeterCreditEvent", "meter.reset": "#/components/schemas/MeterResetEvent", "order.paid": "#/components/schemas/OrderPaidEvent", "order.refunded": "#/components/schemas/OrderRefundedEvent", "subscription.billing_period_updated": "#/components/schemas/SubscriptionBillingPeriodUpdatedEvent", "subscription.canceled": "#/components/schemas/SubscriptionCanceledEvent", "subscription.created": "#/components/schemas/SubscriptionCreatedEvent", "subscription.cycled": "#/components/schemas/SubscriptionCycledEvent", "subscription.product_updated": "#/components/schemas/SubscriptionProductUpdatedEvent", "subscription.revoked": "#/components/schemas/SubscriptionRevokedEvent", "subscription.seats_updated": "#/components/schemas/SubscriptionSeatsUpdatedEvent", "subscription.uncanceled": "#/components/schemas/SubscriptionUncanceledEvent" } } }, "TaxIDFormat": { "type": "string", "enum": [ "ad_nrt", "ae_trn", "ar_cuit", "au_abn", "au_arn", "bg_uic", "bh_vat", "bo_tin", "br_cnpj", "br_cpf", "ca_bn", "ca_gst_hst", "ca_pst_bc", "ca_pst_mb", "ca_pst_sk", "ca_qst", "ch_uid", "ch_vat", "cl_tin", "cn_tin", "co_nit", "cr_tin", "de_stn", "do_rcn", "ec_ruc", "eg_tin", "es_cif", "eu_oss_vat", "eu_vat", "gb_vat", "ge_vat", "hk_br", "hr_oib", "hu_tin", "id_npwp", "il_vat", "in_gst", "is_vat", "jp_cn", "jp_rn", "jp_trn", "ke_pin", "kr_brn", "kz_bin", "li_uid", "mk_vat", "mx_rfc", "my_frp", "my_itn", "my_sst", "ng_tin", "no_vat", "no_voec", "nz_gst", "om_vat", "pe_ruc", "ph_tin", "ro_tin", "rs_pib", "ru_inn", "ru_kpp", "sa_vat", "sg_gst", "sg_uen", "si_tin", "sv_nit", "th_vat", "tr_tin", "tw_vat", "ua_vat", "us_ein", "uy_ruc", "ve_rif", "vn_tin", "za_vat" ], "title": "TaxIDFormat", "description": "List of supported tax ID formats.\n\nRef: https://docs.stripe.com/billing/customer/tax-ids#supported-tax-id" }, "TimeInterval": { "type": "string", "enum": [ "year", "month", "week", "day", "hour" ], "title": "TimeInterval" }, "TokenResponse": { "properties": { "access_token": { "type": "string", "title": "Access Token" }, "token_type": { "type": "string", "const": "Bearer", "title": "Token Type" }, "expires_in": { "type": "integer", "title": "Expires In" }, "refresh_token": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Refresh Token" }, "scope": { "type": "string", "title": "Scope" }, "id_token": { "type": "string", "title": "Id Token" } }, "type": "object", "required": [ "access_token", "token_type", "expires_in", "refresh_token", "scope", "id_token" ], "title": "TokenResponse" }, "TrialAlreadyRedeemed": { "properties": { "error": { "type": "string", "const": "TrialAlreadyRedeemed", "title": "Error", "examples": [ "TrialAlreadyRedeemed" ] }, "detail": { "type": "string", "title": "Detail" } }, "type": "object", "required": [ "error", "detail" ], "title": "TrialAlreadyRedeemed" }, "TrialInterval": { "type": "string", "enum": [ "day", "week", "month", "year" ], "title": "TrialInterval" }, "Unauthorized": { "properties": { "error": { "type": "string", "const": "Unauthorized", "title": "Error", "examples": [ "Unauthorized" ] }, "detail": { "type": "string", "title": "Detail" } }, "type": "object", "required": [ "error", "detail" ], "title": "Unauthorized" }, "UniqueAggregation": { "properties": { "func": { "type": "string", "const": "unique", "title": "Func", "default": "unique" }, "property": { "type": "string", "title": "Property" } }, "type": "object", "required": [ "property" ], "title": "UniqueAggregation" }, "UserEvent": { "properties": { "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "timestamp": { "type": "string", "format": "date-time", "title": "Timestamp", "description": "The timestamp of the event." }, "organization_id": { "type": "string", "format": "uuid4", "title": "Organization Id", "description": "The ID of the organization owning the event.", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "x-polar-selector-widget": { "displayProperty": "name", "resourceName": "Organization", "resourceRoot": "/v1/organizations" } }, "customer_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Customer Id", "description": "ID of the customer in your Polar organization associated with the event." }, "customer": { "anyOf": [ { "$ref": "#/components/schemas/Customer" }, { "type": "null" } ], "description": "The customer associated with the event." }, "external_customer_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "External Customer Id", "description": "ID of the customer in your system associated with the event." }, "member_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Member Id", "description": "ID of the member within the customer's organization who performed the action inside B2B." }, "external_member_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "External Member Id", "description": "ID of the member in your system within the customer's organization who performed the action inside B2B." }, "child_count": { "type": "integer", "title": "Child Count", "description": "Number of direct child events linked to this event.", "default": 0 }, "parent_id": { "anyOf": [ { "type": "string", "format": "uuid4" }, { "type": "null" } ], "title": "Parent Id", "description": "The ID of the parent event." }, "label": { "type": "string", "title": "Label", "description": "Human readable label of the event type." }, "name": { "type": "string", "title": "Name", "description": "The name of the event." }, "source": { "type": "string", "const": "user", "title": "Source", "description": "The source of the event. `system` events are created by Polar. `user` events are the one you create through our ingestion API." }, "metadata": { "$ref": "#/components/schemas/EventMetadataOutput" } }, "type": "object", "required": [ "id", "timestamp", "organization_id", "customer_id", "customer", "external_customer_id", "label", "name", "source", "metadata" ], "title": "UserEvent", "description": "An event you created through the ingestion API." }, "UserInfoOrganization": { "properties": { "sub": { "type": "string", "title": "Sub" }, "name": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Name" } }, "type": "object", "required": [ "sub" ], "title": "UserInfoOrganization" }, "UserInfoUser": { "properties": { "sub": { "type": "string", "title": "Sub" }, "name": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Name" }, "email": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Email" }, "email_verified": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "title": "Email Verified" } }, "type": "object", "required": [ "sub" ], "title": "UserInfoUser" }, "ValidatedLicenseKey": { "properties": { "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "organization_id": { "type": "string", "format": "uuid4", "title": "Organization Id" }, "customer_id": { "type": "string", "format": "uuid4", "title": "Customer Id" }, "customer": { "$ref": "#/components/schemas/LicenseKeyCustomer" }, "benefit_id": { "type": "string", "format": "uuid4", "title": "Benefit Id", "description": "The benefit ID.", "x-polar-selector-widget": { "displayProperty": "description", "resourceName": "Benefit", "resourceRoot": "/v1/benefits" } }, "key": { "type": "string", "title": "Key" }, "display_key": { "type": "string", "title": "Display Key" }, "status": { "$ref": "#/components/schemas/LicenseKeyStatus" }, "limit_activations": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Limit Activations" }, "usage": { "type": "integer", "title": "Usage" }, "limit_usage": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Limit Usage" }, "validations": { "type": "integer", "title": "Validations" }, "last_validated_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Last Validated At" }, "expires_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Expires At" }, "activation": { "anyOf": [ { "$ref": "#/components/schemas/LicenseKeyActivationBase" }, { "type": "null" } ] } }, "type": "object", "required": [ "id", "created_at", "modified_at", "organization_id", "customer_id", "customer", "benefit_id", "key", "display_key", "status", "limit_activations", "usage", "limit_usage", "validations", "last_validated_at", "expires_at" ], "title": "ValidatedLicenseKey" }, "ValidationError": { "properties": { "loc": { "items": { "anyOf": [ { "type": "string" }, { "type": "integer" } ] }, "type": "array", "title": "Location" }, "msg": { "type": "string", "title": "Message" }, "type": { "type": "string", "title": "Error Type" }, "input": { "title": "Input" }, "ctx": { "type": "object", "title": "Context" } }, "type": "object", "required": [ "loc", "msg", "type" ], "title": "ValidationError" }, "WebhookBenefitCreatedPayload": { "properties": { "type": { "type": "string", "const": "benefit.created", "title": "Type", "examples": [ "benefit.created" ] }, "timestamp": { "type": "string", "format": "date-time", "title": "Timestamp" }, "data": { "$ref": "#/components/schemas/Benefit", "title": "Benefit" } }, "type": "object", "required": [ "type", "timestamp", "data" ], "title": "WebhookBenefitCreatedPayload", "description": "Sent when a new benefit is created.\n\n**Discord & Slack support:** Basic" }, "WebhookBenefitGrantCreatedPayload": { "properties": { "type": { "type": "string", "const": "benefit_grant.created", "title": "Type", "examples": [ "benefit_grant.created" ] }, "timestamp": { "type": "string", "format": "date-time", "title": "Timestamp" }, "data": { "$ref": "#/components/schemas/BenefitGrantWebhook", "title": "BenefitGrantWebhook" } }, "type": "object", "required": [ "type", "timestamp", "data" ], "title": "WebhookBenefitGrantCreatedPayload", "description": "Sent when a new benefit grant is created.\n\n**Discord & Slack support:** Basic" }, "WebhookBenefitGrantCycledPayload": { "properties": { "type": { "type": "string", "const": "benefit_grant.cycled", "title": "Type", "examples": [ "benefit_grant.cycled" ] }, "timestamp": { "type": "string", "format": "date-time", "title": "Timestamp" }, "data": { "$ref": "#/components/schemas/BenefitGrantWebhook", "title": "BenefitGrantWebhook" } }, "type": "object", "required": [ "type", "timestamp", "data" ], "title": "WebhookBenefitGrantCycledPayload", "description": "Sent when a benefit grant is cycled,\nmeaning the related subscription has been renewed for another period.\n\n**Discord & Slack support:** Basic" }, "WebhookBenefitGrantRevokedPayload": { "properties": { "type": { "type": "string", "const": "benefit_grant.revoked", "title": "Type", "examples": [ "benefit_grant.revoked" ] }, "timestamp": { "type": "string", "format": "date-time", "title": "Timestamp" }, "data": { "$ref": "#/components/schemas/BenefitGrantWebhook", "title": "BenefitGrantWebhook" } }, "type": "object", "required": [ "type", "timestamp", "data" ], "title": "WebhookBenefitGrantRevokedPayload", "description": "Sent when a benefit grant is revoked.\n\n**Discord & Slack support:** Basic" }, "WebhookBenefitGrantUpdatedPayload": { "properties": { "type": { "type": "string", "const": "benefit_grant.updated", "title": "Type", "examples": [ "benefit_grant.updated" ] }, "timestamp": { "type": "string", "format": "date-time", "title": "Timestamp" }, "data": { "$ref": "#/components/schemas/BenefitGrantWebhook", "title": "BenefitGrantWebhook" } }, "type": "object", "required": [ "type", "timestamp", "data" ], "title": "WebhookBenefitGrantUpdatedPayload", "description": "Sent when a benefit grant is updated.\n\n**Discord & Slack support:** Basic" }, "WebhookBenefitUpdatedPayload": { "properties": { "type": { "type": "string", "const": "benefit.updated", "title": "Type", "examples": [ "benefit.updated" ] }, "timestamp": { "type": "string", "format": "date-time", "title": "Timestamp" }, "data": { "$ref": "#/components/schemas/Benefit", "title": "Benefit" } }, "type": "object", "required": [ "type", "timestamp", "data" ], "title": "WebhookBenefitUpdatedPayload", "description": "Sent when a benefit is updated.\n\n**Discord & Slack support:** Basic" }, "WebhookCheckoutCreatedPayload": { "properties": { "type": { "type": "string", "const": "checkout.created", "title": "Type", "examples": [ "checkout.created" ] }, "timestamp": { "type": "string", "format": "date-time", "title": "Timestamp" }, "data": { "$ref": "#/components/schemas/Checkout" } }, "type": "object", "required": [ "type", "timestamp", "data" ], "title": "WebhookCheckoutCreatedPayload", "description": "Sent when a new checkout is created.\n\n**Discord & Slack support:** Basic" }, "WebhookCheckoutExpiredPayload": { "properties": { "type": { "type": "string", "const": "checkout.expired", "title": "Type", "examples": [ "checkout.expired" ] }, "timestamp": { "type": "string", "format": "date-time", "title": "Timestamp" }, "data": { "$ref": "#/components/schemas/Checkout" } }, "type": "object", "required": [ "type", "timestamp", "data" ], "title": "WebhookCheckoutExpiredPayload", "description": "Sent when a checkout expires.\n\nThis event fires when a checkout reaches its expiration time without being completed.\nDevelopers can use this to send reminder emails or track checkout abandonment.\n\n**Discord & Slack support:** Basic" }, "WebhookCheckoutUpdatedPayload": { "properties": { "type": { "type": "string", "const": "checkout.updated", "title": "Type", "examples": [ "checkout.updated" ] }, "timestamp": { "type": "string", "format": "date-time", "title": "Timestamp" }, "data": { "$ref": "#/components/schemas/Checkout" } }, "type": "object", "required": [ "type", "timestamp", "data" ], "title": "WebhookCheckoutUpdatedPayload", "description": "Sent when a checkout is updated.\n\n**Discord & Slack support:** Basic" }, "WebhookCustomerCreatedPayload": { "properties": { "type": { "type": "string", "const": "customer.created", "title": "Type", "examples": [ "customer.created" ] }, "timestamp": { "type": "string", "format": "date-time", "title": "Timestamp" }, "data": { "$ref": "#/components/schemas/Customer" } }, "type": "object", "required": [ "type", "timestamp", "data" ], "title": "WebhookCustomerCreatedPayload", "description": "Sent when a new customer is created.\n\nA customer can be created:\n\n* After a successful checkout.\n* Programmatically via the API.\n\n**Discord & Slack support:** Basic" }, "WebhookCustomerDeletedPayload": { "properties": { "type": { "type": "string", "const": "customer.deleted", "title": "Type", "examples": [ "customer.deleted" ] }, "timestamp": { "type": "string", "format": "date-time", "title": "Timestamp" }, "data": { "$ref": "#/components/schemas/Customer" } }, "type": "object", "required": [ "type", "timestamp", "data" ], "title": "WebhookCustomerDeletedPayload", "description": "Sent when a customer is deleted.\n\n**Discord & Slack support:** Basic" }, "WebhookCustomerSeatAssignedPayload": { "properties": { "type": { "type": "string", "const": "customer_seat.assigned", "title": "Type", "examples": [ "customer_seat.assigned" ] }, "timestamp": { "type": "string", "format": "date-time", "title": "Timestamp" }, "data": { "$ref": "#/components/schemas/CustomerSeat" } }, "type": "object", "required": [ "type", "timestamp", "data" ], "title": "WebhookCustomerSeatAssignedPayload", "description": "Sent when a new customer seat is assigned.\n\nThis event is triggered when a seat is assigned to a customer by the organization.\nThe customer will receive an invitation email to claim the seat." }, "WebhookCustomerSeatClaimedPayload": { "properties": { "type": { "type": "string", "const": "customer_seat.claimed", "title": "Type", "examples": [ "customer_seat.claimed" ] }, "timestamp": { "type": "string", "format": "date-time", "title": "Timestamp" }, "data": { "$ref": "#/components/schemas/CustomerSeat" } }, "type": "object", "required": [ "type", "timestamp", "data" ], "title": "WebhookCustomerSeatClaimedPayload", "description": "Sent when a customer seat is claimed.\n\nThis event is triggered when a customer accepts the seat invitation and claims their access." }, "WebhookCustomerSeatRevokedPayload": { "properties": { "type": { "type": "string", "const": "customer_seat.revoked", "title": "Type", "examples": [ "customer_seat.revoked" ] }, "timestamp": { "type": "string", "format": "date-time", "title": "Timestamp" }, "data": { "$ref": "#/components/schemas/CustomerSeat" } }, "type": "object", "required": [ "type", "timestamp", "data" ], "title": "WebhookCustomerSeatRevokedPayload", "description": "Sent when a customer seat is revoked.\n\nThis event is triggered when access to a seat is revoked, either manually by the organization or automatically when a subscription is canceled." }, "WebhookCustomerStateChangedPayload": { "properties": { "type": { "type": "string", "const": "customer.state_changed", "title": "Type", "examples": [ "customer.state_changed" ] }, "timestamp": { "type": "string", "format": "date-time", "title": "Timestamp" }, "data": { "$ref": "#/components/schemas/CustomerState" } }, "type": "object", "required": [ "type", "timestamp", "data" ], "title": "WebhookCustomerStateChangedPayload", "description": "Sent when a customer state has changed.\n\nIt's triggered when:\n\n* Customer is created, updated or deleted.\n* A subscription is created or updated.\n* A benefit is granted or revoked.\n\n**Discord & Slack support:** Basic" }, "WebhookCustomerUpdatedPayload": { "properties": { "type": { "type": "string", "const": "customer.updated", "title": "Type", "examples": [ "customer.updated" ] }, "timestamp": { "type": "string", "format": "date-time", "title": "Timestamp" }, "data": { "$ref": "#/components/schemas/Customer" } }, "type": "object", "required": [ "type", "timestamp", "data" ], "title": "WebhookCustomerUpdatedPayload", "description": "Sent when a customer is updated.\n\nThis event is fired when the customer details are updated.\n\nIf you want to be notified when a customer subscription or benefit state changes, you should listen to the `customer_state_changed` event.\n\n**Discord & Slack support:** Basic" }, "WebhookDelivery": { "properties": { "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "succeeded": { "type": "boolean", "title": "Succeeded", "description": "Whether the delivery was successful." }, "http_code": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Http Code", "description": "The HTTP code returned by the URL. `null` if the endpoint was unreachable." }, "response": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Response", "description": "The response body returned by the URL, or the error message if the endpoint was unreachable." }, "webhook_event": { "$ref": "#/components/schemas/WebhookEvent", "description": "The webhook event sent by this delivery." } }, "type": "object", "required": [ "created_at", "modified_at", "id", "succeeded", "http_code", "response", "webhook_event" ], "title": "WebhookDelivery", "description": "A webhook delivery for a webhook event." }, "WebhookEndpoint": { "properties": { "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "url": { "type": "string", "maxLength": 2083, "minLength": 1, "format": "uri", "title": "Url", "description": "The URL where the webhook events will be sent.", "examples": [ "https://webhook.site/cb791d80-f26e-4f8c-be88-6e56054192b0" ] }, "name": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Name", "description": "An optional name for the webhook endpoint to help organize and identify it." }, "format": { "$ref": "#/components/schemas/WebhookFormat", "description": "The format of the webhook payload." }, "secret": { "type": "string", "title": "Secret", "description": "The secret used to sign the webhook events.", "examples": [ "polar_whs_ovyN6cPrTv56AApvzCaJno08SSmGJmgbWilb33N2JuK" ] }, "organization_id": { "type": "string", "format": "uuid4", "title": "Organization Id", "description": "The organization ID associated with the webhook endpoint." }, "events": { "items": { "$ref": "#/components/schemas/WebhookEventType" }, "type": "array", "title": "Events", "description": "The events that will trigger the webhook." }, "enabled": { "type": "boolean", "title": "Enabled", "description": "Whether the webhook endpoint is enabled and will receive events." } }, "type": "object", "required": [ "created_at", "modified_at", "id", "url", "format", "secret", "organization_id", "events", "enabled" ], "title": "WebhookEndpoint", "description": "A webhook endpoint." }, "WebhookEndpointCreate": { "properties": { "url": { "type": "string", "maxLength": 2083, "minLength": 1, "format": "uri", "title": "Url", "description": "The URL where the webhook events will be sent.", "examples": [ "https://webhook.site/cb791d80-f26e-4f8c-be88-6e56054192b0" ] }, "name": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Name", "description": "An optional name for the webhook endpoint to help organize and identify it." }, "format": { "$ref": "#/components/schemas/WebhookFormat", "description": "The format of the webhook payload." }, "events": { "items": { "$ref": "#/components/schemas/WebhookEventType" }, "type": "array", "title": "Events", "description": "The events that will trigger the webhook." }, "organization_id": { "anyOf": [ { "type": "string", "format": "uuid4", "description": "The organization ID.", "examples": [ "1dbfc517-0bbf-4301-9ba8-555ca42b9737" ], "x-polar-selector-widget": { "displayProperty": "name", "resourceName": "Organization", "resourceRoot": "/v1/organizations" } }, { "type": "null" } ], "title": "Organization Id", "description": "The organization ID associated with the webhook endpoint. **Required unless you use an organization token.**" } }, "type": "object", "required": [ "url", "format", "events" ], "title": "WebhookEndpointCreate", "description": "Schema to create a webhook endpoint." }, "WebhookEndpointUpdate": { "properties": { "url": { "anyOf": [ { "type": "string", "maxLength": 2083, "minLength": 1, "format": "uri", "description": "The URL where the webhook events will be sent.", "examples": [ "https://webhook.site/cb791d80-f26e-4f8c-be88-6e56054192b0" ] }, { "type": "null" } ], "title": "Url" }, "name": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Name", "description": "An optional name for the webhook endpoint to help organize and identify it." }, "format": { "anyOf": [ { "$ref": "#/components/schemas/WebhookFormat", "description": "The format of the webhook payload." }, { "type": "null" } ] }, "events": { "anyOf": [ { "items": { "$ref": "#/components/schemas/WebhookEventType" }, "type": "array", "description": "The events that will trigger the webhook." }, { "type": "null" } ], "title": "Events" }, "enabled": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "title": "Enabled", "description": "Whether the webhook endpoint is enabled." } }, "type": "object", "title": "WebhookEndpointUpdate", "description": "Schema to update a webhook endpoint." }, "WebhookEvent": { "properties": { "created_at": { "type": "string", "format": "date-time", "title": "Created At", "description": "Creation timestamp of the object." }, "modified_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Modified At", "description": "Last modification timestamp of the object." }, "id": { "type": "string", "format": "uuid4", "title": "Id", "description": "The ID of the object." }, "last_http_code": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Last Http Code", "description": "Last HTTP code returned by the URL. `null` if no delviery has been attempted or if the endpoint was unreachable." }, "succeeded": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "title": "Succeeded", "description": "Whether this event was successfully delivered. `null` if no delivery has been attempted." }, "skipped": { "type": "boolean", "title": "Skipped", "description": "Whether this event was skipped because the webhook endpoint was disabled." }, "payload": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Payload", "description": "The payload of the webhook event." }, "type": { "$ref": "#/components/schemas/WebhookEventType", "description": "The type of the webhook event." }, "is_archived": { "type": "boolean", "title": "Is Archived", "description": "Whether this event is archived. Archived events can't be redelivered, and the payload is not accessible anymore." } }, "type": "object", "required": [ "created_at", "modified_at", "id", "skipped", "payload", "type", "is_archived" ], "title": "WebhookEvent", "description": "A webhook event.\n\nAn event represent something that happened in the system\nthat should be sent to the webhook endpoint.\n\nIt can be delivered multiple times until it's marked as succeeded,\neach one creating a new delivery." }, "WebhookEventType": { "type": "string", "enum": [ "checkout.created", "checkout.updated", "checkout.expired", "customer.created", "customer.updated", "customer.deleted", "customer.state_changed", "customer_seat.assigned", "customer_seat.claimed", "customer_seat.revoked", "member.created", "member.updated", "member.deleted", "order.created", "order.updated", "order.paid", "order.refunded", "subscription.created", "subscription.updated", "subscription.active", "subscription.canceled", "subscription.uncanceled", "subscription.revoked", "subscription.past_due", "refund.created", "refund.updated", "product.created", "product.updated", "benefit.created", "benefit.updated", "benefit_grant.created", "benefit_grant.cycled", "benefit_grant.updated", "benefit_grant.revoked", "organization.updated" ], "title": "WebhookEventType" }, "WebhookFormat": { "type": "string", "enum": [ "raw", "discord", "slack" ], "title": "WebhookFormat" }, "WebhookMemberCreatedPayload": { "properties": { "type": { "type": "string", "const": "member.created", "title": "Type", "examples": [ "member.created" ] }, "timestamp": { "type": "string", "format": "date-time", "title": "Timestamp" }, "data": { "$ref": "#/components/schemas/Member" } }, "type": "object", "required": [ "type", "timestamp", "data" ], "title": "WebhookMemberCreatedPayload", "description": "Sent when a new member is created.\n\nA member represents an individual within a customer (team).\nThis event is triggered when a member is added to a customer,\neither programmatically via the API or when an owner is automatically\ncreated for a new customer.\n\n**Discord & Slack support:** Basic" }, "WebhookMemberDeletedPayload": { "properties": { "type": { "type": "string", "const": "member.deleted", "title": "Type", "examples": [ "member.deleted" ] }, "timestamp": { "type": "string", "format": "date-time", "title": "Timestamp" }, "data": { "$ref": "#/components/schemas/Member" } }, "type": "object", "required": [ "type", "timestamp", "data" ], "title": "WebhookMemberDeletedPayload", "description": "Sent when a member is deleted.\n\nThis event is triggered when a member is removed from a customer.\nAny active seats assigned to the member will be automatically revoked.\n\n**Discord & Slack support:** Basic" }, "WebhookMemberUpdatedPayload": { "properties": { "type": { "type": "string", "const": "member.updated", "title": "Type", "examples": [ "member.updated" ] }, "timestamp": { "type": "string", "format": "date-time", "title": "Timestamp" }, "data": { "$ref": "#/components/schemas/Member" } }, "type": "object", "required": [ "type", "timestamp", "data" ], "title": "WebhookMemberUpdatedPayload", "description": "Sent when a member is updated.\n\nThis event is triggered when member details are updated,\nsuch as their name or role within the customer.\n\n**Discord & Slack support:** Basic" }, "WebhookOrderCreatedPayload": { "properties": { "type": { "type": "string", "const": "order.created", "title": "Type", "examples": [ "order.created" ] }, "timestamp": { "type": "string", "format": "date-time", "title": "Timestamp" }, "data": { "$ref": "#/components/schemas/Order" } }, "type": "object", "required": [ "type", "timestamp", "data" ], "title": "WebhookOrderCreatedPayload", "description": "Sent when a new order is created.\n\nA new order is created when:\n\n* A customer purchases a one-time product. In this case, `billing_reason` is set to `purchase`.\n* A customer starts a subscription. In this case, `billing_reason` is set to `subscription_create`.\n* A subscription is renewed. In this case, `billing_reason` is set to `subscription_cycle`.\n* A subscription is upgraded or downgraded with an immediate proration invoice. In this case, `billing_reason` is set to `subscription_update`.\n\n> [!WARNING]\n> The order might not be paid yet, so the `status` field might be `pending`.\n\n**Discord & Slack support:** Full" }, "WebhookOrderPaidPayload": { "properties": { "type": { "type": "string", "const": "order.paid", "title": "Type", "examples": [ "order.paid" ] }, "timestamp": { "type": "string", "format": "date-time", "title": "Timestamp" }, "data": { "$ref": "#/components/schemas/Order" } }, "type": "object", "required": [ "type", "timestamp", "data" ], "title": "WebhookOrderPaidPayload", "description": "Sent when an order is paid.\n\nWhen you receive this event, the order is fully processed and payment has been received.\n\n**Discord & Slack support:** Full" }, "WebhookOrderRefundedPayload": { "properties": { "type": { "type": "string", "const": "order.refunded", "title": "Type", "examples": [ "order.refunded" ] }, "timestamp": { "type": "string", "format": "date-time", "title": "Timestamp" }, "data": { "$ref": "#/components/schemas/Order" } }, "type": "object", "required": [ "type", "timestamp", "data" ], "title": "WebhookOrderRefundedPayload", "description": "Sent when an order is fully or partially refunded.\n\n**Discord & Slack support:** Full" }, "WebhookOrderUpdatedPayload": { "properties": { "type": { "type": "string", "const": "order.updated", "title": "Type", "examples": [ "order.updated" ] }, "timestamp": { "type": "string", "format": "date-time", "title": "Timestamp" }, "data": { "$ref": "#/components/schemas/Order" } }, "type": "object", "required": [ "type", "timestamp", "data" ], "title": "WebhookOrderUpdatedPayload", "description": "Sent when an order is updated.\n\nAn order is updated when:\n\n* Its status changes, e.g. from `pending` to `paid`.\n* It's refunded, partially or fully.\n\n**Discord & Slack support:** Full" }, "WebhookOrganizationUpdatedPayload": { "properties": { "type": { "type": "string", "const": "organization.updated", "title": "Type", "examples": [ "organization.updated" ] }, "timestamp": { "type": "string", "format": "date-time", "title": "Timestamp" }, "data": { "$ref": "#/components/schemas/Organization" } }, "type": "object", "required": [ "type", "timestamp", "data" ], "title": "WebhookOrganizationUpdatedPayload", "description": "Sent when a organization is updated.\n\n**Discord & Slack support:** Basic" }, "WebhookProductCreatedPayload": { "properties": { "type": { "type": "string", "const": "product.created", "title": "Type", "examples": [ "product.created" ] }, "timestamp": { "type": "string", "format": "date-time", "title": "Timestamp" }, "data": { "$ref": "#/components/schemas/Product" } }, "type": "object", "required": [ "type", "timestamp", "data" ], "title": "WebhookProductCreatedPayload", "description": "Sent when a new product is created.\n\n**Discord & Slack support:** Basic" }, "WebhookProductUpdatedPayload": { "properties": { "type": { "type": "string", "const": "product.updated", "title": "Type", "examples": [ "product.updated" ] }, "timestamp": { "type": "string", "format": "date-time", "title": "Timestamp" }, "data": { "$ref": "#/components/schemas/Product" } }, "type": "object", "required": [ "type", "timestamp", "data" ], "title": "WebhookProductUpdatedPayload", "description": "Sent when a product is updated.\n\n**Discord & Slack support:** Basic" }, "WebhookRefundCreatedPayload": { "properties": { "type": { "type": "string", "const": "refund.created", "title": "Type", "examples": [ "refund.created" ] }, "timestamp": { "type": "string", "format": "date-time", "title": "Timestamp" }, "data": { "$ref": "#/components/schemas/Refund" } }, "type": "object", "required": [ "type", "timestamp", "data" ], "title": "WebhookRefundCreatedPayload", "description": "Sent when a refund is created regardless of status.\n\n**Discord & Slack support:** Full" }, "WebhookRefundUpdatedPayload": { "properties": { "type": { "type": "string", "const": "refund.updated", "title": "Type", "examples": [ "refund.updated" ] }, "timestamp": { "type": "string", "format": "date-time", "title": "Timestamp" }, "data": { "$ref": "#/components/schemas/Refund" } }, "type": "object", "required": [ "type", "timestamp", "data" ], "title": "WebhookRefundUpdatedPayload", "description": "Sent when a refund is updated.\n\n**Discord & Slack support:** Full" }, "WebhookSubscriptionActivePayload": { "properties": { "type": { "type": "string", "const": "subscription.active", "title": "Type", "examples": [ "subscription.active" ] }, "timestamp": { "type": "string", "format": "date-time", "title": "Timestamp" }, "data": { "$ref": "#/components/schemas/Subscription" } }, "type": "object", "required": [ "type", "timestamp", "data" ], "title": "WebhookSubscriptionActivePayload", "description": "Sent when a subscription becomes active,\nwhether because it's a new paid subscription or because payment was recovered.\n\n**Discord & Slack support:** Full" }, "WebhookSubscriptionCanceledPayload": { "properties": { "type": { "type": "string", "const": "subscription.canceled", "title": "Type", "examples": [ "subscription.canceled" ] }, "timestamp": { "type": "string", "format": "date-time", "title": "Timestamp" }, "data": { "$ref": "#/components/schemas/Subscription" } }, "type": "object", "required": [ "type", "timestamp", "data" ], "title": "WebhookSubscriptionCanceledPayload", "description": "Sent when a subscription is canceled.\nCustomers might still have access until the end of the current period.\n\n**Discord & Slack support:** Full" }, "WebhookSubscriptionCreatedPayload": { "properties": { "type": { "type": "string", "const": "subscription.created", "title": "Type", "examples": [ "subscription.created" ] }, "timestamp": { "type": "string", "format": "date-time", "title": "Timestamp" }, "data": { "$ref": "#/components/schemas/Subscription" } }, "type": "object", "required": [ "type", "timestamp", "data" ], "title": "WebhookSubscriptionCreatedPayload", "description": "Sent when a new subscription is created.\n\nWhen this event occurs, the subscription `status` might not be `active` yet, as we can still have to wait for the first payment to be processed.\n\n**Discord & Slack support:** Full" }, "WebhookSubscriptionPastDuePayload": { "properties": { "type": { "type": "string", "const": "subscription.past_due", "title": "Type", "examples": [ "subscription.past_due" ] }, "timestamp": { "type": "string", "format": "date-time", "title": "Timestamp" }, "data": { "$ref": "#/components/schemas/Subscription" } }, "type": "object", "required": [ "type", "timestamp", "data" ], "title": "WebhookSubscriptionPastDuePayload", "description": "Sent when a subscription payment fails and the subscription enters `past_due` status.\n\nThis is a recoverable state - the customer can update their payment method to restore the subscription.\nBenefits may be revoked depending on the organization's grace period settings.\n\nIf payment retries are exhausted, a `subscription.revoked` event will be sent.\n\n**Discord & Slack support:** Full" }, "WebhookSubscriptionRevokedPayload": { "properties": { "type": { "type": "string", "const": "subscription.revoked", "title": "Type", "examples": [ "subscription.revoked" ] }, "timestamp": { "type": "string", "format": "date-time", "title": "Timestamp" }, "data": { "$ref": "#/components/schemas/Subscription" } }, "type": "object", "required": [ "type", "timestamp", "data" ], "title": "WebhookSubscriptionRevokedPayload", "description": "Sent when a subscription is revoked and the user loses access immediately.\nHappens when the subscription is canceled or payment retries are exhausted (status becomes `unpaid`).\n\nFor payment failures that can still be recovered, see `subscription.past_due`.\n\n**Discord & Slack support:** Full" }, "WebhookSubscriptionUncanceledPayload": { "properties": { "type": { "type": "string", "const": "subscription.uncanceled", "title": "Type", "examples": [ "subscription.uncanceled" ] }, "timestamp": { "type": "string", "format": "date-time", "title": "Timestamp" }, "data": { "$ref": "#/components/schemas/Subscription" } }, "type": "object", "required": [ "type", "timestamp", "data" ], "title": "WebhookSubscriptionUncanceledPayload", "description": "Sent when a customer revokes a pending cancellation.\n\nWhen a customer cancels with \"at period end\", they retain access until the\nsubscription would renew. During this time, they can change their mind and\nundo the cancellation. This event is triggered when they do so.\n\n**Discord & Slack support:** Full" }, "WebhookSubscriptionUpdatedPayload": { "properties": { "type": { "type": "string", "const": "subscription.updated", "title": "Type", "examples": [ "subscription.updated" ] }, "timestamp": { "type": "string", "format": "date-time", "title": "Timestamp" }, "data": { "$ref": "#/components/schemas/Subscription" } }, "type": "object", "required": [ "type", "timestamp", "data" ], "title": "WebhookSubscriptionUpdatedPayload", "description": "Sent when a subscription is updated. This event fires for all changes to the subscription, including renewals.\n\nIf you want more specific events, you can listen to `subscription.active`, `subscription.canceled`, `subscription.past_due`, and `subscription.revoked`.\n\nTo listen specifically for renewals, you can listen to `order.created` events and check the `billing_reason` field.\n\n**Discord & Slack support:** On cancellation, past due, and revocation. Renewals are skipped." }, "MetadataQuery": { "anyOf": [ { "type": "object", "additionalProperties": { "anyOf": [ { "type": "string" }, { "type": "integer" }, { "type": "boolean" }, { "type": "array", "items": { "type": "string" } }, { "type": "array", "items": { "type": "integer" } }, { "type": "array", "items": { "type": "boolean" } } ] } }, { "type": "null" } ], "title": "MetadataQuery" }, "AuthorizationCodeTokenRequest": { "properties": { "grant_type": { "const": "authorization_code", "title": "Grant Type", "type": "string" }, "client_id": { "title": "Client Id", "type": "string" }, "client_secret": { "title": "Client Secret", "type": "string" }, "code": { "title": "Code", "type": "string" }, "redirect_uri": { "format": "uri", "maxLength": 2083, "minLength": 1, "title": "Redirect Uri", "type": "string" } }, "required": [ "grant_type", "client_id", "client_secret", "code", "redirect_uri" ], "title": "AuthorizationCodeTokenRequest", "type": "object" }, "RefreshTokenRequest": { "properties": { "grant_type": { "const": "refresh_token", "title": "Grant Type", "type": "string" }, "client_id": { "title": "Client Id", "type": "string" }, "client_secret": { "title": "Client Secret", "type": "string" }, "refresh_token": { "title": "Refresh Token", "type": "string" } }, "required": [ "grant_type", "client_id", "client_secret", "refresh_token" ], "title": "RefreshTokenRequest", "type": "object" }, "WebTokenRequest": { "properties": { "grant_type": { "const": "web", "title": "Grant Type", "type": "string" }, "client_id": { "title": "Client Id", "type": "string" }, "client_secret": { "title": "Client Secret", "type": "string" }, "session_token": { "title": "Session Token", "type": "string" }, "sub_type": { "default": "user", "enum": [ "user", "organization" ], "title": "Sub Type", "type": "string" }, "sub": { "anyOf": [ { "format": "uuid4", "type": "string" }, { "type": "null" } ], "default": null, "title": "Sub" }, "scope": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Scope" } }, "required": [ "grant_type", "client_id", "client_secret", "session_token" ], "title": "WebTokenRequest", "type": "object" }, "RevokeTokenRequest": { "properties": { "token": { "title": "Token", "type": "string" }, "token_type_hint": { "anyOf": [ { "enum": [ "access_token", "refresh_token" ], "type": "string" }, { "type": "null" } ], "default": null, "title": "Token Type Hint" }, "client_id": { "title": "Client Id", "type": "string" }, "client_secret": { "title": "Client Secret", "type": "string" } }, "required": [ "token", "client_id", "client_secret" ], "title": "RevokeTokenRequest", "type": "object" }, "IntrospectTokenRequest": { "properties": { "token": { "title": "Token", "type": "string" }, "token_type_hint": { "anyOf": [ { "enum": [ "access_token", "refresh_token" ], "type": "string" }, { "type": "null" } ], "default": null, "title": "Token Type Hint" }, "client_id": { "title": "Client Id", "type": "string" }, "client_secret": { "title": "Client Secret", "type": "string" } }, "required": [ "token", "client_id", "client_secret" ], "title": "IntrospectTokenRequest", "type": "object" } }, "securitySchemes": { "oidc": { "type": "openIdConnect", "openIdConnectUrl": "/.well-known/openid-configuration" }, "pat": { "type": "http", "description": "You can generate a **Personal Access Token** from your [settings](https://polar.sh/settings).", "scheme": "bearer" }, "oat": { "type": "http", "description": "You can generate an **Organization Access Token** from your organization's settings.", "scheme": "bearer" }, "customer_session": { "type": "http", "description": "Customer session tokens are specific tokens that are used to authenticate customers on your organization. You can create those sessions programmatically using the [Create Customer Session endpoint](/api-reference/customer-portal/sessions/create).", "scheme": "bearer" }, "member_session": { "type": "http", "description": "Member session tokens are specific tokens that are used to authenticate members on your organization. You can create those sessions programmatically using the [Create Member Session endpoint](/api-reference/member-portal/sessions/create).", "scheme": "bearer" }, "access_token": { "type": "http", "scheme": "bearer", "description": "You can generate an **Organization Access Token** from your organization's settings." } } }, "tags": [ { "name": "public", "description": "Endpoints shown and documented in the Polar API documentation and available in our SDKs." }, { "name": "private", "description": "Endpoints that should appear in the schema only in development to generate our internal JS SDK." }, { "name": "mcp", "description": "Endpoints enabled in the MCP server." } ], "security": [ { "access_token": [] } ] }