> ## Documentation Index
> Fetch the complete documentation index at: https://docs.smooth.sh/llms.txt
> Use this file to discover all available pages before exploring further.

# Invoice retrieval

> Learn how to retrieve invoice information with Smooth

## Overview

This guide demonstrates how to use Smooth to retrieve invoice information from subscription services like Calendly. You'll learn to authenticate manually once via a live URL, then have Smooth navigate to billing sections to extract payment data automatically.

<Steps>
  <Step title="Launch Session and Authenticate">
    Create a profile and session for Calendly. The profile will persist your authentication cookies.

    ```python Python theme={null}
    from smooth import SmoothClient

    client = SmoothClient()

    # Create the profile first (only needed once)
    client.create_profile(profile_id="calendly-billing")

    with client.session(profile_id="calendly-billing", url="https://calendly.com") as session:
        # Get the live URL for manual authentication
        print(f"Please log in at: {session.live_url()}")

        # Wait for user to authenticate
        input("Press Enter after you've logged in to Calendly...")

        # Now extract invoice data
        result = session.run_task(
            task="Go to the billing page and find my most recent invoice"
        )

        invoice = session.extract(
            schema={
                "type": "object",
                "properties": {
                    "invoice_date": {"type": "string", "description": "Invoice date"},
                    "amount_paid": {"type": "number", "description": "Amount paid"},
                    "currency": {"type": "string", "description": "Currency code"},
                    "invoice_number": {"type": "string", "description": "Invoice number"}
                }
            },
            prompt="Extract the most recent invoice details from this page"
        )

        print(f"Invoice: {invoice.output}")
    ```

    Open the `live_url` in your browser and log in to Calendly. Once authenticated, press Enter to continue.
  </Step>

  <Step title="Reuse the Profile">
    In future runs, use the same profile ID to skip manual authentication and retrieve invoices directly.

    ```python Python theme={null}
    with client.session(profile_id="calendly-billing", url="https://calendly.com") as session:
        session.run_task(
            task="Navigate to the billing page"
        )

        invoices = session.extract(
            schema={
                "type": "array",
                "items": {
                    "type": "object",
                    "properties": {
                        "invoice_date": {"type": "string", "description": "Invoice date"},
                        "amount_paid": {"type": "number", "description": "Amount paid"},
                        "currency": {"type": "string", "description": "Currency code"},
                        "invoice_number": {"type": "string", "description": "Invoice number"}
                    }
                }
            },
            prompt="Extract all invoices from the billing page"
        )

        for inv in invoices.output:
            print(f"{inv['invoice_date']}: {inv['currency']} {inv['amount_paid']}")
    ```
  </Step>
</Steps>

## Use Cases

* **Expense Tracking**: Automatically extract billing information for accounting
* **Budget Monitoring**: Track recurring payments across multiple services
* **Invoice Automation**: Integrate payment data with expense management systems
* **Audit Compliance**: Maintain accurate records of business subscriptions

<Note>
  This approach works with any web service that has a billing dashboard. The key is authenticating manually first, then letting the agent navigate to extract the specific invoice data you need.
</Note>

## Community

<Card title="Join Discord" icon="discord" href="https://discord.gg/VcdgMwUmMG">
  Join our community for support and showcases
</Card>
