### Netsuite Configuration Example Source: https://docs.metronome.com/api-reference/customers/set-billing-provider-configurations-for-a-customer Example configuration for Netsuite, providing the customer ID. ```yaml netsuite_customer_id: '12345' ``` -------------------------------- ### Stripe Configuration Example Source: https://docs.metronome.com/api-reference/customers/set-billing-provider-configurations-for-a-customer Example configuration for Stripe, specifying collection method and draft invoice handling. ```yaml stripe_collection_method: charge_automatically leave_stripe_invoices_in_draft: true ``` -------------------------------- ### Example Request Body Source: https://docs.metronome.com/api-reference/credits-and-commits/get-the-net-balance-of-a-customer This example shows how to request the net balance for a customer, specifying credit types and filters for both credits and commits. ```json { "customer_id": "13117714-3f05-48e5-a6e9-a66093f13b4d", "credit_type_id": "2714e483-4ff1-48e4-9e25-ac732e8f24f2", "filters": [ { "balance_types": [ "CREDIT" ], "custom_fields": { "campaign": "free-trial" } }, { "balance_types": [ "PREPAID_COMMIT", "POSTPAID_COMMIT" ], "custom_fields": { "campaign": "signup-promotion" } } ] } ``` -------------------------------- ### Create Customer Request Example Source: https://docs.metronome.com/api-reference/customers/create-a-customer This example shows the structure of a request payload to create a new customer with billing configuration. ```json { "ingest_aliases": [ "team@example.com" ], "name": "Example, Inc.", "customer_billing_provider_configurations": [ { "billing_provider": "stripe", "delivery_method": "direct_to_billing_provider", "configuration": { "stripe_customer_id": "cus_123", "stripe_collection_method": "charge_automatically" } } ] } ``` -------------------------------- ### AWS Marketplace Configuration Example Source: https://docs.metronome.com/api-reference/customers/set-billing-provider-configurations-for-a-customer Example configuration for AWS Marketplace customers, including subscription product and region. ```yaml aws_customer_id: cust_1234 aws_product_code: my_product aws_region: us-west-1 ``` -------------------------------- ### Azure Marketplace Configuration Example Source: https://docs.metronome.com/api-reference/customers/set-billing-provider-configurations-for-a-customer Example configuration for Azure Marketplace customers, specifying the subscription ID. ```yaml azure_subscription_id: my_subscription ``` -------------------------------- ### GCP Marketplace Configuration Example Source: https://docs.metronome.com/api-reference/customers/set-billing-provider-configurations-for-a-customer Example configuration for GCP Marketplace customers, including entitlement ID and service name. ```yaml gcp_entitlement_id: my_entitlement gcp_service_name: my_service ``` -------------------------------- ### Add a Rate Response Example Source: https://docs.metronome.com/api-reference/rate-cards/add-a-rate This example shows a successful response when adding a rate. It confirms the rate type and price that were successfully added. ```json { "data": { "rate_type": "FLAT", "price": 100 } } ``` -------------------------------- ### Example Response Body Source: https://docs.metronome.com/api-reference/credits-and-commits/get-the-net-balance-of-a-customer This example demonstrates the structure of a successful response, showing the customer's net balance and the corresponding credit type ID. ```json { "data": { "balance": 123.45, "credit_type_id": "2714e483-4ff1-48e4-9e25-ac732e8f24f2" } } ``` -------------------------------- ### Provision a customer with a package Source: https://docs.metronome.com/guides/get-started/core-concepts/packages-overview Provision a customer using the `/contracts/create` endpoint. This example shows how to provision a customer with the 'Starter Plan' package. ```APIDOC ## POST /v1/contracts/create ### Description Provisions a customer with a specified package. ### Method POST ### Endpoint https://api.metronome.com/v1/contracts/create ### Parameters #### Request Body - **customer_id** (string) - Required - The ID of the customer to provision. - **starting_at** (string) - Required - The date and time the contract should start, in ISO 8601 format. - **package_alias** (string) - Required - The alias of the package to assign to the customer. ### Request Example ```json { "customer_id": "aa58107d-162f-407e-9f09-940f16adbb1c", "starting_at": "2025-10-01T00:00:00.000Z", "package_alias": "Starter Plan" } ``` ### Response #### Success Response (200) Details of the created contract, including attached package information. #### Response Example (Response structure not provided in source) ``` -------------------------------- ### Get Contract Edit History Request Source: https://docs.metronome.com/api-reference/contracts/get-contract-edit-history This cURL example demonstrates how to call the Get contract edit history endpoint with the required customer and contract IDs. ```cURL curl --request POST \ --url https://api.metronome.com/v2/contracts/getEditHistory \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --data '{ "customer_id": "13117714-3f05-48e5-a6e9-a66093f13b4d", "contract_id": "d7abd0cd-4ae9-4db7-8676-e986a4ebd8dc" }' ``` -------------------------------- ### v1 Contracts Get Response Example Source: https://docs.metronome.com/guides/implement-metronome/migrate-amendments-to-edits This is an example of the response structure from the v1 `/contracts/get` endpoint, which includes separate fields for current contract state and amendments. ```json { "data": { "amendments": [ { "commits": [ { "access_schedule": { "credit_type": { "id": "2714e483-4ff1-48e4-9e25-ac732e8f24f2", "name": "USD (cents)" }, "schedule_items": [ { "amount": 20000, "ending_before": "2025-05-01T00:00:00+00:00", "id": "7fe2e509-b531-4f8e-8c5b-224b560cf35a", "starting_at": "2025-02-01T00:00:00+00:00" } ] }, "applicable_contract_ids": [ "51f66575-81cc-49d1-9a3f-55b97423342e" ], "contract": { "id": "51f66575-81cc-49d1-9a3f-55b97423342e" }, "custom_fields": {}, "id": "c0a6b92a-851d-403c-b705-62e89467355a", "invoice_schedule": { "credit_type": { "id": "2714e483-4ff1-48e4-9e25-ac732e8f24f2", "name": "USD (cents)" }, "schedule_items": [ { "amount": 20000, "id": "7b19a696-026d-4921-9999-27c33fdb10ab", "invoice_id": "39c80bd1-357a-5268-88e1-bc1e7a06e082", "quantity": 1, "timestamp": "2025-02-19T00:00:00+00:00", "unit_price": 20000 } ] }, "priority": 100, "product": { "id": "35a467c7-fc24-46c2-884b-66af8d349674", "name": "Support" }, "rate_type": "LIST_RATE", "type": "PREPAID" } ], "created_at": "2025-02-19T19:42:14.117000+00:00", "created_by": "Username", "credits": [], "id": "2e200c08-9b73-438f-a36b-4488e979b7c3", "overrides": [], "scheduled_charges": [], "starting_at": "2025-02-19T00:00:00+00:00" } ], "current": { "commits": [ { "access_schedule": { "credit_type": { "id": "2714e483-4ff1-48e4-9e25-ac732e8f24f2", "name": "USD (cents)" }, "schedule_items": [ { "amount": 20000, "ending_before": "2025-05-01T00:00:00+00:00", "id": "7fe2e509-b531-4f8e-8c5b-224b560cf35a", "starting_at": "2025-02-01T00:00:00+00:00" } ] }, "applicable_contract_ids": [ "51f66575-81cc-49d1-9a3f-55b97423342e" ], "contract": { "id": "51f66575-81cc-49d1-9a3f-55b97423342e" }, "custom_fields": {}, "id": "c0a6b92a-851d-403c-b705-62e89467355a", "invoice_schedule": { "credit_type": { "id": "2714e483-4ff1-48e4-9e25-ac732e8f24f2", "name": "USD (cents)" }, "schedule_items": [ { "amount": 20000, "ending_before": "2025-05-01T00:00:00+00:00", "id": "7fe2e509-b531-4f8e-8c5b-224b560cf35a", "starting_at": "2025-02-01T00:00:00+00:00" } ] }, "priority": 100, "product": { "id": "35a467c7-fc24-46c2-884b-66af8d349674", "name": "Support" }, "rate_type": "LIST_RATE", "type": "PREPAID" } ], "created_at": "2025-02-19T19:42:14.117000+00:00", "created_by": "Username", "credits": [], "id": "2e200c08-9b73-438f-a36b-4488e979b7c3", "overrides": [], "scheduled_charges": [], "starting_at": "2025-02-19T00:00:00+00:00" } } } ``` -------------------------------- ### Provision Customer with Starter Plan Package Source: https://docs.metronome.com/guides/implement-metronome/core-concepts/packages-overview Use the `/contracts/create` endpoint to provision a customer with a specific package. Ensure you have the correct customer ID and package alias. ```json curl https://api.metronome.com/v1/contracts/create \ -H "Authorization: Bearer " \ -H "Content-Type: application/json" \ -d '{ "customer_id": "aa58107d-162f-407e-9f09-940f16adbb1c", "starting_at": "2025-10-01T00:00:00.000Z", "package_alias": "Starter Plan" }' ``` -------------------------------- ### Create a Package via API Source: https://docs.metronome.com/guides/get-started/core-concepts/packages-overview Use the `/packages/create` endpoint to define a new package. This example demonstrates setting up a 'Starter Plan' with recurring credits and subscription fees. ```json curl https://api.metronome.com/v1/packages/create \ -H "Authorization: Bearer " \ -H "Content-Type: application/json" \ -d '{ "name": "Starter Plan (as of Oct 2025)", "rate_card_alias": "Tokens rate card", "aliases": [{ "name": "Starter Plan", "starting_at": "2025-10-01T00:00:00.000Z" }], "net_payment_terms_days": 15, "duration": { "value": 12, "unit": "MONTHS" }, "recurring_credits": [{ "product_id": "5cd945a1-7a70-4875-b2b3-f9e3b28c647c", "access_amount": { "unit_price": 1000, "credit_type_id": "2714e483-4ff1-48e4-9e25-ac732e8f24f2" }, "priority": 1, "commit_duration": { "value": 1, "unit": "PERIODS" }, "starting_at_offset": { "value": 0, "unit": "MONTHS" }, "duration": { "value": 3, "unit": "MONTHS" } }], "subscriptions":[{ "collection_schedule": "advance", "initial_quantity": 1, "proration": { "invoice_behavior": "BILL_IMMEDIATELY", "is_prorated": true }, "subscription_rate": { "billing_frequency": "monthly", "product_id": "76f29162-7f5c-4ee6-89ed-ebbd592d767e" }, }] }' ``` -------------------------------- ### Add Override using /contracts/amend Source: https://docs.metronome.com/guides/implement-metronome/migrate-amendments-to-edits Example of adding an overwrite override to a product using the legacy /contracts/amend endpoint. This requires specifying a starting date for the amendment. ```json { "customer_id": "e15ce0e6-33f0-44bb-89c7-05bc296f5b5e", "contract_id": "f9e0b117-42e0-4145-b524-b97302a57518", "starting_at": "2025-02-01T00:00:00.000Z", "overrides": [ { "starting_at": "2025-02-01T00:00:00Z", "type": "OVERWRITE", "product_id": "fac0de5f-f00c-468c-9490-cc64c5d5a696", "overwrite_rate": { "rate_type": "tiered", "tiers": [ { "size": 2000, "price": 0 }, { "size": 2000, "price": 100 }, { "price": 200 } ] } } ] } ``` -------------------------------- ### Get an offset lifecycle event notification configuration Source: https://docs.metronome.com/api-reference/notifications/get-an-offset-lifecycle-event-notification-configuration Retrieves an offset lifecycle event notification configuration by its ID. This is useful for inspecting the details of a specific notification setup. ```APIDOC ## POST /v2/notifications/get ### Description Retrieves an offset lifecycle event notification configuration. ### Method POST ### Endpoint https://api.metronome.com/v2/notifications/get ### Parameters #### Header Parameters - **Authorization** (string) - Required - Bearer authentication header of the form `Bearer `, where `` is your auth token. - **Content-Type** (string) - Required - application/json #### Request Body - **id** (string) - Required - The ID of the notification configuration to retrieve ### Request Example ```json { "id": "d7abd0cd-4ae9-4db7-8676-e986a4ebd8dc" } ``` ### Response #### Success Response (200) - **data** (object) - Required - Contains the notification configuration details. - **id** (string) - The ID of the notification configuration. - **name** (string) - The name of the notification. - **type** (string) - The type of the notification (e.g., "OFFSET_LIFECYCLE_EVENT"). - **policy** (object) - The policy defining the notification trigger. - **type** (string) - The type of policy (e.g., "contract.start"). - **offset** (string) - The offset duration (e.g., "P1D"). - **environment_type** (string) - The environment type (e.g., "PRODUCTION"). - **created_at** (string) - The timestamp when the notification was created. - **created_by** (string) - The user who created the notification. - **archived_at** (null) - The timestamp when the notification was archived (if applicable). #### Response Example ```json { "data": { "id": "d7abd0cd-4ae9-4db7-8676-e986a4ebd8dc", "name": "+1 day after contract starts", "type": "OFFSET_LIFECYCLE_EVENT", "policy": { "type": "contract.start", "offset": "P1D" }, "environment_type": "PRODUCTION", "created_at": "2024-01-15T10:30:00Z", "created_by": "Martins Seyi", "archived_at": null } } ``` ``` -------------------------------- ### Create a Package via API Source: https://docs.metronome.com/guides/implement-metronome/core-concepts/packages-overview Use the `/packages/create` endpoint to programmatically create a package. This example demonstrates setting up a 'Starter Plan' with recurring credits and subscriptions. ```bash curl https://api.metronome.com/v1/packages/create \ -H "Authorization: Bearer " \ -H "Content-Type: application/json" \ -d '{ "name": "Starter Plan (as of Oct 2025)", "rate_card_alias": "Tokens rate card", "aliases": [{ "name": "Starter Plan", "starting_at": "2025-10-01T00:00:00.000Z" }], "net_payment_terms_days": 15, "duration": { "value": 12, "unit": "MONTHS" }, "recurring_credits": [{ "product_id": "5cd945a1-7a70-4875-b2b3-f9e3b28c647c", "access_amount": { "unit_price": 1000, "credit_type_id": "2714e483-4ff1-48e4-9e25-ac732e8f24f2" }, "priority": 1, "commit_duration": { "value": 1, "unit": "PERIODS" }, "starting_at_offset": { "value": 0, "unit": "MONTHS" }, "duration": { "value": 3, "unit": "MONTHS" } }], "subscriptions":[{ "collection_schedule": "advance", "initial_quantity": 1, "proration": { "invoice_behavior": "BILL_IMMEDIATELY", "is_prorated": true }, "subscription_rate": { "billing_frequency": "monthly", "product_id": "76f29162-7f5c-4ee6-89ed-ebbd592d767e" } }] }' ``` -------------------------------- ### Create Package for New Customers with New Product Entitled Source: https://docs.metronome.com/guides/pricing-packaging/make-pricing-changes/make-a-pricing-change Create a package that includes the new product with entitlement set to true. This package is intended for new customers and uses a specific rate card. ```bash curl \ -H "Authorization: Bearer " \ -H "Content-Type: application/json" \ -d '{ \ "name": "2024 Compute Pricing", "rate_card_id": "d7abd0cd-4ae9-4db7-8676-e986a4ebd8dc", "aliases": [{ "name": "New Customer Pricing", "starting_at": "2024-01-01T00:00:00.000Z" }], "net_payment_terms_days": 15, "duration": { "value": 12, "unit": "MONTHS" }, "overrides": [{ "starting_offset": { "value": 0, "unit": "MONTHS" }, "override_specifiers": [{ "product_id": "13117714-3f05-48e5-a6e9-a66093f13b4d", "pricing_group_values": { "region": "us-west-2", "cloud": "aws" } }], "entitled": true }] }' ``` -------------------------------- ### Get Rate Schedule Source: https://docs.metronome.com/api-reference/rate-cards/get-a-rate-schedule Fetches the rate schedule for a specified rate card, starting from a given date. It can be filtered by product ID and pricing group values to narrow down the results. ```APIDOC ## POST /v1/contract-pricing/rate-cards/getRateSchedule ### Description Retrieves the rate schedule for a given rate card, optionally filtering by date and product. ### Method POST ### Endpoint https://api.metronome.com/v1/contract-pricing/rate-cards/getRateSchedule ### Parameters #### Header Parameters - **Authorization** (string) - Required - Bearer authentication header of the form `Bearer `. #### Query Parameters - **limit** (integer) - Optional - Max number of results that should be returned. Required range: `1 <= x <= 100`. - **next_page** (string) - Optional - Cursor that indicates where the next page of results should start. #### Request Body - **rate_card_id** (string) - Required - ID of the rate card to get the schedule for. - **starting_at** (string) - Required - Inclusive starting point for the rates schedule. - **ending_before** (string) - Optional - Exclusive end date for the rates schedule. When not specified, rates will show all future schedule segments. - **selectors** (object[]) - Optional - List of rate selectors. Rates matching ANY of the selector will be included in the response. Passing no selectors will result in all rates being returned. - **product_id** (string) - Optional - The ID of the product. - **partial_pricing_group_values** (object) - Optional - A partial match for pricing group values. - **region** (string) - Optional - The region of the pricing group. - **cloud** (string) - Optional - The cloud provider of the pricing group. ### Request Example ```json { "rate_card_id": "f3d51ae8-f283-44e1-9933-a3cf9ad7a6fe", "starting_at": "2024-01-01T00:00:00.000Z", "selectors": [ { "product_id": "d6300dbb-882e-4d2d-8dec-5125d16b65d0", "partial_pricing_group_values": { "region": "us-west-2", "cloud": "aws" } } ] } ``` ### Response #### Success Response (200) - **data** (object[]) - Required - List of rate schedule entries. - **product_id** (string) - The ID of the product. - **product_name** (string) - The name of the product. - **product_tags** (string[]) - Tags associated with the product. - **product_custom_fields** (object) - Custom fields for the product. - **starting_at** (string) - The start date for this rate segment. - **entitled** (boolean) - Indicates if the product is entitled. - **rate** (object) - The rate details. - **price** (number) - The price per unit. - **tiers** (object[]) - Pricing tiers. - **price** (number) - The price for this tier. - **size** (number) - The size of this tier. - **pricing_group_values** (object) - Pricing group values for this rate. - **credit_type** (object) - The credit type associated with the rate. - **name** (string) - The name of the credit type. - **id** (string) - The ID of the credit type. - **pricing_group_values** (object) - The pricing group values for this rate segment. - **ending_before** (string) - The end date for this rate segment (exclusive). - **commit_rate** (object) - The commit rate details. - **price** (number) - The commit price. - **tiers** (object[]) - Commit pricing tiers. - **price** (number) - The price for this commit tier. - **size** (number) - The size of this commit tier. - **next_page** (string | null) - Cursor for the next page of results. #### Response Example ```json { "data": [ { "product_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a", "product_name": "", "product_tags": [ "" ], "product_custom_fields": {}, "starting_at": "2023-11-07T05:31:56Z", "entitled": true, "rate": { "price": 123, "tiers": [ { "price": 123, "size": 123 } ], "pricing_group_values": {}, "credit_type": { "name": "", "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a" } }, "pricing_group_values": {}, "ending_before": "2023-11-07T05:31:56Z", "commit_rate": { "price": 123, "tiers": [ { "price": 123, "size": 123 } ] } } ], "next_page": "" } ``` ``` -------------------------------- ### Successful Response Example Source: https://docs.metronome.com/api-reference/contracts/get-subscription-quantity-history This JSON object represents a successful response from the getSubscriptionQuantityHistory endpoint, showing the historical data including starting dates, quantities, unit prices, and totals. ```json { "data": { "subscription_id": "1a824d53-bde6-4d82-96d7-6347ff227d5c", "fiat_credit_type_id": "2714e483-4ff1-48e4-9e25-ac732e8f24f2", "history": [ { "starting_at": "2020-01-01T00:00:00.000Z", "data": [ { "quantity": 100, "unit_price": 1000, "total": 100000 } ] }, { "starting_at": "2020-02-01T00:00:00.000Z", "data": [ { "quantity": 100, "unit_price": 1000, "total": 100000 }, { "quantity": 200, "unit_price": 2000, "total": 400000 } ] } ] } } ``` -------------------------------- ### Create a Customer Contract via API Source: https://docs.metronome.com/guides/customers-billing/manage-customers/provision-a-customer Use the `/contracts/create` endpoint to provision a customer contract. This example demonstrates setting up a contract with a prepaid commit and scheduled platform fees. ```bash curl https://api.metronome.com/v1/contracts/create \ -H "Authorization: Bearer " \ -H "Content-Type: application/json" \ -d '{ "customer_id": "aa58107d-162f-407e-9f09-940f16adbb1c", "rate_card_alias": "base_usage_products", "starting_at": "2024-11-01T00:00:00.000Z", "billing_provider_configuration": { "billing_provider": "aws_marketplace", "delivery_method": "direct_to_billing_provider" }, "commits": [ { "type": "prepaid", "name": "Contract Prepaid Commit", "product_id": "a1f4e40b-f8c4-496b-b687-0a103396b479", "access_schedule": { "schedule_items": [ { "amount": 1000000, "starting_at": "2024-11-01T00:00:00.000Z", "ending_before": "2025-11-01T00:00:00.000Z" } ] }, "invoice_schedule": { "schedule_items": [ { "unit_price": 1000000, "quantity": 1, "timestamp": "2024-11-01T00:00:00.000Z" } ] }, "applicable_product_tags": ["cloud"], "description": "Usage Commit" } ], "scheduled_charges": [ { "product_id": "06cf3703-3f5e-467c-8ba1-0ee934c740b9", "name": "Platform Charge", "schedule": { "recurring_schedule": { "starting_at": "2024-11-01T00:00:00.000Z", "ending_before": "2025-11-01T00:00:00.000Z", "frequency": "quarterly", "unit_price": 100000, "quantity": 1, "amount_distribution": "each" } } } ], "usage_statement_schedule": { "frequency": "monthly", "day": "contract_start" } }' ``` -------------------------------- ### Get Plan Adjustments Source: https://docs.metronome.com/api-reference/plans/get-the-plan-adjustments-for-a-customer Fetches all price adjustments for a given customer and customer plan. This includes details like charge ID, type, start period, and specific price adjustments. ```APIDOC ## GET /customers/{customer_id}/plans/{customer_plan_id}/priceAdjustments ### Description Retrieves the plan adjustments for a specific customer and customer plan. ### Method GET ### Endpoint /v1/customers/{customer_id}/plans/{customer_plan_id}/priceAdjustments ### Parameters #### Path Parameters - **customer_id** (string) - Required - The unique identifier for the customer. - **customer_plan_id** (string) - Required - The ID of the customer-plan relationship. #### Query Parameters - **limit** (integer) - Optional - Maximum number of results to return. Must be between 1 and 100. - **next_page** (string) - Optional - Cursor for paginating to the next page of results. #### Authorization - **Authorization** (string) - Required - Bearer authentication token. Format: `Bearer `. ### Response #### Success Response (200) - **data** (object[]) - Required - An array of price adjustment objects. - **charge_id** (string) - The ID of the charge. - **charge_type** (string) - The type of charge (e.g., 'usage', 'fixed'). - **start_period** (integer) - The starting period for the adjustment. - **prices** (object[]) - An array of price adjustment details. - **adjustment_type** (string) - The type of adjustment (e.g., 'fixed', 'quantity', 'override', 'percentage'). - **value** (number) - The value of the adjustment. - **tier** (integer) - Optional - The tier for 'override' adjustment types. - **next_page** (string | null) - A cursor for fetching the next page of results, or null if there are no more pages. ``` -------------------------------- ### Get Contract Edit History Example Source: https://docs.metronome.com/guides/pricing-packaging/make-pricing-changes/edit-contract This JSON response shows the edit history of a contract, illustrating two edits: one for adding overrides and another for adding a commit. This data can be retrieved using the `getEditHistory` endpoint. ```json { "data": [ { "add_overrides": [ { "applicable_product_tags": [], "id": "80c8e124-a4fb-4264-b2e6-ac2479d075dc", "is_commit_specific": false, "multiplier": 0.5, "override_specifiers": [ { "product_id": "90c47b63-8095-4369-9779-c65cc4fe3af7" } ], "product": { "id": "90c47b63-8095-4369-9779-c65cc4fe3af7", "name": "Reads" }, "starting_at": "2025-02-01T00:00:00+00:00", "type": "MULTIPLIER" } ], "id": "a19c750a-ffe4-57ae-9645-cb8682904afb", "timestamp": "2025-02-26T23:07:00.727000+00:00" }, { "add_commits": [ { "access_schedule": { "credit_type": { "id": "2714e483-4ff1-48e4-9e25-ac732e8f24f2", "name": "USD (cents)" }, "schedule_items": [ { "amount": 10000, "ending_before": "2025-03-01T00:00:00+00:00", "id": "11980e47-96b5-4527-bb38-149edc205c34", "starting_at": "2025-02-01T00:00:00+00:00" } ] }, "id": "e647c959-9eeb-49d2-ac21-2f2141e3e1fd", "invoice_schedule": { "credit_type": { "id": "2714e483-4ff1-48e4-9e25-ac732e8f24f2", "name": "USD (cents)" }, "schedule_items": [ { "amount": 10000, "id": "c5cb2f25-fa4e-4ff6-9cdd-ff5edfe73acc", "invoice_id": "0ce97fbd-d19f-52c8-80d6-4b877ad31177", "quantity": 1, "timestamp": "2025-02-01T00:00:00+00:00", "unit_price": 10000 } ] }, "priority": 100, "product": { "id": "35a467c7-fc24-46c2-884b-66af8d349674", "name": "Support" }, "rate_type": "LIST_RATE", "type": "PREPAID" } ], "id": "0551864c-edc7-5045-bcec-3688b4d53c3f", "timestamp": "2025-02-26T23:07:16.031000+00:00" } ] } ``` -------------------------------- ### Fetch First Page of Customers Source: https://docs.metronome.com/api-reference/pagination Use the 'limit' parameter to specify the number of results per page. This example fetches the first 10 customers. ```bash GET /v1/customers?limit=10 ``` -------------------------------- ### Create a Rate Card with Aliases via API Source: https://docs.metronome.com/guides/implement-metronome/core-concepts/create-manage-rate-cards Use this example to create a new rate card with multiple aliases, each having specific start and end dates. This is useful for managing different versions or customer-specific pricing over time. ```bash curl https://api.metronome.com/v1/contract-pricing/rate-cards/create \ -H "Authorization: Bearer " \ -H "Content-Type: application/json" \ -d '{ "name": "Rate Card Sample", "description": "Rate Card Sample", "aliases": [ { "name": "Sample Alias - Customer Workflow 1", "starting_at": "2024-01-01T00:00:00.000Z", "ending_before": "2025-01-01T00:00:00.000Z" }, { "name": "Sample Alias - Custom Workflow 2", "starting_at": "2025-01-01T00:00:00.000Z", "ending_before": "2026-01-01T00:00:00.000Z" } ] }' ``` -------------------------------- ### Get Rate Schedule Request Source: https://docs.metronome.com/api-reference/rate-cards/get-a-rate-schedule Use this cURL command to send a POST request to the getRateSchedule endpoint. Include your API token and specify the rate card ID, starting date, and selectors for the desired rate schedule. ```curl curl --request POST \ --url https://api.metronome.com/v1/contract-pricing/rate-cards/getRateSchedule \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --data ' { "rate_card_id": "f3d51ae8-f283-44e1-9933-a3cf9ad7a6fe", "starting_at": "2024-01-01T00:00:00.000Z", "selectors": [ { "product_id": "d6300dbb-882e-4d2d-8dec-5125d16b65d0", "partial_pricing_group_values": { "region": "us-west-2", "cloud": "aws" } } ] }' ``` -------------------------------- ### Create Contract with Prepaid Commit and Commit-Specific Overrides Source: https://docs.metronome.com/pricing-packaging/apply-credits-commits/discounts This example demonstrates how to create a contract that includes a prepaid commit and two commit-specific overrides. The first override applies a general discount to the 'audio' product tag, while the second, higher-priority override applies a larger discount specifically when consuming 'prepaid_commit_A' for the 'audio' product tag. ```bash curl https://api.staging.metronome.com/v1/contracts/create \ -H "Authorization: Bearer " \ -H "Content-Type: application/json" \ -d '{ "customer_id": "bc20325a-80a0-468e-868f-a2f28b972af8", "starting_at": "2024-10-01T00:00:00.000Z", "rate_card_id": "d7abd0cd-4ae9-4db7-8676-e986a4ebd8dc", "commits": [ { "temporary_id": "prepaid_commit_A", "type":"prepaid", "priority":1, "name":"Prepaid Commit A", "product_id":"f14d6729-6a44-4b13-9908-9387f1918790", "access_schedule": { "credit_type_id": "2714e483-4ff1-48e4-9e25-ac732e8f24f2", "schedule_items": [ { "amount": 1000000, "starting_at": "2024-10-01T00:00:00.000Z", "ending_before": "2025-10-01T00:00:00.000Z" } ] }, "invoice_schedule": { "credit_type_id": "2714e483-4ff1-48e4-9e25-ac732e8f24f2", "schedule_items": [ { "unit_price": 1000000, "quantity": 1, "timestamp": "2024-10-01T00:00:00.000Z" } ] } } ], "overrides": [ { "starting_at": "2024-10-01T00:00:00.000Z", "multiplier": 0.95, "type": "multiplier", "override_specifiers": [ { "product_tags": [ "audio" ] } ] }, { "starting_at": "2024-10-01T00:00:00.000Z", "is_commit_specific": true, "multiplier": 0.8, "type": "multiplier", "override_specifiers": [ { "commit_ids": [ "prepaid_commit_A" ], "product_tags": [ "audio" ] } ] } ] }' ``` -------------------------------- ### Create Rate Card and Add Price Source: https://docs.metronome.com/guides/get-started/developer-sdks Build a rate card and attach a price for a product. This example sets a flat rate of $0.50 for the 'Language Model 4 Tokens (millions)' product, starting from January 1, 2024. ```python response = client.v1.contracts.rate_cards.create( name="Language Model List Pricing", description="Prices for all language models.", ) rate_card_id = response.data.id response = client.v1.contracts.rate_cards.rates.add( rate_card_id=rate_card_id, product_id=product_id, entitled=True, rate_type="FLAT", price=50, starting_at="2024-01-01T00:00:00.000Z" ) ``` -------------------------------- ### Get a billable metric Source: https://docs.metronome.com/llms.txt Retrieves the complete configuration for a specific billable metric by its ID. Use this to review billable metric setup before associating it with products. Returns the metric's `name`, `event_type_filter`, `property_filters`, `aggregation_type`, `aggregation_key`, `group_keys`, `custom fields`, and more. ```APIDOC ## GET /billable-metrics/get-a-billable-metric ### Description Retrieves the complete configuration for a specific billable metric by its ID. Use this to review billable metric setup before associating it with products. Returns the metric's `name`, `event_type_filter`, `property_filters`, `aggregation_type`, `aggregation_key`, `group_keys`, `custom fields`, and more. ### Method GET ### Endpoint /billable-metrics/get-a-billable-metric ### Parameters #### Query Parameters - **metric_id** (string) - Required - The ID of the billable metric to retrieve. ``` -------------------------------- ### Create a Usage Product with Group Keys Source: https://docs.metronome.com/guides/get-started/api-quickstart Use this cURL command to create a usage-based product with specified pricing and presentation group keys. Ensure you replace placeholders like $METRONOME_API_TOKEN and with your actual values. ```bash curl -X POST https://api.metronome.com/v1/contract-pricing/products/create \ -H "Authorization: Bearer $METRONOME_API_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "name": "Input Tokens", "type": "usage", "billable_metric_id": "", "pricing_group_key": ["model"], "presentation_group_key": ["user_id"] }' ``` -------------------------------- ### Get rates Source: https://docs.metronome.com/llms.txt Understand the rate schedule at a given timestamp, optionally filtering the list of rates returned based on properties such as `product_id` and `pricing_group_values`. For example, you may want to display the current price for a given product in your product experience - use this endpoint to fetch t… ```APIDOC ## GET /rate-cards/{rate_card_id}/rates ### Description Understand the rate schedule at a given timestamp, optionally filtering the list of rates returned based on properties such as `product_id` and `pricing_group_values`. This endpoint is useful for displaying current prices for specific products. ### Method GET ### Endpoint /rate-cards/{rate_card_id}/rates ### Parameters #### Path Parameters - **rate_card_id** (string) - Required - The ID of the rate card. #### Query Parameters - **at** (timestamp) - Optional - The timestamp at which to retrieve the rates. Defaults to the current time. - **product_id** (string) - Optional - Filters rates by a specific product ID. - **pricing_group_values** (object) - Optional - Filters rates based on pricing group values. ``` -------------------------------- ### Create Subscription Product Source: https://docs.metronome.com/guides/pricing-packaging/billing-model-guides/hybrid-business-models Use this API call to create a subscription product. Ensure you have the necessary authentication token. ```bash curl https://api.metronome.com/v1/contract-pricing/products/create \ -H "Authorization: Bearer $TOKEN" \ -H "Content-Type: application/json" \ -d '{ "name": "Team Plan", "type": "SUBSCRIPTION" }' ```