### Create Wallet using Python Source: https://getlago.com/docs/api-reference/wallets/create This Python example demonstrates how to create a wallet using the Lago API. Ensure you have the `lago` library installed and your API key configured. ```python from lago import Client client = Client(access_token="YOUR_API_KEY") client.wallets.create( name="Prepaid", rate_amount="1.5", paid_credits="20.0", granted_credits="10.0", currency="USD", expiration_at="2022-07-07", external_customer_id="hooli_1234" ) ``` -------------------------------- ### Example POST Request to Create a Plan with Charges Source: https://getlago.com/docs/guide/plans/charges/prorated-vs-full This example demonstrates how to create a plan with specific charges using a POST request. It includes details like plan name, code, interval, amount, and charge configuration. ```bash curl -X POST \ http://localhost:3000/api/v1/plans \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer $API_KEY' \ --data-raw '{ "plan":{ "name": "Startup", "code": "startup", "interval": "monthly", "description": "This is a basic plan description", "amount_cents": 10000, "amount_currency": "USD", "trial_period": 3.0, "pay_in_advance": true, "bill_charges_monthly": false, "charges": [ { "billable_metric_id": ``` -------------------------------- ### Install Go Client Source: https://getlago.com/docs/api-reference/intro Install the Getlago Go client library using the go get command. This command fetches and installs the specified package. ```shellscript go get github.com/getlago/lago-go-client@v1 ``` -------------------------------- ### Create a Plan with Filters Source: https://getlago.com/docs/guide/plans/charges/charges-with-filters This example demonstrates how to set up a plan with filters, including defining a price for a specific combination of filters and an optional invoice display name. ```javascript children: [ _jsx(_components.li, { children: "Set a price for this combination of filters; and" }), "\n", _jsx(_components.li, { children: "Optionally, provide an Invoice display name." }), "\n" ] ``` -------------------------------- ### Install Provider SDKs Source: https://getlago.com/docs/guide/ai-agents/agent-sdk Install the necessary SDKs for your chosen LLM provider(s). Examples include AWS Bedrock Runtime and Mistral AI. ```bash npm install @aws-sdk/client-bedrock-runtime ``` ```bash npm install @mistralai/mistralai ``` -------------------------------- ### Run Lago with One-Click Docker Command Source: https://getlago.com/docs/llms-full.txt Starts the Lago application using a single Docker command. This is the quickest way to get started. ```shell docker run -d --name lago -p 80:80 -p 3000:3000 getlago/lago:latest ``` -------------------------------- ### Creating a Plan Source: https://getlago.com/docs/api-reference/intro This example demonstrates how to create a new pricing plan. Specify the plan's code, name, and billing model. ```javascript async function createPlan() { try { const plan = await client.plans.create({ code: "basic_monthly", name: "Basic Monthly", billingModel: "pay_in_advance", prices: [ { id: "basic_monthly_eur", currency: "EUR", amount_cents: 1000, }, ], }); console.log(plan); } catch (error) { console.error(error); } } ``` -------------------------------- ### Go SDK Installation and Usage Source: https://getlago.com/docs/api-reference/intro This snippet shows how to install the Lago Go client and provides a basic example of initializing the client and setting your API key for authentication. ```APIDOC ## Go SDK Installation and Usage ### Description This snippet shows how to install the Lago Go client and provides a basic example of initializing the client and setting your API key for authentication. ### Method N/A (SDK Usage) ### Endpoint N/A (SDK Usage) ### Parameters N/A (SDK Usage) ### Request Example ```go import "github.com/getlago/lago-go-client" func main() { // By default, this will connect to Lago's hosted servers in the US region. lagoClient := lago.New().SetApiKey("__YOUR_API_KEY__") } ``` ### Response N/A (SDK Usage) ``` -------------------------------- ### Create Wallet Example (Go) Source: https://getlago.com/docs/api-reference/wallets/create This snippet demonstrates how to initialize the Lago client and create a new wallet with specified parameters. Ensure you replace '__YOUR_API_KEY__' with your actual API key. The expiration date and time are set using the Go time package. ```Go New().SetApiKey("__YOUR_API_KEY__") expirationAt := time.Date(2022, 7, 7, 23, 59, 0, time.UTC) walletInput := &lago.WalletInput{ Name: "Prepaid", RateAmount: "1.5", PaidCredits: "20.0", GrantedCredits: "10.0" } ``` -------------------------------- ### Create Wallet Go Example Source: https://getlago.com/docs/api-reference/wallets/create This Go code snippet demonstrates how to create a wallet using the Lago client. It includes error handling and prints the created wallet details. Ensure you have initialized the Lago client before use. ```Go walletInput := &lago.WalletInput{ Currency: "USD", ExpirationAt: &expirationAt, ExternalCustomerID: "hooli_1234", } wallet, err := lagoClient.Wallet().Create(walletInput) if err != nil { // Error is *lago.Error panic(err) } // wallet is *lago.Wallet mt.Println(wallet) ``` -------------------------------- ### Get All Customers (Javascript) Source: https://getlago.com/docs/api-reference/customers/get-all This Javascript example uses the `fetch` API to get a list of customers from Lago. It demonstrates setting the Authorization header and query parameters for pagination. ```javascript const LAGO_URL = "https://api.getlago.com"; const API_KEY = "__YOUR_API_KEY__"; async function getAllCustomers() { const response = await fetch(`${LAGO_URL}/api/v1/customers?per_page=2&page=1`, { method: 'GET', headers: { 'Authorization': `Bearer ${API_KEY}` } }); const data = await response.json(); console.log(data); } getAllCustomers(); ``` -------------------------------- ### Create Plan Source: https://getlago.com/docs/api-reference/plans/create This example demonstrates how to create a new plan with various configurations, including charges, fixed charges, and usage thresholds. ```APIDOC ## POST /plans ### Description Creates a new plan. ### Method POST ### Endpoint /plans ### Request Body - **name** (string) - Required - The name of the plan. - **code** (string) - Required - A unique code for the plan. - **description** (string) - Optional - A description of the plan. - **amount_cents** (integer) - Required - The base amount of the plan in cents. - **amount_currency** (string) - Required - The currency of the plan amount. - **pay_in_advance** (boolean) - Optional - Whether to bill in advance. - **trial_period** (integer) - Optional - The duration of the trial period in days. - **bill_charges_monthly** (boolean) - Optional - Whether to bill charges monthly. - **bill_fixed_charges_monthly** (boolean) - Optional - Whether to bill fixed charges monthly. - **tax_codes** (array of strings) - Optional - Tax codes applicable to the plan. - **minimum_commitment** (object) - Optional - Defines a minimum commitment for the plan. - **amount_cents** (integer) - Required - The minimum amount in cents. - **invoice_display_name** (string) - Required - Display name for the minimum commitment. - **tax_codes** (array of strings) - Optional - Tax codes for the minimum commitment. - **charges** (array of objects) - Optional - Defines usage-based charges for the plan. - **billable_metric_id** (string) - Required - The ID of the billable metric. - **charge_model** (string) - Required - The charge model (e.g., `standard`, `package`, `graduated`, `volume`, `percentage`). - **invoiceable** (boolean) - Required - Whether the charge is invoiceable. - **invoice_display_name** (string) - Required - Display name for the charge. - **pay_in_advance** (boolean) - Optional - Whether to pay in advance. - **regroup_paid_fees** (string) - Optional - How to regroup paid fees. - **prorated** (boolean) - Optional - Whether the charge is prorated. - **min_amount_cents** (integer) - Optional - Minimum amount in cents for the charge. - **properties** (object) - Charge-specific properties based on `charge_model`. - For `package`: `amount` (string), `free_units` (integer), `package_size` (integer) - For `graduated`: `graduated_ranges` (array of objects) - `to_value` (integer), `from_value` (integer), `flat_amount` (string), `per_unit_amount` (string) - For `standard`: (no specific properties) - For `volume`: `volume_ranges` (array of objects) - `from_value` (integer), `to_value` (integer), `flat_amount` (string), `per_unit_amount` (string) - For `percentage`: `rate` (string), `fixed_amount` (string), `free_units_per_events` (integer), `free_units_per_total_aggregation` (integer) - **tax_codes** (array of strings) - Optional - Tax codes for the charge. - **fixed_charges** (array of objects) - Optional - Defines fixed charges for the plan. - **add_on_id** (string) - Required - The ID of the add-on. - **code** (string) - Optional - A unique code for the fixed charge. - **invoice_display_name** (string) - Required - Display name for the fixed charge. - **charge_model** (string) - Required - The charge model (e.g., `standard`, `graduated`, `volume`). - **pay_in_advance** (boolean) - Optional - Whether to pay in advance. - **prorated** (boolean) - Optional - Whether the charge is prorated. - **properties** (object) - Charge-specific properties. - For `standard`: `amount` (string), `units` (integer) - For `graduated`: `graduated_ranges` (array of objects) - `from_value` (integer), `to_value` (integer), `per_unit_amount` (string), `flat_amount` (string) - For `volume`: `volume_ranges` (array of objects) - `from_value` (integer), `to_value` (integer), `per_unit_amount` (string), `flat_amount` (string) - **units** (integer) - Optional - Number of units for the charge. - **tax_codes** (array of strings) - Optional - Tax codes for the fixed charge. - **usage_thresholds** (array of objects) - Optional - Defines usage thresholds for the plan. - **amount_cents** (integer) - Required - The amount in cents for the threshold. - **threshold_display_name** (string) - Required - Display name for the threshold. - **recurring** (boolean) - Optional - Whether the threshold is recurring. - **metadata** (object) - Optional - Custom metadata for the plan. - **external_id** (string) - Optional - External ID for the metadata. - **synced_at** (string) - Optional - Timestamp of when the metadata was synced. ### Request Example ```json { "plan": { "name": "Startup", "code": "startup", "interval": "monthly", "amount_cents": 10000, "amount_currency": "USD", "pay_in_advance": true, "invoice_display_name": "Startup plan", "description": "Plan for early stage startups.", "trial_period": 5, "bill_charges_monthly": null, "bill_fixed_charges_monthly": null, "tax_codes": ["french_standard_vat"], "minimum_commitment": { "amount_cents": 100000, "invoice_display_name": "Minimum Commitment (C1)", "tax_codes": ["french_standard_vat"] }, "charges": [ { "billable_metric_id": "1a901a90-1a90-1a90-1a90-1a901a901a91", "charge_model": "package", "invoiceable": true, "invoice_display_name": "Setup", "pay_in_advance": false, "regroup_paid_fees": null, "prorated": false, "min_amount_cents": 3000, "properties": { "amount": "30", "free_units": 100, "package_size": 1000 }, "tax_codes": ["french_standard_vat"] }, { "billable_metric_id": "1a901a90-1a90-1a90-1a90-1a901a901a92", "charge_model": "graduated", "invoiceable": true, "invoice_display_name": "Setup", "pay_in_advance": false, "prorated": false, "min_amount_cents": 0, "properties": { "graduated_ranges": [ { "to_value": 10, "from_value": 0, "flat_amount": "10", "per_unit_amount": "0.5" }, { "to_value": null, "from_value": 11, "flat_amount": "0", "per_unit_amount": "0.4" } ] } }, { "billable_metric_id": "1a901a90-1a90-1a90-1a90-1a901a901a93", "charge_model": "standard", "invoiceable": true, "invoice_display_name": "Setup", "pay_in_advance": true, "prorated": false, "min_amount_cents": 0, "properties": {} }, { "billable_metric_id": "1a901a90-1a90-1a90-1a90-1a901a901a94", "charge_model": "volume", "invoiceable": true, "invoice_display_name": "Setup", "pay_in_advance": false, "prorated": false, "min_amount_cents": 0, "properties": { "volume_ranges": [ { "from_value": 0, "to_value": 100, "flat_amount": "0", "per_unit_amount": "0" }, { "from_value": 101, "to_value": null, "flat_amount": "0", "per_unit_amount": "0.5" } ] } }, { "billable_metric_id": "1a901a90-1a90-1a90-1a90-1a901a901a95", "charge_model": "percentage", "invoiceable": false, "invoice_display_name": "Setup", "pay_in_advance": true, "regroup_paid_fees": "invoice", "prorated": false, "min_amount_cents": 0, "properties": { "rate": "1", "fixed_amount": "0.5", "free_units_per_events": 5, "free_units_per_total_aggregation": "500" } } ], "fixed_charges": [ { "add_on_id": "1a901a90-1a90-1a90-1a90-1a901a901a90", "code": "setup_fee", "invoice_display_name": "Setup Fee", "charge_model": "standard", "pay_in_advance": true, "prorated": false, "properties": { "amount": "500" }, "units": 1, "tax_codes": ["french_standard_vat"] }, { "add_on_id": "4d604d60-4d60-4d60-4d60-4d604d604d60", "invoice_display_name": "Support Tier", "charge_model": "graduated", "pay_in_advance": false, "prorated": true, "properties": { "graduated_ranges": [ { "from_value": 0, "to_value": 10, "per_unit_amount": "5", "flat_amount": "200" }, { "from_value": 11, "to_value": null, "per_unit_amount": "1", "flat_amount": "300" } ] }, "units": 2 }, { "add_on_id": "6f406f40-6f40-6f40-6f40-6f406f406f40", "charge_model": "volume", "properties": { "volume_ranges": [ { "from_value": 0, "to_value": 100, "per_unit_amount": "2", "flat_amount": "1" }, { "from_value": 101, "to_value": null, "per_unit_amount": "1", "flat_amount": "0" } ] }, "units": 50 } ], "usage_thresholds": [ { "amount_cents": 10000, "threshold_display_name": "Threshold 1", "recurring": true } ], "metadata": { "external_id": "ext-123", "synced_at": "2024-01-15" } } } ``` ### Response #### Success Response (200) - **plan** (object) - The created plan object. - **name** (string) - The name of the plan. - **code** (string) - A unique code for the plan. - **description** (string) - A description of the plan. - **amount_cents** (integer) - The base amount of the plan in cents. - **amount_currency** (string) - The currency of the plan amount. - **pay_in_advance** (boolean) - Whether to bill in advance. - **trial_period** (integer) - The duration of the trial period in days. - **bill_charges_monthly** (boolean) - Whether to bill charges monthly. - **bill_fixed_charges_monthly** (boolean) - Whether to bill fixed charges monthly. - **tax_codes** (array of strings) - Tax codes applicable to the plan. - **minimum_commitment** (object) - Defines a minimum commitment for the plan. - **amount_cents** (integer) - The minimum amount in cents. - **invoice_display_name** (string) - Display name for the minimum commitment. - **tax_codes** (array of strings) - Tax codes for the minimum commitment. - **charges** (array of objects) - Defines usage-based charges for the plan. - **billable_metric_id** (string) - The ID of the billable metric. - **charge_model** (string) - The charge model. - **invoiceable** (boolean) - Whether the charge is invoiceable. - **invoice_display_name** (string) - Display name for the charge. - **pay_in_advance** (boolean) - Whether to pay in advance. - **regroup_paid_fees** (string) - How to regroup paid fees. - **prorated** (boolean) - Whether the charge is prorated. - **min_amount_cents** (integer) - Minimum amount in cents for the charge. - **properties** (object) - Charge-specific properties. - **tax_codes** (array of strings) - Tax codes for the charge. - **fixed_charges** (array of objects) - Defines fixed charges for the plan. - **add_on_id** (string) - The ID of the add-on. - **code** (string) - A unique code for the fixed charge. - **invoice_display_name** (string) - Display name for the fixed charge. - **charge_model** (string) - The charge model. - **pay_in_advance** (boolean) - Whether to pay in advance. - **prorated** (boolean) - Whether the charge is prorated. - **properties** (object) - Charge-specific properties. - **units** (integer) - Number of units for the charge. - **tax_codes** (array of strings) - Tax codes for the fixed charge. - **usage_thresholds** (array of objects) - Defines usage thresholds for the plan. - **amount_cents** (integer) - The amount in cents for the threshold. - **threshold_display_name** (string) - Display name for the threshold. - **recurring** (boolean) - Whether the threshold is recurring. - **metadata** (object) - Custom metadata for the plan. - **external_id** (string) - External ID for the metadata. - **synced_at** (string) - Timestamp of when the metadata was synced. #### Response Example ```json { "plan": { "name": "Startup", "code": "startup", "interval": "monthly", "amount_cents": 10000, "amount_currency": "USD", "pay_in_advance": true, "invoice_display_name": "Startup plan", "description": "Plan for early stage startups.", "trial_period": 5, "bill_charges_monthly": null, "bill_fixed_charges_monthly": null, "tax_codes": ["french_standard_vat"], "minimum_commitment": { "amount_cents": 100000, "invoice_display_name": "Minimum Commitment (C1)", "tax_codes": ["french_standard_vat"] }, "charges": [ { "billable_metric_id": "1a901a90-1a90-1a90-1a90-1a901a901a91", "charge_model": "package", "invoiceable": true, "invoice_display_name": "Setup", "pay_in_advance": false, "regroup_paid_fees": null, "prorated": false, "min_amount_cents": 3000, "properties": { "amount": "30", "free_units": 100, "package_size": 1000 }, "tax_codes": ["french_standard_vat"] }, { "billable_metric_id": "1a901a90-1a90-1a90-1a90-1a901a901a92", "charge_model": "graduated", "invoiceable": true, "invoice_display_name": "Setup", "pay_in_advance": false, "prorated": false, "min_amount_cents": 0, "properties": { "graduated_ranges": [ { "to_value": 10, "from_value": 0, "flat_amount": "10", "per_unit_amount": "0.5" }, { "to_value": null, "from_value": 11, "flat_amount": "0", "per_unit_amount": "0.4" } ] } }, { "billable_metric_id": "1a901a90-1a90-1a90-1a90-1a901a901a93", "charge_model": "standard", "invoiceable": true, "invoice_display_name": "Setup", "pay_in_advance": true, "prorated": false, "min_amount_cents": 0, "properties": {} }, { "billable_metric_id": "1a901a90-1a90-1a90-1a90-1a901a901a94", "charge_model": "volume", "invoiceable": true, "invoice_display_name": "Setup", "pay_in_advance": false, "prorated": false, "min_amount_cents": 0, "properties": { "volume_ranges": [ { "from_value": 0, "to_value": 100, "flat_amount": "0", "per_unit_amount": "0" }, { "from_value": 101, "to_value": null, "flat_amount": "0", "per_unit_amount": "0.5" } ] } }, { "billable_metric_id": "1a901a90-1a90-1a90-1a90-1a901a901a95", "charge_model": "percentage", "invoiceable": false, "invoice_display_name": "Setup", "pay_in_advance": true, "regroup_paid_fees": "invoice", "prorated": false, "min_amount_cents": 0, "properties": { "rate": "1", "fixed_amount": "0.5", "free_units_per_events": 5, "free_units_per_total_aggregation": "500" } } ], "fixed_charges": [ { "add_on_id": "1a901a90-1a90-1a90-1a90-1a901a901a90", "code": "setup_fee", "invoice_display_name": "Setup Fee", "charge_model": "standard", "pay_in_advance": true, "prorated": false, "properties": { "amount": "500" }, "units": 1, "tax_codes": ["french_standard_vat"] }, { "add_on_id": "4d604d60-4d60-4d60-4d60-4d604d604d60", "invoice_display_name": "Support Tier", "charge_model": "graduated", "pay_in_advance": false, "prorated": true, "properties": { "graduated_ranges": [ { "from_value": 0, "to_value": 10, "per_unit_amount": "5", "flat_amount": "200" }, { "from_value": 11, "to_value": null, "per_unit_amount": "1", "flat_amount": "300" } ] }, "units": 2 }, { "add_on_id": "6f406f40-6f40-6f40-6f40-6f406f406f40", "charge_model": "volume", "properties": { "volume_ranges": [ { "from_value": 0, "to_value": 100, "per_unit_amount": "2", "flat_amount": "1" }, { "from_value": 101, "to_value": null, "per_unit_amount": "1", "flat_amount": "0" } ] }, "units": 50 } ], "usage_thresholds": [ { "amount_cents": 10000, "threshold_display_name": "Threshold 1", "recurring": true } ], "metadata": { "external_id": "ext-123", "synced_at": "2024-01-15" } } } ``` ``` -------------------------------- ### JavaScript Client Installation and Usage Source: https://getlago.com/docs/llms-full.txt Guide to installing the Lago JavaScript client via npm and initializing it. Custom base URLs can be provided for non-US regions or self-hosted instances. ```bash npm install lago-javascript-client ``` ```javascript import { Client } from 'lago-javascript-client' // By default, this will connect to Lago's hosted servers in the US region. const client = Client('__YOUR_API_KEY__') // If you are self-hosting Lago or using a different region (e.g., EU), // you need to specify the base URL to connect to the correct Lago instance. // Replace '__YOUR_LAGO_URL__' with the appropriate URL for your Lago instance. // Example: 'https://api.eu.getlago.com/' for the EU region. // const client = Client('__YOUR_API_KEY__', { baseUrl: '__YOUR_LAGO_URL__'}) ``` -------------------------------- ### Python Client Installation and Usage Source: https://getlago.com/docs/api-reference/intro This snippet shows how to install the Lago Python client library using pip and provides a basic example of how to initialize the client and make authenticated requests. ```APIDOC ## Python Client ### Description Install the Lago Python client library and use it to interact with the Lago API. ### Installation ```shell pip install lago-python-client ``` ### Usage ```python from lago_python_client import Client # By default, this connects to Lago's hosted servers in the US region. client = Client("__YOUR_API_KEY") # If you are self-hosting Lago or using a different server region, you can specify the base URL: # client = Client(api_key="__YOUR_API_KEY", base_url="http://localhost:4000") ``` ``` -------------------------------- ### Create a Plan with Add-ons and Taxes Source: https://getlago.com/docs/guide/plans/overview Example of creating a plan that includes add-ons and taxes. This shows how to associate multiple resources with a single plan. ```json { "plan": { "name": "Premium Plan", "code": "premium_plan", "description": "A premium plan with extra features.", "amount_cents": 5000, "currency": "USD", "interval": "monthly", "is_active": true, "charges": [ { "name": "Premium Fee", "code": "premium_fee", "amount_cents": 5000, "charge_model": "fixed_amount", "interval": "monthly" } ], "taxes": [ { "name": "VAT", "code": "vat_20", "rate": 20, "description": "Standard VAT rate", "applied_to_organization": true, "created_at": "2026-01-01T00:00:00Z" } ], "add_ons": [ { "lago_id": "4d604d60-4d60-4d60-4d60-4d604d604d60", "lago_add_on_id": "5e505e50-5e50-5e50-5e50-5e505e505e50", "code": "support_tier", "invoice_display_name": "Support Tier", "add_on_code": "premium_support", "created_at": "2026-01-15T10:30:00Z", "charge_model": "graduated", "pay_in_advance": false, "prorated": true } ] } } ``` -------------------------------- ### Advanced Docker Setup for Lago Source: https://getlago.com/docs/llms-full.txt Clones the Lago repository, checks out the latest tag, sets up environment variables, and starts the application using Docker Compose. This method provides more control over the setup. ```shell # Get the code git clone https://github.com/getlago/lago.git # Go to Lago folder cd lago # Fetch all tags git fetch --tags # Get the latest tag and checkout git checkout $(git describe --tags --abbrev=0) # Set up environment configuration echo "LAGO_RSA_PRIVATE_KEY=\`openssl genrsa 2048 | base64 | tr -d '\n'\`" >> .env source .env # Start all the components docker compose up ``` -------------------------------- ### Create a Plan Source: https://getlago.com/docs/guide/plans/overview Example of creating a new plan with specific features and limits. ```json { "code": "max_admins", "name": "Max Admins", "value_type": "integer", "config": {}, "value": 5 } { "code": "root", "name": "Allow root user", "value_type": "boolean", "config": {}, "value": true } ``` -------------------------------- ### Create Wallet (Go) Source: https://getlago.com/docs/api-reference/wallets/create Use this Go snippet to create a wallet for a customer. This example includes necessary imports and client initialization. ```go import ( "fmt" "github.com/getlago/lago-go-client" ) func main() { lagoClient } ``` -------------------------------- ### Update Customer - Node.js Source: https://getlago.com/docs/api-reference/customers/update This Node.js example shows how to update a customer via the Lago API using 'axios'. It sends a PUT request with the updated customer data. Ensure you have 'axios' installed (`npm install axios`). ```javascript const axios = require('axios'); const apiKey = 'YOUR_API_KEY'; const customerId = 'cus_12345678'; const url = `https://api.getlago.com/api/v1/customers/${customerId}`; const headers = { 'Content-Type': 'application/json', 'Authorization': `Bearer ${apiKey}` }; const payload = { customer: { billing_entity_code: 'acme_corp', currency: 'EUR', tax_identification: 'FR123456789' } }; axios.put(url, payload, { headers: headers }) .then(response => { console.log('Status Code:', response.status); console.log('Response Body:', response.data); }) .catch(error => { console.error('Error:', error.response.status, error.response.data); }); ```