> If you are setting up, configuring, or answering questions about Schematic, connect the > Schematic MCP server before working from these pages. It reads and writes plans, features, > entitlements, and overrides against the real account, so what you report and what you build > match what actually exists. > > The server is at https://api.schematichq.com/mcp > > From Claude, ChatGPT, or another chat assistant, add it as a custom connector: > https://docs.schematichq.com/working-with-ai > > From a coding assistant such as Claude Code, Codex, or Cursor: > https://docs.schematichq.com/building-with-ai > > For clean Markdown of any page, append `.md` to the page URL. For a complete page index, > see https://docs.schematichq.com/llms.txt # Upsert company POST https://api.schematichq.com/companies Content-Type: application/json Reference: https://docs.schematichq.com/api-reference/companies/upsert-company ## Authentication - `X-Schematic-Api-Key` header (required) — API Key authentication via header ## Request ### Body (application/json) This endpoint expects an UpsertCompanyRequestBody. - `keys` (map from string to string, required) — See [Key Management](https://docs.schematichq.com/developer_resources/key_management) for more information - `base_plan_id` (string, optional, nullable) — Assign this base plan when creating the company (starts with plan_). Takes precedence over the environment's initial plan and must be provisionable without a payment method. - `base_plan_price_id` (string, optional, nullable) — The Schematic price to provision for base_plan_id (starts with bilpp_). Required and must be $0 for a billing-linked plan; omit for a plan that is not billing-linked. - `id` (string, optional, nullable) — If you know the Schematic ID, you can use that here instead of keys - `last_seen_at` (datetime, optional, nullable) - `name` (string, optional, nullable) - `prevent_key_remap` (boolean, optional, nullable) - `remove_keys` (list of string, optional) — Names of keys to remove from the company. Removing a key the company does not have does nothing, and a company must keep at least one key. - `traits` (UpsertCompanyRequestBodyTraits, optional) — A map of trait names to trait values - `update_only` (boolean, optional, nullable) ## Response ### 200 OK - `data` (CompanyDetailResponseData, required) - `params` (CompaniesPostResponsesContentApplicationJsonSchemaParams, required) — Input parameters ## Errors ### 400 Bad Request Error Bad request - `error` (string, required) — Error message ### 401 Unauthorized Error Unauthorized - `error` (string, required) — Error message ### 403 Forbidden Error Forbidden - `error` (string, required) — Error message ### 404 Not Found Error Not found - `error` (string, required) — Error message ### 500 Internal Server Error Server error - `error` (string, required) — Error message ## Types ### UpsertCompanyRequestBodyTraits A map of trait names to trait values ### CompanyDetailResponseData - `add_ons` (list of CompanyPlanWithBillingSubView, required) - `billing_subscriptions` (list of BillingSubscriptionView, required) - `created_at` (datetime, required) - `custom_plan_billings` (list of CustomPlanBillingResponseData, required) - `entitlements` (list of FeatureEntitlement, required) - `entity_traits` (list of EntityTraitDetailResponseData, required) - `environment_id` (string, required) - `id` (string, required) - `keys` (list of EntityKeyDetailResponseData, required) - `metrics` (list of CompanyEventPeriodMetricsResponseData, required) - `name` (string, required) - `payment_methods` (list of PaymentMethodResponseData, required) - `plans` (list of GenericPreviewObject, required) - `rules` (list of Rule, required) - `updated_at` (datetime, required) - `user_count` (long, required) - `billing_credit_balances` (map from string to double, optional, nullable) - `billing_email` (string, optional, nullable) - `billing_profile` (CompanyBillingProfileResponseData, optional) - `billing_profiles` (list of CompanyBillingProfileResponseData, optional, nullable) - `billing_subscription` (BillingSubscriptionView, optional) - `default_payment_method` (PaymentMethodResponseData, optional) - `last_seen_at` (datetime, optional, nullable) - `logo_url` (string, optional, nullable) - `pending_migration` (PendingMigrationResponseData, optional) - `plan` (CompanyPlanWithBillingSubView, optional) - `scheduled_downgrade` (ScheduledDowngradeResponseData, optional) - `traits` (CompanyDetailResponseDataTraits, optional) — A map of trait names to trait values ### CompaniesPostResponsesContentApplicationJsonSchemaParams Input parameters ### CompanyPlanWithBillingSubView - `id` (string, required) - `included_credit_grants` (list of CompanyPlanCreditGrantView, required) - `name` (string, required) - `added_on` (datetime, optional, nullable) - `billing_product_external_id` (string, optional, nullable) - `billing_product_id` (string, optional, nullable) - `description` (string, optional, nullable) - `image_url` (string, optional, nullable) - `plan_period` (string, optional, nullable) - `plan_price` (long, optional, nullable) - `plan_version_id` (string, optional, nullable) ### BillingSubscriptionView - `cancel_at_period_end` (boolean, required) - `created_at` (datetime, required) - `currency` (string, required) - `customer_external_id` (string, required) - `discounts` (list of BillingSubscriptionDiscountView, required) - `id` (string, required) - `interval` (string, required) - `period_end` (long, required) - `period_start` (long, required) - `products` (list of BillingProductForSubscriptionResponseData, required) - `provider_type` (enum, required) - Allowed values: `metronome`, `orb`, `schematic`, `stripe` - `status` (string, required) - `subscription_external_id` (string, required) - `total_price` (long, required) - `application_id` (string, optional, nullable) - `cancel_at` (long, optional, nullable) - `company_id` (string, optional, nullable) - `default_payment_method_id` (string, optional, nullable) - `expired_at` (datetime, optional, nullable) - `latest_invoice` (InvoiceResponseData, optional) - `metadata` (BillingSubscriptionViewMetadata, optional) - `payment_method` (PaymentMethodResponseData, optional) - `trial_end` (long, optional, nullable) - `trial_end_setting` (enum, optional, nullable) - Allowed values: `cancel`, `subscribe` ### CustomPlanBillingResponseData - `activation_strategy` (enum, required) - Allowed values: `on_payment`, `on_publish` - `company_id` (string, required) - `created_at` (datetime, required) - `days_until_due` (long, required) - `id` (string, required) - `plan_billing_source` (enum, required) — The flow that created this billing record: a custom plan, or a standard plan assigned by invoice through Manage Plan. - Allowed values: `custom_plan`, `manage_plan` - `plan_id` (string, required) - `send_invoice` (boolean, required) - `status` (enum, required) - Allowed values: `active`, `expired`, `paid`, `pending` - `updated_at` (datetime, required) - `billing_cycle_anchor` (datetime, optional, nullable) — The billing period renewal date pinned when the subscription started, when one was set. When no invoice exists yet, the first invoice is raised on this date. - `external_invoice_id` (string, optional, nullable) - `paid_at` (datetime, optional, nullable) - `prorate_first_period` (boolean, optional, nullable) — Whether the shortened period the renewal date created was billed pro rata when the subscription started. False means that period is free and the first invoice is the one raised on the renewal date. - `published_at` (datetime, optional, nullable) - `stripe_invoice_url` (string, optional, nullable) ### FeatureEntitlement - `feature_id` (string, required) — The ID of the feature - `feature_key` (string, required) — The key of the flag associated with the feature - `value_type` (enum, required) — The type of the entitlement value - Allowed values: `boolean`, `credit`, `numeric`, `trait`, `unknown`, `unlimited` - `allocation` (long, optional, nullable) — If the company has a numeric entitlement for this feature, the allocated amount - `consumption_rate` (double, optional, nullable) — If the company has a credit-based entitlement for this feature, the credit cost per unit of usage - `credit_id` (string, optional, nullable) — If the company has a credit-based entitlement for this feature, the ID of the credit - `credit_remaining` (double, optional, nullable) — If the company has a credit-based entitlement for this feature, the credit available to fund new consumption or a new lease hold — open lease holds are excluded. Clients that hold a lease should gate on this plus their own unspent hold; clients with no lease awareness should use credit_settled instead - `credit_reserved` (double, optional, nullable) — If the company has a credit-based entitlement for this feature, the unspent amount held by an open credit lease. Returns to credit_remaining when the lease is released - `credit_settled` (double, optional, nullable) — If the company has a credit-based entitlement for this feature, the balance net of actual consumption, unaffected by open lease holds (credit_remaining plus credit_reserved). The number to display to end users - `credit_total` (double, optional, nullable) — If the company has a credit-based entitlement for this feature, the total credit amount - `credit_used` (double, optional, nullable) — If the company has a credit-based entitlement for this feature, the amount of credit used - `event_name` (string, optional, nullable) — If the feature is event-based, the name of the event tracked for usage - `event_subtype` (string, optional, nullable) — For event-based or credit-metered feature entitlements, the event subtype whose usage is tracked - `metric_period` (enum, optional, nullable) — For event-based feature entitlements, the period over which usage is tracked - Allowed values: `all_time`, `current_day`, `current_month`, `current_week` - `metric_reset_at` (datetime, optional, nullable) — For event-based feature entitlements, when the usage period will reset - `month_reset` (enum, optional, nullable) — For event-based feature entitlements that have a monthly period, whether that monthly reset is based on the calendar month or a billing cycle - Allowed values: `billing_cycle`, `first_of_month` - `soft_limit` (long, optional, nullable) — For usage-based pricing, the soft limit for overage charges or the next tier boundary - `usage` (long, optional, nullable) — If the company has a numeric entitlement for this feature, the current usage amount - `warning_tiers` (list of WarningTier, optional) — Customer-defined usage warning thresholds configured on this entitlement ### EntityTraitDetailResponseData - `created_at` (datetime, required) - `definition_id` (string, required) - `environment_id` (string, required) - `id` (string, required) - `updated_at` (datetime, required) - `value` (string, required) - `definition` (EntityTraitDefinitionResponseData, optional) ### EntityKeyDetailResponseData - `created_at` (datetime, required) - `definition_id` (string, required) - `entity_id` (string, required) - `entity_type` (enum, required) - Allowed values: `company`, `user` - `environment_id` (string, required) - `id` (string, required) - `key` (string, required) - `updated_at` (datetime, required) - `value` (string, required) - `definition` (EntityKeyDefinitionResponseData, optional) ### CompanyEventPeriodMetricsResponseData - `account_id` (string, required) - `captured_at_max` (datetime, required) - `captured_at_min` (datetime, required) - `company_id` (string, required) - `created_at` (datetime, required) - `environment_id` (string, required) - `event_subtype` (string, required) - `month_reset` (enum, required) - Allowed values: `billing_cycle`, `first_of_month` - `period` (enum, required) - Allowed values: `all_time`, `current_day`, `current_month`, `current_week` - `value` (long, required) - `valid_until` (datetime, optional, nullable) ### PaymentMethodResponseData - `created_at` (datetime, required) - `customer_external_id` (string, required) - `environment_id` (string, required) - `external_id` (string, required) - `id` (string, required) - `payment_method_type` (string, required) - `provider_type` (enum, required) - Allowed values: `metronome`, `orb`, `schematic`, `stripe` - `updated_at` (datetime, required) - `account_last4` (string, optional, nullable) - `account_name` (string, optional, nullable) - `bank_name` (string, optional, nullable) - `billing_email` (string, optional, nullable) - `billing_name` (string, optional, nullable) - `card_brand` (string, optional, nullable) - `card_exp_month` (long, optional, nullable) - `card_exp_year` (long, optional, nullable) - `card_last4` (string, optional, nullable) - `company_id` (string, optional, nullable) ### GenericPreviewObject - `id` (string, required) - `name` (string, required) - `description` (string, optional, nullable) - `image_url` (string, optional, nullable) ### Rule - `account_id` (string, required) - `condition_groups` (list of ConditionGroup, required) - `conditions` (list of Condition, required) - `environment_id` (string, required) - `id` (string, required) - `name` (string, required) - `priority` (long, required) - `rule_type` (enum, required) - Allowed values: `company_override`, `company_override_usage_exceeded`, `default`, `global_override`, `plan_entitlement`, `plan_entitlement_usage_exceeded`, `standard` - `value` (boolean, required) - `flag_id` (string, optional, nullable) ### CompanyBillingProfileResponseData - `account_id` (string, required) - `collection_method` (enum, required) - Allowed values: `charge_automatically`, `send_invoice` - `company_id` (string, required) - `created_at` (datetime, required) - `environment_id` (string, required) - `id` (string, required) - `is_default` (boolean, required) - `provider_type` (enum, required) - Allowed values: `metronome`, `orb`, `schematic`, `stripe` - `updated_at` (datetime, required) - `billing_customer_id` (string, optional, nullable) - `days_until_due` (long, optional, nullable) - `name` (string, optional, nullable) - `payment_method_id` (string, optional, nullable) - `proration_behavior` (enum, optional, nullable) - Allowed values: `create_prorations`, `invoice_immediately` ### PendingMigrationResponseData - `migration_id` (string, required) - `to_plan_id` (string, required) - `to_plan_name` (string, required) - `to_plan_version_id` (string, required) - `scheduled_for` (datetime, optional, nullable) - `to_plan_version_number` (long, optional, nullable) ### ScheduledDowngradeResponseData - `currency` (string, required) - `effective_after` (datetime, required) - `from_plan_id` (string, required) - `from_plan_name` (string, required) - `from_subscription_price` (long, required) - `id` (string, required) - `interval` (string, required) - `to_plan_id` (string, required) - `to_plan_name` (string, required) - `scheduled_interval` (string, optional, nullable) - `scheduled_price` (long, optional, nullable) ### CompanyDetailResponseDataTraits A map of trait names to trait values ### CompanyPlanCreditGrantView - `billing_credit_auto_topup_enabled` (boolean, required) - `billing_credit_auto_topup_self_service` (boolean, required) - `billing_credit_can_buy_bundles` (boolean, required) - `billing_credit_postpaid_enabled` (boolean, required) - `billing_mode` (enum, required) - Allowed values: `granted`, `billed` - `company_credit_amount` (long, required) - `created_at` (datetime, required) - `credit_amount` (long, required) - `credit_id` (string, required) - `id` (string, required) - `plan_id` (string, required) - `reset_type` (enum, required) - Allowed values: `no_reset`, `plan_period` - `rollover_percentage` (long, required) - `scaling` (enum, required) - Allowed values: `fixed`, `per_license` - `updated_at` (datetime, required) - `credit_description` (string, required, deprecated) — Deprecated field, will be removed in the future. Use Credit.Description instead. - `credit_name` (string, required, deprecated) — Deprecated field, will be removed in the future. Use Credit.Name instead. - `billing_credit_arrears_anchor` (enum, optional, nullable) - Allowed values: `billing_period_start`, `month_end` - `billing_credit_arrears_cadence` (enum, optional, nullable) - Allowed values: `end_of_billing_period`, `monthly`, `quarterly` - `billing_credit_auto_topup_amount` (long, optional, nullable) - `billing_credit_auto_topup_amount_type` (string, optional, nullable) - `billing_credit_auto_topup_availability` (enum, optional, nullable) - Allowed values: `off`, `automatic`, `user_controlled` - `billing_credit_auto_topup_expiry_type` (enum, optional, nullable) - Allowed values: `duration`, `end_of_billing_period`, `end_of_next_billing_period`, `end_of_trial`, `no_expiry` - `billing_credit_auto_topup_expiry_unit` (enum, optional, nullable) - Allowed values: `billing_periods`, `days` - `billing_credit_auto_topup_expiry_unit_count` (long, optional, nullable) - `billing_credit_auto_topup_threshold_credits` (long, optional, nullable) - `billing_credit_auto_topup_threshold_percent` (long, optional, nullable) - `billing_credit_overdraft_limit` (double, optional, nullable) - `billing_credit_postpaid_rate_per_unit` (long, optional, nullable) - `billing_credit_postpaid_rate_per_unit_decimal` (string, optional, nullable) - `billing_product_price_id` (string, optional, nullable) - `company_auto_topup_amount` (long, optional, nullable) - `company_auto_topup_enabled` (boolean, optional, nullable) - `company_auto_topup_threshold_credits` (long, optional, nullable) - `credit` (BillingCreditView, optional) - `expiry_type` (enum, optional, nullable) - Allowed values: `duration`, `end_of_billing_period`, `end_of_next_billing_period`, `end_of_trial`, `no_expiry` - `expiry_unit` (enum, optional, nullable) - Allowed values: `billing_periods`, `days` - `expiry_unit_count` (long, optional, nullable) - `license_id` (string, optional, nullable) - `plan` (GenericPreviewObject, optional) - `plan_version_id` (string, optional, nullable) - `price` (BillingPriceView, optional) - `reset_cadence` (enum, optional, nullable) - Allowed values: `daily`, `every_6_months`, `monthly`, `quarterly`, `weekly`, `yearly` - `reset_start` (enum, optional, nullable) - Allowed values: `billing_period`, `first_of_month` - `credit_icon` (string, optional, nullable, deprecated) — Deprecated field, will be removed in the future. Use Credit.Icon instead. - `plural_name` (string, optional, nullable, deprecated) — Deprecated field, will be removed in the future. Use Credit.PluralName instead. - `singular_name` (string, optional, nullable, deprecated) — Deprecated field, will be removed in the future. Use Credit.SingularName instead. ### BillingSubscriptionDiscountView - `coupon_id` (string, required) - `coupon_name` (string, required) - `discount_external_id` (string, required) - `duration` (string, required) - `is_active` (boolean, required) - `started_at` (datetime, required) - `subscription_external_id` (string, required) - `amount_off` (long, optional, nullable) - `currency` (string, optional, nullable) - `customer_facing_code` (string, optional, nullable) - `duration_in_months` (long, optional, nullable) - `ended_at` (datetime, optional, nullable) - `percent_off` (double, optional, nullable) - `promo_code_external_id` (string, optional, nullable) ### BillingProductForSubscriptionResponseData - `billing_scheme` (enum, required) - Allowed values: `per_unit`, `tiered` - `created_at` (datetime, required) - `currency` (string, required) - `environment_id` (string, required) - `external_id` (string, required) - `id` (string, required) - `interval` (string, required) - `name` (string, required) - `package_size` (long, required) - `price` (long, required) - `price_external_id` (string, required) - `price_id` (string, required) - `price_tier` (list of BillingProductPriceTierResponseData, required) - `provider_type` (enum, required) - Allowed values: `metronome`, `orb`, `schematic`, `stripe` - `quantity` (double, required) - `subscription_id` (string, required) - `updated_at` (datetime, required) - `usage_type` (enum, required) - Allowed values: `licensed`, `metered` - `billing_threshold` (long, optional, nullable) - `interval_count` (long, optional, nullable) - `meter_id` (string, optional, nullable) - `price_decimal` (string, optional, nullable) - `subscription_item_external_id` (string, optional, nullable) ### InvoiceResponseData - `amount_due` (long, required) - `amount_paid` (long, required) - `amount_remaining` (long, required) - `collection_method` (string, required) - `created_at` (datetime, required) - `currency` (string, required) - `customer_external_id` (string, required) - `ending_balance` (long, required) - `environment_id` (string, required) - `id` (string, required) - `provider_type` (enum, required) - Allowed values: `metronome`, `orb`, `schematic`, `stripe` - `starting_balance` (long, required) - `subtotal` (long, required) - `updated_at` (datetime, required) - `company_id` (string, optional, nullable) - `due_date` (datetime, optional, nullable) - `external_id` (string, optional, nullable) - `payment_method_external_id` (string, optional, nullable) - `status` (enum, optional, nullable) - Allowed values: `draft`, `open`, `paid`, `uncollectible`, `void` - `subscription_external_id` (string, optional, nullable) - `total` (long, optional, nullable) — Amount after discounts and tax, before applying the customer balance. Null when the provider has not reported it: rows synced before the column existed, or pushed without one. - `url` (string, optional, nullable) ### BillingSubscriptionViewMetadata ### WarningTier - `key` (string, required) — A customer-defined identifier for the warning tier - `value` (long, required) — The warning threshold, in the entitlement's usage units ### EntityTraitDefinitionResponseData - `created_at` (datetime, required) - `display_name` (string, required) - `entity_type` (enum, required) - Allowed values: `company`, `user` - `hierarchy` (list of string, required) - `id` (string, required) - `trait_type` (enum, required) - Allowed values: `boolean`, `currency`, `date`, `number`, `string`, `url` - `updated_at` (datetime, required) ### EntityKeyDefinitionResponseData - `created_at` (datetime, required) - `entity_type` (enum, required) - Allowed values: `company`, `user` - `id` (string, required) - `key` (string, required) - `updated_at` (datetime, required) ### ConditionGroup - `conditions` (list of Condition, required) ### Condition - `account_id` (string, required) - `condition_type` (enum, required) - Allowed values: `base_plan`, `billing_product`, `company`, `credit`, `metric`, `plan`, `plan_version`, `trait`, `user` - `environment_id` (string, required) - `id` (string, required) - `operator` (enum, required) - Allowed values: `eq`, `gt`, `gte`, `is_empty`, `lt`, `lte`, `not_empty`, `ne` - `resource_ids` (list of string, required) - `trait_value` (string, required) - `comparison_trait_definition` (TraitDefinition, optional) - `consumption_rate` (double, optional, nullable) - `credit_id` (string, optional, nullable) - `event_subtype` (string, optional, nullable) - `metric_period` (enum, optional, nullable) - Allowed values: `all_time`, `current_day`, `current_month`, `current_week` - `metric_period_month_reset` (enum, optional, nullable) - Allowed values: `billing_cycle`, `first_of_month` - `metric_value` (long, optional, nullable) - `trait_definition` (TraitDefinition, optional) ### BillingCreditView - `account_id` (string, required) - `burn_strategy` (enum, required) - Allowed values: `expiration_priority`, `first_in_first_out`, `last_in_first_out`, `plan_first_then_credit_bundles_first_in_first_out` - `cost_editable` (boolean, required) - `created_at` (datetime, required) - `currency_prices` (list of CreditCurrencyPrice, required) - `default_expiry_unit` (enum, required) - Allowed values: `billing_periods`, `days` - `default_rollover_policy` (enum, required) - Allowed values: `expire`, `none`, `rollover` - `description` (string, required) - `environment_id` (string, required) - `id` (string, required) - `ledger_authority` (enum, required) - Allowed values: `schematic_authoritative`, `external_mirror`, `external_rated` - `name` (string, required) - `updated_at` (datetime, required) - `default_expiry_unit_count` (long, optional, nullable) - `icon` (string, optional, nullable) - `plural_name` (string, optional, nullable) - `price` (BillingPriceView, optional) - `price_per_unit` (long, optional, nullable) - `price_per_unit_decimal` (string, optional, nullable) - `product` (BillingProductRecordResponseData, optional) - `singular_name` (string, optional, nullable) ### BillingPriceView - `billing_scheme` (enum, required) - Allowed values: `per_unit`, `tiered` - `created_at` (datetime, required) - `currency` (string, required) - `id` (string, required) - `interval` (enum, required) - Allowed values: `day`, `month`, `one-time`, `year` - `interval_count` (long, required) - `is_active` (boolean, required) - `package_size` (long, required) - `price` (long, required) - `price_external_id` (string, required) - `price_id` (string, required) - `price_tier` (list of BillingProductPriceTierResponseData, required) - `product_external_id` (string, required) - `product_id` (string, required) - `product_name` (string, required) - `provider_type` (enum, required) - Allowed values: `metronome`, `orb`, `schematic`, `stripe` - `updated_at` (datetime, required) - `usage_type` (enum, required) - Allowed values: `licensed`, `metered` - `meter_event_name` (string, optional, nullable) - `meter_event_payload_key` (string, optional, nullable) - `meter_id` (string, optional, nullable) - `nickname` (string, optional, nullable) - `price_decimal` (string, optional, nullable) - `tiers_mode` (enum, optional, nullable) - Allowed values: `graduated`, `volume` ### BillingProductPriceTierResponseData - `flat_amount` (long, optional, nullable) - `per_unit_price` (long, optional, nullable) - `per_unit_price_decimal` (string, optional, nullable) - `up_to` (long, optional, nullable) ### TraitDefinition - `comparable_type` (enum, required) - Allowed values: `bool`, `date`, `int`, `string` - `entity_type` (enum, required) - Allowed values: `company`, `user` - `id` (string, required) ### CreditCurrencyPrice - `currency` (string, required) - `price` (BillingPriceView, optional) ### BillingProductRecordResponseData - `account_id` (string, required) - `created_at` (datetime, required) - `environment_id` (string, required) - `external_id` (string, required) - `id` (string, required) - `is_active` (boolean, required) - `name` (string, required) - `provider_type` (enum, required) - Allowed values: `metronome`, `orb`, `schematic`, `stripe` - `updated_at` (datetime, required) ## Examples **Request** ```json {} ``` **Response** ```json { "data": { "add_ons": [ { "id": "string", "included_credit_grants": [ { "billing_credit_auto_topup_enabled": true, "billing_credit_auto_topup_self_service": true, "billing_credit_can_buy_bundles": true, "billing_credit_postpaid_enabled": true, "billing_mode": "granted", "company_credit_amount": 1, "created_at": "2024-01-15T09:30:00Z", "credit_amount": 1, "credit_id": "string", "id": "string", "plan_id": "string", "reset_type": "no_reset", "rollover_percentage": 1, "scaling": "fixed", "updated_at": "2024-01-15T09:30:00Z", "credit_description": "string", "credit_name": "string", "billing_credit_arrears_anchor": "billing_period_start", "billing_credit_arrears_cadence": "end_of_billing_period", "billing_credit_auto_topup_amount": 1, "billing_credit_auto_topup_amount_type": "string", "billing_credit_auto_topup_availability": "off", "billing_credit_auto_topup_expiry_type": "duration", "billing_credit_auto_topup_expiry_unit": "billing_periods", "billing_credit_auto_topup_expiry_unit_count": 1, "billing_credit_auto_topup_threshold_credits": 1, "billing_credit_auto_topup_threshold_percent": 1, "billing_credit_overdraft_limit": 1.1, "billing_credit_postpaid_rate_per_unit": 1, "billing_credit_postpaid_rate_per_unit_decimal": "string", "billing_product_price_id": "string", "company_auto_topup_amount": 1, "company_auto_topup_enabled": true, "company_auto_topup_threshold_credits": 1, "credit": { "account_id": "string", "burn_strategy": "expiration_priority", "cost_editable": true, "created_at": "2024-01-15T09:30:00Z", "currency_prices": [ { "currency": "string", "price": { "billing_scheme": "per_unit", "created_at": "2024-01-15T09:30:00Z", "currency": "string", "id": "string", "interval": "day", "interval_count": 1, "is_active": true, "package_size": 1, "price": 1, "price_external_id": "string", "price_id": "string", "price_tier": [ { "flat_amount": 1, "per_unit_price": 1, "per_unit_price_decimal": "string", "up_to": 1 } ], "product_external_id": "string", "product_id": "string", "product_name": "string", "provider_type": "metronome", "updated_at": "2024-01-15T09:30:00Z", "usage_type": "licensed", "meter_event_name": "string", "meter_event_payload_key": "string", "meter_id": "string", "nickname": "string", "price_decimal": "string", "tiers_mode": "graduated" } } ], "default_expiry_unit": "billing_periods", "default_rollover_policy": "expire", "description": "string", "environment_id": "string", "id": "string", "ledger_authority": "schematic_authoritative", "name": "string", "updated_at": "2024-01-15T09:30:00Z", "default_expiry_unit_count": 1, "icon": "string", "plural_name": "string", "price": { "billing_scheme": "per_unit", "created_at": "2024-01-15T09:30:00Z", "currency": "string", "id": "string", "interval": "day", "interval_count": 1, "is_active": true, "package_size": 1, "price": 1, "price_external_id": "string", "price_id": "string", "price_tier": [ { "flat_amount": 1, "per_unit_price": 1, "per_unit_price_decimal": "string", "up_to": 1 } ], "product_external_id": "string", "product_id": "string", "product_name": "string", "provider_type": "metronome", "updated_at": "2024-01-15T09:30:00Z", "usage_type": "licensed", "meter_event_name": "string", "meter_event_payload_key": "string", "meter_id": "string", "nickname": "string", "price_decimal": "string", "tiers_mode": "graduated" }, "price_per_unit": 1, "price_per_unit_decimal": "string", "product": { "account_id": "string", "created_at": "2024-01-15T09:30:00Z", "environment_id": "string", "external_id": "string", "id": "string", "is_active": true, "name": "string", "provider_type": "metronome", "updated_at": "2024-01-15T09:30:00Z" }, "singular_name": "string" }, "expiry_type": "duration", "expiry_unit": "billing_periods", "expiry_unit_count": 1, "license_id": "string", "plan": { "id": "string", "name": "string", "description": "string", "image_url": "string" }, "plan_version_id": "string", "price": { "billing_scheme": "per_unit", "created_at": "2024-01-15T09:30:00Z", "currency": "string", "id": "string", "interval": "day", "interval_count": 1, "is_active": true, "package_size": 1, "price": 1, "price_external_id": "string", "price_id": "string", "price_tier": [ { "flat_amount": 1, "per_unit_price": 1, "per_unit_price_decimal": "string", "up_to": 1 } ], "product_external_id": "string", "product_id": "string", "product_name": "string", "provider_type": "metronome", "updated_at": "2024-01-15T09:30:00Z", "usage_type": "licensed", "meter_event_name": "string", "meter_event_payload_key": "string", "meter_id": "string", "nickname": "string", "price_decimal": "string", "tiers_mode": "graduated" }, "reset_cadence": "daily", "reset_start": "billing_period", "credit_icon": "string", "plural_name": "string", "singular_name": "string" } ], "name": "string", "added_on": "2024-01-15T09:30:00Z", "billing_product_external_id": "string", "billing_product_id": "string", "description": "string", "image_url": "string", "plan_period": "string", "plan_price": 1, "plan_version_id": "string" } ], "billing_subscriptions": [ { "cancel_at_period_end": true, "created_at": "2024-01-15T09:30:00Z", "currency": "string", "customer_external_id": "string", "discounts": [ { "coupon_id": "string", "coupon_name": "string", "discount_external_id": "string", "duration": "string", "is_active": true, "started_at": "2024-01-15T09:30:00Z", "subscription_external_id": "string", "amount_off": 1, "currency": "string", "customer_facing_code": "string", "duration_in_months": 1, "ended_at": "2024-01-15T09:30:00Z", "percent_off": 1.1, "promo_code_external_id": "string" } ], "id": "string", "interval": "string", "period_end": 1, "period_start": 1, "products": [ { "billing_scheme": "per_unit", "created_at": "2024-01-15T09:30:00Z", "currency": "string", "environment_id": "string", "external_id": "string", "id": "string", "interval": "string", "name": "string", "package_size": 1, "price": 1, "price_external_id": "string", "price_id": "string", "price_tier": [ { "flat_amount": 1, "per_unit_price": 1, "per_unit_price_decimal": "string", "up_to": 1 } ], "provider_type": "metronome", "quantity": 1.1, "subscription_id": "string", "updated_at": "2024-01-15T09:30:00Z", "usage_type": "licensed", "billing_threshold": 1, "interval_count": 1, "meter_id": "string", "price_decimal": "string", "subscription_item_external_id": "string" } ], "provider_type": "metronome", "status": "string", "subscription_external_id": "string", "total_price": 1, "application_id": "string", "cancel_at": 1, "company_id": "string", "default_payment_method_id": "string", "expired_at": "2024-01-15T09:30:00Z", "latest_invoice": { "amount_due": 1, "amount_paid": 1, "amount_remaining": 1, "collection_method": "string", "created_at": "2024-01-15T09:30:00Z", "currency": "string", "customer_external_id": "string", "ending_balance": 1, "environment_id": "string", "id": "string", "provider_type": "metronome", "starting_balance": 1, "subtotal": 1, "updated_at": "2024-01-15T09:30:00Z", "company_id": "string", "due_date": "2024-01-15T09:30:00Z", "external_id": "string", "payment_method_external_id": "string", "status": "draft", "subscription_external_id": "string", "total": 1, "url": "string" }, "metadata": {}, "payment_method": { "created_at": "2024-01-15T09:30:00Z", "customer_external_id": "string", "environment_id": "string", "external_id": "string", "id": "string", "payment_method_type": "string", "provider_type": "metronome", "updated_at": "2024-01-15T09:30:00Z", "account_last4": "string", "account_name": "string", "bank_name": "string", "billing_email": "string", "billing_name": "string", "card_brand": "string", "card_exp_month": 1, "card_exp_year": 1, "card_last4": "string", "company_id": "string" }, "trial_end": 1, "trial_end_setting": "cancel" } ], "created_at": "2024-01-15T09:30:00Z", "custom_plan_billings": [ { "activation_strategy": "on_payment", "company_id": "string", "created_at": "2024-01-15T09:30:00Z", "days_until_due": 1, "id": "string", "plan_billing_source": "custom_plan", "plan_id": "string", "send_invoice": true, "status": "active", "updated_at": "2024-01-15T09:30:00Z", "billing_cycle_anchor": "2024-01-15T09:30:00Z", "external_invoice_id": "string", "paid_at": "2024-01-15T09:30:00Z", "prorate_first_period": true, "published_at": "2024-01-15T09:30:00Z", "stripe_invoice_url": "string" } ], "entitlements": [ { "feature_id": "string", "feature_key": "string", "value_type": "boolean", "allocation": 1, "consumption_rate": 1.1, "credit_id": "string", "credit_remaining": 1.1, "credit_reserved": 1.1, "credit_settled": 1.1, "credit_total": 1.1, "credit_used": 1.1, "event_name": "string", "event_subtype": "string", "metric_period": "all_time", "metric_reset_at": "2024-01-15T09:30:00Z", "month_reset": "billing_cycle", "soft_limit": 1, "usage": 1, "warning_tiers": [ { "key": "string", "value": 1 } ] } ], "entity_traits": [ { "created_at": "2024-01-15T09:30:00Z", "definition_id": "string", "environment_id": "string", "id": "string", "updated_at": "2024-01-15T09:30:00Z", "value": "string", "definition": { "created_at": "2024-01-15T09:30:00Z", "display_name": "string", "entity_type": "company", "hierarchy": [ "string" ], "id": "string", "trait_type": "boolean", "updated_at": "2024-01-15T09:30:00Z" } } ], "environment_id": "string", "id": "string", "keys": [ { "created_at": "2024-01-15T09:30:00Z", "definition_id": "string", "entity_id": "string", "entity_type": "company", "environment_id": "string", "id": "string", "key": "string", "updated_at": "2024-01-15T09:30:00Z", "value": "string", "definition": { "created_at": "2024-01-15T09:30:00Z", "entity_type": "company", "id": "string", "key": "string", "updated_at": "2024-01-15T09:30:00Z" } } ], "metrics": [ { "account_id": "string", "captured_at_max": "2024-01-15T09:30:00Z", "captured_at_min": "2024-01-15T09:30:00Z", "company_id": "string", "created_at": "2024-01-15T09:30:00Z", "environment_id": "string", "event_subtype": "string", "month_reset": "billing_cycle", "period": "all_time", "value": 1, "valid_until": "2024-01-15T09:30:00Z" } ], "name": "string", "payment_methods": [ { "created_at": "2024-01-15T09:30:00Z", "customer_external_id": "string", "environment_id": "string", "external_id": "string", "id": "string", "payment_method_type": "string", "provider_type": "metronome", "updated_at": "2024-01-15T09:30:00Z", "account_last4": "string", "account_name": "string", "bank_name": "string", "billing_email": "string", "billing_name": "string", "card_brand": "string", "card_exp_month": 1, "card_exp_year": 1, "card_last4": "string", "company_id": "string" } ], "plans": [ { "id": "string", "name": "string", "description": "string", "image_url": "string" } ], "rules": [ { "account_id": "string", "condition_groups": [ { "conditions": [ { "account_id": "string", "condition_type": "base_plan", "environment_id": "string", "id": "string", "operator": "eq", "resource_ids": [ "string" ], "trait_value": "string", "comparison_trait_definition": { "comparable_type": "bool", "entity_type": "company", "id": "string" }, "consumption_rate": 1.1, "credit_id": "string", "event_subtype": "string", "metric_period": "all_time", "metric_period_month_reset": "billing_cycle", "metric_value": 1, "trait_definition": { "comparable_type": "bool", "entity_type": "company", "id": "string" } } ] } ], "conditions": [ { "account_id": "string", "condition_type": "base_plan", "environment_id": "string", "id": "string", "operator": "eq", "resource_ids": [ "string" ], "trait_value": "string", "comparison_trait_definition": { "comparable_type": "bool", "entity_type": "company", "id": "string" }, "consumption_rate": 1.1, "credit_id": "string", "event_subtype": "string", "metric_period": "all_time", "metric_period_month_reset": "billing_cycle", "metric_value": 1, "trait_definition": { "comparable_type": "bool", "entity_type": "company", "id": "string" } } ], "environment_id": "string", "id": "string", "name": "string", "priority": 1, "rule_type": "company_override", "value": true, "flag_id": "string" } ], "updated_at": "2024-01-15T09:30:00Z", "user_count": 1, "billing_credit_balances": {}, "billing_email": "string", "billing_profile": { "account_id": "string", "collection_method": "charge_automatically", "company_id": "string", "created_at": "2024-01-15T09:30:00Z", "environment_id": "string", "id": "string", "is_default": true, "provider_type": "metronome", "updated_at": "2024-01-15T09:30:00Z", "billing_customer_id": "string", "days_until_due": 1, "name": "string", "payment_method_id": "string", "proration_behavior": "create_prorations" }, "billing_profiles": [ { "account_id": "string", "collection_method": "charge_automatically", "company_id": "string", "created_at": "2024-01-15T09:30:00Z", "environment_id": "string", "id": "string", "is_default": true, "provider_type": "metronome", "updated_at": "2024-01-15T09:30:00Z", "billing_customer_id": "string", "days_until_due": 1, "name": "string", "payment_method_id": "string", "proration_behavior": "create_prorations" } ], "billing_subscription": { "cancel_at_period_end": true, "created_at": "2024-01-15T09:30:00Z", "currency": "string", "customer_external_id": "string", "discounts": [ { "coupon_id": "string", "coupon_name": "string", "discount_external_id": "string", "duration": "string", "is_active": true, "started_at": "2024-01-15T09:30:00Z", "subscription_external_id": "string", "amount_off": 1, "currency": "string", "customer_facing_code": "string", "duration_in_months": 1, "ended_at": "2024-01-15T09:30:00Z", "percent_off": 1.1, "promo_code_external_id": "string" } ], "id": "string", "interval": "string", "period_end": 1, "period_start": 1, "products": [ { "billing_scheme": "per_unit", "created_at": "2024-01-15T09:30:00Z", "currency": "string", "environment_id": "string", "external_id": "string", "id": "string", "interval": "string", "name": "string", "package_size": 1, "price": 1, "price_external_id": "string", "price_id": "string", "price_tier": [ { "flat_amount": 1, "per_unit_price": 1, "per_unit_price_decimal": "string", "up_to": 1 } ], "provider_type": "metronome", "quantity": 1.1, "subscription_id": "string", "updated_at": "2024-01-15T09:30:00Z", "usage_type": "licensed", "billing_threshold": 1, "interval_count": 1, "meter_id": "string", "price_decimal": "string", "subscription_item_external_id": "string" } ], "provider_type": "metronome", "status": "string", "subscription_external_id": "string", "total_price": 1, "application_id": "string", "cancel_at": 1, "company_id": "string", "default_payment_method_id": "string", "expired_at": "2024-01-15T09:30:00Z", "latest_invoice": { "amount_due": 1, "amount_paid": 1, "amount_remaining": 1, "collection_method": "string", "created_at": "2024-01-15T09:30:00Z", "currency": "string", "customer_external_id": "string", "ending_balance": 1, "environment_id": "string", "id": "string", "provider_type": "metronome", "starting_balance": 1, "subtotal": 1, "updated_at": "2024-01-15T09:30:00Z", "company_id": "string", "due_date": "2024-01-15T09:30:00Z", "external_id": "string", "payment_method_external_id": "string", "status": "draft", "subscription_external_id": "string", "total": 1, "url": "string" }, "metadata": {}, "payment_method": { "created_at": "2024-01-15T09:30:00Z", "customer_external_id": "string", "environment_id": "string", "external_id": "string", "id": "string", "payment_method_type": "string", "provider_type": "metronome", "updated_at": "2024-01-15T09:30:00Z", "account_last4": "string", "account_name": "string", "bank_name": "string", "billing_email": "string", "billing_name": "string", "card_brand": "string", "card_exp_month": 1, "card_exp_year": 1, "card_last4": "string", "company_id": "string" }, "trial_end": 1, "trial_end_setting": "cancel" }, "default_payment_method": { "created_at": "2024-01-15T09:30:00Z", "customer_external_id": "string", "environment_id": "string", "external_id": "string", "id": "string", "payment_method_type": "string", "provider_type": "metronome", "updated_at": "2024-01-15T09:30:00Z", "account_last4": "string", "account_name": "string", "bank_name": "string", "billing_email": "string", "billing_name": "string", "card_brand": "string", "card_exp_month": 1, "card_exp_year": 1, "card_last4": "string", "company_id": "string" }, "last_seen_at": "2024-01-15T09:30:00Z", "logo_url": "string", "pending_migration": { "migration_id": "string", "to_plan_id": "string", "to_plan_name": "string", "to_plan_version_id": "string", "scheduled_for": "2024-01-15T09:30:00Z", "to_plan_version_number": 1 }, "plan": { "id": "string", "included_credit_grants": [ { "billing_credit_auto_topup_enabled": true, "billing_credit_auto_topup_self_service": true, "billing_credit_can_buy_bundles": true, "billing_credit_postpaid_enabled": true, "billing_mode": "granted", "company_credit_amount": 1, "created_at": "2024-01-15T09:30:00Z", "credit_amount": 1, "credit_id": "string", "id": "string", "plan_id": "string", "reset_type": "no_reset", "rollover_percentage": 1, "scaling": "fixed", "updated_at": "2024-01-15T09:30:00Z", "credit_description": "string", "credit_name": "string", "billing_credit_arrears_anchor": "billing_period_start", "billing_credit_arrears_cadence": "end_of_billing_period", "billing_credit_auto_topup_amount": 1, "billing_credit_auto_topup_amount_type": "string", "billing_credit_auto_topup_availability": "off", "billing_credit_auto_topup_expiry_type": "duration", "billing_credit_auto_topup_expiry_unit": "billing_periods", "billing_credit_auto_topup_expiry_unit_count": 1, "billing_credit_auto_topup_threshold_credits": 1, "billing_credit_auto_topup_threshold_percent": 1, "billing_credit_overdraft_limit": 1.1, "billing_credit_postpaid_rate_per_unit": 1, "billing_credit_postpaid_rate_per_unit_decimal": "string", "billing_product_price_id": "string", "company_auto_topup_amount": 1, "company_auto_topup_enabled": true, "company_auto_topup_threshold_credits": 1, "credit": { "account_id": "string", "burn_strategy": "expiration_priority", "cost_editable": true, "created_at": "2024-01-15T09:30:00Z", "currency_prices": [ { "currency": "string", "price": { "billing_scheme": "per_unit", "created_at": "2024-01-15T09:30:00Z", "currency": "string", "id": "string", "interval": "day", "interval_count": 1, "is_active": true, "package_size": 1, "price": 1, "price_external_id": "string", "price_id": "string", "price_tier": [ { "flat_amount": 1, "per_unit_price": 1, "per_unit_price_decimal": "string", "up_to": 1 } ], "product_external_id": "string", "product_id": "string", "product_name": "string", "provider_type": "metronome", "updated_at": "2024-01-15T09:30:00Z", "usage_type": "licensed", "meter_event_name": "string", "meter_event_payload_key": "string", "meter_id": "string", "nickname": "string", "price_decimal": "string", "tiers_mode": "graduated" } } ], "default_expiry_unit": "billing_periods", "default_rollover_policy": "expire", "description": "string", "environment_id": "string", "id": "string", "ledger_authority": "schematic_authoritative", "name": "string", "updated_at": "2024-01-15T09:30:00Z", "default_expiry_unit_count": 1, "icon": "string", "plural_name": "string", "price": { "billing_scheme": "per_unit", "created_at": "2024-01-15T09:30:00Z", "currency": "string", "id": "string", "interval": "day", "interval_count": 1, "is_active": true, "package_size": 1, "price": 1, "price_external_id": "string", "price_id": "string", "price_tier": [ { "flat_amount": 1, "per_unit_price": 1, "per_unit_price_decimal": "string", "up_to": 1 } ], "product_external_id": "string", "product_id": "string", "product_name": "string", "provider_type": "metronome", "updated_at": "2024-01-15T09:30:00Z", "usage_type": "licensed", "meter_event_name": "string", "meter_event_payload_key": "string", "meter_id": "string", "nickname": "string", "price_decimal": "string", "tiers_mode": "graduated" }, "price_per_unit": 1, "price_per_unit_decimal": "string", "product": { "account_id": "string", "created_at": "2024-01-15T09:30:00Z", "environment_id": "string", "external_id": "string", "id": "string", "is_active": true, "name": "string", "provider_type": "metronome", "updated_at": "2024-01-15T09:30:00Z" }, "singular_name": "string" }, "expiry_type": "duration", "expiry_unit": "billing_periods", "expiry_unit_count": 1, "license_id": "string", "plan": { "id": "string", "name": "string", "description": "string", "image_url": "string" }, "plan_version_id": "string", "price": { "billing_scheme": "per_unit", "created_at": "2024-01-15T09:30:00Z", "currency": "string", "id": "string", "interval": "day", "interval_count": 1, "is_active": true, "package_size": 1, "price": 1, "price_external_id": "string", "price_id": "string", "price_tier": [ { "flat_amount": 1, "per_unit_price": 1, "per_unit_price_decimal": "string", "up_to": 1 } ], "product_external_id": "string", "product_id": "string", "product_name": "string", "provider_type": "metronome", "updated_at": "2024-01-15T09:30:00Z", "usage_type": "licensed", "meter_event_name": "string", "meter_event_payload_key": "string", "meter_id": "string", "nickname": "string", "price_decimal": "string", "tiers_mode": "graduated" }, "reset_cadence": "daily", "reset_start": "billing_period", "credit_icon": "string", "plural_name": "string", "singular_name": "string" } ], "name": "string", "added_on": "2024-01-15T09:30:00Z", "billing_product_external_id": "string", "billing_product_id": "string", "description": "string", "image_url": "string", "plan_period": "string", "plan_price": 1, "plan_version_id": "string" }, "scheduled_downgrade": { "currency": "string", "effective_after": "2024-01-15T09:30:00Z", "from_plan_id": "string", "from_plan_name": "string", "from_subscription_price": 1, "id": "string", "interval": "string", "to_plan_id": "string", "to_plan_name": "string", "scheduled_interval": "string", "scheduled_price": 1 }, "traits": {} }, "params": {} } ``` **SDK Code** ```python import requests url = "https://api.schematichq.com/companies" payload = {} headers = { "X-Schematic-Api-Key": "", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript const url = 'https://api.schematichq.com/companies'; const options = { method: 'POST', headers: {'X-Schematic-Api-Key': '', 'Content-Type': 'application/json'}, body: '{}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.schematichq.com/companies" payload := strings.NewReader("{}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("X-Schematic-Api-Key", "") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby require 'uri' require 'net/http' url = URI("https://api.schematichq.com/companies") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["X-Schematic-Api-Key"] = '' request["Content-Type"] = 'application/json' request.body = "{}" response = http.request(request) puts response.read_body ``` ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api.schematichq.com/companies") .header("X-Schematic-Api-Key", "") .header("Content-Type", "application/json") .body("{}") .asString(); ``` ```php request('POST', 'https://api.schematichq.com/companies', [ 'body' => '{}', 'headers' => [ 'Content-Type' => 'application/json', 'X-Schematic-Api-Key' => '', ], ]); echo $response->getBody(); ``` ```csharp using RestSharp; var client = new RestClient("https://api.schematichq.com/companies"); var request = new RestRequest(Method.POST); request.AddHeader("X-Schematic-Api-Key", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let headers = [ "X-Schematic-Api-Key": "", "Content-Type": "application/json" ] let parameters = [] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.schematichq.com/companies")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ```