Skip to content

Latest commit

 

History

History
308 lines (231 loc) · 30.3 KB

File metadata and controls

308 lines (231 loc) · 30.3 KB

Meteroid API

Every operation of the API, as a method of a Meteroid client (client below), by resource; AsyncMeteroid has the same methods, to await, and client.with_raw_response the same resources, returning the HTTP response. Every method also takes the keyword arguments extra_headers, extra_query, extra_body, timeout and max_retries for that call; =... marks optional keyword arguments. Models are in meteroid/models. A list method returns its first page, such as a AddOnsListPage: a subclass of the response model (AddOnListResponse) with the paging members items, has_next_page(), get_next_page(), iter_pages() and body, which iterates every item. The page classes are in meteroid.api.

Add ons · Add ons entitlements · Batch jobs · Checkout sessions · Connect · Coupons · Credit notes · Custom properties · Customers · Entitlements · Events · Features · Invoices · Metrics · Oauth · Oauth apps · Plans · Plans versions · Product families · Products · Products entitlements · Subscriptions · Usage · Webhook endpoints · Webhook endpoints endpoints

Add ons

client.add_ons

Method Request Returns
client.add_ons.list(*, search=..., currency=..., include_archived=..., order_by=..., page=..., per_page=...) -> AddOnsListPage GET /api/v1/addons AddOnListResponse pages of AddOn
client.add_ons.create(*, name: str, price_id: PriceId, product_id: ProductId, description=..., max_instances_per_subscription=..., self_serviceable=...) -> AddOn POST /api/v1/addons AddOn
client.add_ons.retrieve(addon_id: str) -> AddOn GET /api/v1/addons/{addon_id} AddOn
client.add_ons.update(addon_id: str, *, description=..., max_instances_per_subscription=..., name=..., price_id=..., self_serviceable=...) -> AddOn PATCH /api/v1/addons/{addon_id} AddOn
client.add_ons.archive(addon_id: str) -> None POST /api/v1/addons/{addon_id}/archive nothing
client.add_ons.unarchive(addon_id: str) -> None POST /api/v1/addons/{addon_id}/unarchive nothing

Add ons entitlements

client.add_ons.entitlements

Method Request Returns
client.add_ons.entitlements.list(addon_id: str) -> ResolvedEntitlementListResponse GET /api/v1/addons/{addon_id}/entitlements ResolvedEntitlementListResponse
client.add_ons.entitlements.create(addon_id: str, *, entitlements: list[EntitlementSpecRequest]) -> EntitlementListResponse POST /api/v1/addons/{addon_id}/entitlements EntitlementListResponse

Batch jobs

client.batch_jobs

Method Request Returns
client.batch_jobs.list(*, job_type=..., status=..., page=..., per_page=...) -> BatchJobsListPage GET /api/v1/batch-jobs BatchJobListResponse pages of BatchJobResponse
client.batch_jobs.retrieve(batch_job_id: str) -> BatchJobDetailResponse GET /api/v1/batch-jobs/{batch_job_id} BatchJobDetailResponse
client.batch_jobs.list_failures(batch_job_id: str, *, chunk_id=..., limit=..., offset=...) -> BatchJobsListFailuresPage GET /api/v1/batch-jobs/{batch_job_id}/failures BatchJobFailuresResponse pages of BatchJobItemFailureResponse

Checkout sessions

client.checkout_sessions

Method Request Returns
client.checkout_sessions.list(*, customer_id=..., status=...) -> ListCheckoutSessionsResponse GET /api/v1/checkout-sessions ListCheckoutSessionsResponse
client.checkout_sessions.create(*, customer_id: str, plan_version_id: PlanVersionId, add_ons=..., auto_advance_invoices=..., billing_day_anchor=..., billing_start_date=..., cancel_url=..., charge_automatically=..., components=..., coupon_code=..., coupon_ids=..., end_date=..., expires_in_hours=..., invoice_memo=..., invoice_threshold=..., metadata=..., net_terms=..., payment_methods_config=..., purchase_order=..., success_url=..., trial_duration_days=...) -> CreateCheckoutSessionResponse POST /api/v1/checkout-sessions CreateCheckoutSessionResponse
client.checkout_sessions.retrieve(id: str) -> GetCheckoutSessionResponse GET /api/v1/checkout-sessions/{id} GetCheckoutSessionResponse
client.checkout_sessions.cancel(id: str) -> CancelCheckoutSessionResponse POST /api/v1/checkout-sessions/{id}/cancel CancelCheckoutSessionResponse

Connect

client.connect

Method Request Returns
client.connect.list_connected_accounts() -> ConnectedAccountsResponse GET /api/v1/connected-accounts ConnectedAccountsResponse
client.connect.create_connected_account(*, connected_organization_id: UUID, connection_type=..., metadata=..., platform_customer_id=...) -> ConnectedAccount POST /api/v1/connected-accounts ConnectedAccount
client.connect.retrieve_connected_account(id: str) -> ConnectedAccount GET /api/v1/connected-accounts/{id} ConnectedAccount
client.connect.disconnect_account(id: str) -> None DELETE /api/v1/connected-accounts/{id} nothing
client.connect.create_onboarding_link(id: str, *, redirect_url: str) -> OnboardingLinkResponse POST /api/v1/connected-accounts/{id}/onboarding OnboardingLinkResponse

Coupons

client.coupons

Method Request Returns
client.coupons.list(*, search=..., filter=..., order_by=..., page=..., per_page=...) -> CouponsListPage GET /api/v1/coupons CouponListResponse pages of Coupon
client.coupons.create(*, code: str, discount: CouponDiscount, description=..., expires_at=..., plan_ids=..., recurring_value=..., redemption_limit=..., reusable=...) -> Coupon POST /api/v1/coupons Coupon
client.coupons.retrieve(coupon_id: str) -> Coupon GET /api/v1/coupons/{coupon_id} Coupon
client.coupons.update(coupon_id: str, *, description=..., discount=..., plan_ids=...) -> Coupon PATCH /api/v1/coupons/{coupon_id} Coupon
client.coupons.archive(coupon_id: str) -> None POST /api/v1/coupons/{coupon_id}/archive nothing
client.coupons.disable(coupon_id: str) -> None POST /api/v1/coupons/{coupon_id}/disable nothing
client.coupons.enable(coupon_id: str) -> None POST /api/v1/coupons/{coupon_id}/enable nothing
client.coupons.unarchive(coupon_id: str) -> None POST /api/v1/coupons/{coupon_id}/unarchive nothing

Credit notes

client.credit_notes

Method Request Returns
client.credit_notes.list(*, customer_id=..., invoice_id=..., status=..., search=..., order_by=..., page=..., per_page=...) -> CreditNotesListPage GET /api/v1/credit-notes CreditNoteListResponse pages of CreditNote
client.credit_notes.retrieve(credit_note_id: str) -> CreditNote GET /api/v1/credit-notes/{credit_note_id} CreditNote
client.credit_notes.update_custom_properties(credit_note_id: str, *, custom_properties: t.Any) -> CreditNote PATCH /api/v1/credit-notes/{credit_note_id}/custom-properties CreditNote
client.credit_notes.download(credit_note_id: str) -> bytes GET /api/v1/credit-notes/{credit_note_id}/download bytes
client.credit_notes.download_xml(credit_note_id: str) -> bytes GET /api/v1/credit-notes/{credit_note_id}/xml bytes

Custom properties

client.custom_properties

Method Request Returns
client.custom_properties.list_custom_property_definitions(*, entity_type=..., include_archived=..., page=..., per_page=...) -> CustomPropertiesListCustomPropertyDefinitionsPage GET /api/v1/custom-property-definitions CustomPropertyDefinitionListResponse pages of CustomPropertyDefinition
client.custom_properties.create_custom_property_definition(*, entity_type: CustomPropertyEntityType, key: str, name: str, property_type: CustomPropertyType, config=..., default_value=..., description=..., display_order=..., required=...) -> CustomPropertyDefinition POST /api/v1/custom-property-definitions CustomPropertyDefinition
client.custom_properties.retrieve_custom_property_definition(id: str) -> CustomPropertyDefinition GET /api/v1/custom-property-definitions/{id} CustomPropertyDefinition
client.custom_properties.update_custom_property_definition(id: str, *, config=..., default_value=..., description=..., display_order=..., name=..., required=...) -> CustomPropertyDefinition PUT /api/v1/custom-property-definitions/{id} CustomPropertyDefinition
client.custom_properties.archive_definition(id: str) -> CustomPropertyDefinition DELETE /api/v1/custom-property-definitions/{id} CustomPropertyDefinition

Customers

client.customers

Method Request Returns
client.customers.list(*, order_by=..., page=..., per_page=..., search=..., archived=...) -> CustomersListPage GET /api/v1/customers CustomerListResponse pages of Customer
client.customers.create(*, currency: Currency, alias=..., billing_address=..., billing_email=..., buyer_reference=..., connected_account_id=..., custom_properties=..., custom_taxes=..., customer_type=..., exemption_reason=..., first_name=..., invoicing_emails=..., invoicing_entity_id=..., invoicing_language=..., is_tax_exempt=..., last_name=..., legal_number=..., name=..., phone=..., preferred_locales=..., shipping_address=..., vat_number=...) -> Customer POST /api/v1/customers Customer
client.customers.retrieve(id_or_alias: str) -> Customer GET /api/v1/customers/{id_or_alias} Customer
client.customers.replace(id_or_alias: str, *, currency: Currency, custom_taxes: list[CustomTaxRate], invoicing_emails: list[str], invoicing_entity_id: InvoicingEntityId, alias=..., billing_address=..., billing_email=..., buyer_reference=..., custom_properties=..., customer_type=..., exemption_reason=..., first_name=..., invoicing_language=..., is_tax_exempt=..., last_name=..., legal_number=..., name=..., phone=..., preferred_locales=..., shipping_address=..., vat_number=...) -> Customer PUT /api/v1/customers/{id_or_alias} Customer
client.customers.archive(id_or_alias: str) -> None DELETE /api/v1/customers/{id_or_alias} nothing
client.customers.update(id_or_alias: str, *, alias=..., billing_address=..., billing_email=..., buyer_reference=..., currency=..., custom_properties=..., custom_taxes=..., customer_type=..., exemption_reason=..., first_name=..., invoicing_emails=..., invoicing_entity_id=..., invoicing_language=..., is_tax_exempt=..., last_name=..., legal_number=..., name=..., phone=..., preferred_locales=..., shipping_address=..., vat_number=...) -> Customer PATCH /api/v1/customers/{id_or_alias} Customer
client.customers.list_entitlements(id_or_alias: str) -> EffectiveEntitlementListResponse GET /api/v1/customers/{id_or_alias}/entitlements EffectiveEntitlementListResponse
client.customers.create_portal_token(id_or_alias: str, *, expires_in_seconds=..., scopes=...) -> CustomerPortalTokenResponse POST /api/v1/customers/{id_or_alias}/portal-token CustomerPortalTokenResponse
client.customers.unarchive(id_or_alias: str) -> None POST /api/v1/customers/{id_or_alias}/unarchive nothing

Entitlements

client.entitlements

Method Request Returns
client.entitlements.retrieve(entitlement_id: str) -> Entitlement GET /api/v1/entitlements/{entitlement_id} Entitlement
client.entitlements.delete(entitlement_id: str) -> None DELETE /api/v1/entitlements/{entitlement_id} nothing
client.entitlements.update(entitlement_id: str, *, value=...) -> Entitlement PATCH /api/v1/entitlements/{entitlement_id} Entitlement

Events

client.events

Method Request Returns
client.events.ingest(*, events: list[Event], allow_backfilling=..., allow_partial_failures=...) -> IngestEventsResponse POST /api/v1/events/ingest IngestEventsResponse

Features

client.features

Method Request Returns
client.features.list(*, statuses=..., product_id=..., search=..., page=..., per_page=...) -> FeaturesListPage GET /api/v1/features FeatureListResponse pages of Feature
client.features.create(*, code: str, feature_type: FeatureType, name: str, description=..., entitlement=..., product_id=...) -> Feature POST /api/v1/features Feature
client.features.retrieve(id_or_code: str) -> Feature GET /api/v1/features/{id_or_code} Feature
client.features.update(id_or_code: str, *, description=..., name=...) -> Feature PATCH /api/v1/features/{id_or_code} Feature
client.features.archive(id_or_code: str) -> None POST /api/v1/features/{id_or_code}/archive nothing
client.features.unarchive(id_or_code: str) -> None POST /api/v1/features/{id_or_code}/unarchive nothing

Invoices

client.invoices

Method Request Returns
client.invoices.list(*, customer_id=..., subscription_id=..., statuses=..., einvoicing_status=..., order_by=..., page=..., per_page=...) -> InvoicesListPage GET /api/v1/invoices InvoiceListResponse pages of Invoice
client.invoices.retrieve(invoice_id: str) -> Invoice GET /api/v1/invoices/{invoice_id} Invoice
client.invoices.update_custom_properties(invoice_id: str, *, custom_properties: t.Any) -> Invoice PATCH /api/v1/invoices/{invoice_id}/custom-properties Invoice
client.invoices.download(invoice_id: str) -> bytes GET /api/v1/invoices/{invoice_id}/download bytes
client.invoices.refresh(invoice_id: str) -> Invoice POST /api/v1/invoices/{invoice_id}/refresh Invoice
client.invoices.download_xml(invoice_id: str) -> bytes GET /api/v1/invoices/{invoice_id}/xml bytes

Metrics

client.metrics

Method Request Returns
client.metrics.list(*, product_family_id=..., search=..., order_by=..., page=..., per_page=...) -> MetricsListPage GET /api/v1/metrics MetricListResponse pages of MetricSummary
client.metrics.create(*, aggregation_type: BillingMetricAggregateEnum, code: str, name: str, product_family_id: ProductFamilyId, aggregation_key=..., description=..., filters=..., product_id=..., segmentation_matrix=..., unit_conversion=..., usage_group_key=...) -> Metric POST /api/v1/metrics Metric
client.metrics.retrieve(metric_id: str) -> Metric GET /api/v1/metrics/{metric_id} Metric
client.metrics.update(metric_id: str, *, description=..., filters=..., name=..., segmentation_matrix=..., unit_conversion=...) -> Metric PATCH /api/v1/metrics/{metric_id} Metric
client.metrics.archive(metric_id: str) -> None POST /api/v1/metrics/{metric_id}/archive nothing
client.metrics.unarchive(metric_id: str) -> None POST /api/v1/metrics/{metric_id}/unarchive nothing

Oauth

client.oauth

Method Request Returns
client.oauth.introspect(*, token: str) -> TokenIntrospectionResponse POST /api/v1/oauth/introspect TokenIntrospectionResponse
client.oauth.revoke(*, token: str, token_type_hint=...) -> None POST /api/v1/oauth/revoke nothing
client.oauth.token(*, grant_type: str, client_id=..., client_secret=..., code=..., code_verifier=..., redirect_uri=..., refresh_token=...) -> TokenResponse POST /api/v1/oauth/token TokenResponse

Oauth apps

client.oauth_apps

Method Request Returns
client.oauth_apps.list() -> OAuthAppsResponse GET /api/v1/oauth-apps OAuthAppsResponse
client.oauth_apps.create(*, name: str, redirect_uris: list[str], scopes=...) -> OAuthAppWithSecret POST /api/v1/oauth-apps OAuthAppWithSecret
client.oauth_apps.retrieve(id: str) -> OAuthApp GET /api/v1/oauth-apps/{id} OAuthApp
client.oauth_apps.delete(id: str) -> None DELETE /api/v1/oauth-apps/{id} nothing
client.oauth_apps.rotate(id: str) -> RotatedSecret POST /api/v1/oauth-apps/{id}/rotate RotatedSecret

Plans

client.plans

Method Request Returns
client.plans.list_plan_version_entitlements(plan_version_id: str) -> ResolvedEntitlementListResponse GET /api/v1/plan-versions/{plan_version_id}/entitlements ResolvedEntitlementListResponse
client.plans.create_plan_version_entitlement(plan_version_id: str, *, entitlements: list[EntitlementSpecRequest]) -> EntitlementListResponse POST /api/v1/plan-versions/{plan_version_id}/entitlements EntitlementListResponse
client.plans.list(*, product_family_id=..., search=..., status=..., plan_type=..., order_by=..., page=..., per_page=...) -> PlansListPage GET /api/v1/plans PlanListResponse pages of Plan
client.plans.create(*, components: list[PriceComponentInput], currency: str, name: str, plan_type: PlanTypeEnum, product_family_id: ProductFamilyId, status: PlanStatusEnum, add_ons=..., billing=..., description=..., entitlements=..., self_service_rank=..., tax_inclusive=..., trial=...) -> Plan POST /api/v1/plans Plan
client.plans.retrieve(plan_id: str, *, version=...) -> Plan GET /api/v1/plans/{plan_id} Plan
client.plans.replace(plan_id: str, *, components: list[PriceComponentInput], currency: str, name: str, add_ons=..., billing=..., description=..., entitlements=..., minimum_commitment=..., status=..., tax_inclusive=..., trial=...) -> Plan PUT /api/v1/plans/{plan_id} Plan
client.plans.update(plan_id: str, *, description=..., name=..., self_service_rank=...) -> Plan PATCH /api/v1/plans/{plan_id} Plan
client.plans.archive(plan_id: str) -> None POST /api/v1/plans/{plan_id}/archive nothing
client.plans.publish(plan_id: str) -> Plan POST /api/v1/plans/{plan_id}/publish Plan
client.plans.unarchive(plan_id: str) -> None POST /api/v1/plans/{plan_id}/unarchive nothing

Plans versions

client.plans.versions

Method Request Returns
client.plans.versions.update_minimum(plan_version_id: str, *, amount: str, scope: MinimumCommitmentScope) -> MinimumCommitment PUT /api/v1/plans/versions/{plan_version_id}/minimum MinimumCommitment
client.plans.versions.delete_minimum(plan_version_id: str) -> None DELETE /api/v1/plans/versions/{plan_version_id}/minimum nothing
client.plans.versions.list(plan_id: str, *, page=..., per_page=...) -> PlansVersionsListPage GET /api/v1/plans/{plan_id}/versions PlanVersionListResponse pages of PlanVersionSummary

Product families

client.product_families

Method Request Returns
client.product_families.list(*, order_by=..., page=..., per_page=..., search=...) -> ProductFamiliesListPage GET /api/v1/product_families ProductFamilyListResponse pages of ProductFamily
client.product_families.create(*, name: str) -> ProductFamily POST /api/v1/product_families ProductFamily
client.product_families.retrieve(id_or_alias: str) -> ProductFamily GET /api/v1/product_families/{id_or_alias} ProductFamily

Products

client.products

Method Request Returns
client.products.list(*, product_family_id=..., search=..., order_by=..., page=..., per_page=...) -> ProductsListPage GET /api/v1/products ProductListResponse pages of Product
client.products.create(*, fee_structure: ProductFeeStructure, name: str, product_family_id: ProductFamilyId, catalog=..., description=...) -> Product POST /api/v1/products Product
client.products.retrieve(product_id: str) -> Product GET /api/v1/products/{product_id} Product
client.products.update(product_id: str, *, description=..., fee_structure=..., name=...) -> Product PATCH /api/v1/products/{product_id} Product
client.products.archive(product_id: str) -> None POST /api/v1/products/{product_id}/archive nothing
client.products.unarchive(product_id: str) -> None POST /api/v1/products/{product_id}/unarchive nothing

Products entitlements

client.products.entitlements

Method Request Returns
client.products.entitlements.list(product_id: str) -> ResolvedEntitlementListResponse GET /api/v1/products/{product_id}/entitlements ResolvedEntitlementListResponse
client.products.entitlements.create(product_id: str, *, entitlements: list[EntitlementSpecRequest]) -> EntitlementListResponse POST /api/v1/products/{product_id}/entitlements EntitlementListResponse

Subscriptions

client.subscriptions

Method Request Returns
client.subscriptions.list(*, customer_id=..., plan_id=..., statuses=..., order_by=..., page=..., per_page=...) -> SubscriptionsListPage GET /api/v1/subscriptions SubscriptionListResponse pages of Subscription
client.subscriptions.create(*, activation_condition: SubscriptionActivationConditionEnum, customer_id_or_alias: str, plan_id: PlanId, start_date: date, add_ons=..., auto_advance_invoices=..., backdate_invoices=..., billing_day_anchor=..., charge_automatically=..., coupon_codes=..., custom_properties=..., end_date=..., invoice_memo=..., net_terms=..., payment_methods_config=..., price_components=..., purchase_order=..., skip_past_invoices=..., trial_days=..., version=...) -> SubscriptionDetails POST /api/v1/subscriptions SubscriptionDetails
client.subscriptions.retrieve(subscription_id: str) -> SubscriptionDetails GET /api/v1/subscriptions/{subscription_id} SubscriptionDetails
client.subscriptions.update(subscription_id: str, *, auto_advance_invoices=..., charge_automatically=..., custom_properties=..., invoice_memo=..., net_terms=..., payment_methods_config=..., purchase_order=...) -> SubscriptionUpdateResponse PATCH /api/v1/subscriptions/{subscription_id} SubscriptionUpdateResponse
client.subscriptions.cancel(subscription_id: str, *, effective_date=..., reason=...) -> CancelSubscriptionResponse POST /api/v1/subscriptions/{subscription_id}/cancel CancelSubscriptionResponse
client.subscriptions.list_entitlements(subscription_id: str) -> EffectiveEntitlementListResponse GET /api/v1/subscriptions/{subscription_id}/entitlements EffectiveEntitlementListResponse
client.subscriptions.retrieve_summary(subscription_id: str) -> Subscription GET /api/v1/subscriptions/{subscription_id}/summary Subscription

Usage

client.usage

Method Request Returns
client.usage.retrieve_customer(customer_id: str, *, start_date: date, end_date: date, metric_id=...) -> UsageResponse GET /api/v1/usage/customer/{customer_id} UsageResponse
client.usage.retrieve_subscription(subscription_id: str, *, start_date=..., end_date=..., metric_id=...) -> UsageResponse GET /api/v1/usage/subscription/{subscription_id} UsageResponse
client.usage.retrieve_summary(*, start_date: date, end_date: date, metric_id=...) -> UsageResponse GET /api/v1/usage/summary UsageResponse

Webhook endpoints

client.webhook_endpoints

Method Request Returns
client.webhook_endpoints.resend_webhook_delivery(delivery_id: str) -> WebhookDelivery POST /api/v1/webhooks/deliveries/{delivery_id}/resend WebhookDelivery

Webhook endpoints endpoints

client.webhook_endpoints.endpoints

Method Request Returns
client.webhook_endpoints.endpoints.list() -> WebhookEndpointListResponse GET /api/v1/webhooks/endpoints WebhookEndpointListResponse
client.webhook_endpoints.endpoints.create(*, url: str, description=..., event_types=..., headers=..., rate_limit_per_sec=...) -> CreatedWebhookEndpoint POST /api/v1/webhooks/endpoints CreatedWebhookEndpoint
client.webhook_endpoints.endpoints.retrieve(endpoint_id: str) -> WebhookEndpoint GET /api/v1/webhooks/endpoints/{endpoint_id} WebhookEndpoint
client.webhook_endpoints.endpoints.delete(endpoint_id: str) -> None DELETE /api/v1/webhooks/endpoints/{endpoint_id} nothing
client.webhook_endpoints.endpoints.update(endpoint_id: str, *, description=..., disabled=..., event_types=..., headers=..., rate_limit_per_sec=..., url=...) -> WebhookEndpoint PATCH /api/v1/webhooks/endpoints/{endpoint_id} WebhookEndpoint
client.webhook_endpoints.endpoints.list_deliveries(endpoint_id: str, *, status=..., page=..., per_page=...) -> WebhookEndpointsEndpointsListDeliveriesPage GET /api/v1/webhooks/endpoints/{endpoint_id}/deliveries WebhookDeliveryListResponse pages of WebhookDelivery
client.webhook_endpoints.endpoints.rotate_secret(endpoint_id: str) -> WebhookEndpointSecret POST /api/v1/webhooks/endpoints/{endpoint_id}/rotate-secret WebhookEndpointSecret
client.webhook_endpoints.endpoints.retrieve_secret(endpoint_id: str) -> WebhookEndpointSecret GET /api/v1/webhooks/endpoints/{endpoint_id}/secret WebhookEndpointSecret