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

# Python SDK

> Install and use the AmpUp Python SDK to manage accounts, deals, and meetings

The `ampup` Python package provides a typed client for the AmpUp Sales Meeting Analysis Platform. It wraps the full REST API with Pydantic models, so you get autocompletion and type checking out of the box.

## Installation

```bash theme={null}
pip install ampup
```

<Info>
  Requires Python 3.10 or higher.
</Info>

## Quick Start

```python theme={null}
from ampup.client import AmpUpClient

client = AmpUpClient(api_key="sk-a79-...")

# List your accounts
accounts = client.accounts.list_accounts()

# Get a specific meeting
meeting = client.meetings.get_meeting(
    GetMeetingRequest(meeting_id="meeting-uuid")
)
```

The client reads `AMPUP_API_KEY` and `AMPUP_BASE_URL` from environment variables if you don't pass them directly:

```bash theme={null}
export AMPUP_API_KEY=sk-a79-...
export AMPUP_BASE_URL=https://app.ampup.ai  # default
```

```python theme={null}
# No arguments needed when env vars are set
client = AmpUpClient()
```

## Configuration

```python theme={null}
client = AmpUpClient(
    api_key="sk-a79-...",              # or AMPUP_API_KEY env var
    base_url="https://app.ampup.ai",   # or AMPUP_BASE_URL env var
)
```

The client implements the context manager protocol for clean resource management:

```python theme={null}
with AmpUpClient() as client:
    org = client.org.get_org()
    print(org)
```

## API Groups

The client exposes 8 API groups as properties. Each group has methods that accept typed Pydantic request models and return typed responses.

### Organization

```python theme={null}
client.org.get_org()                 # Current org info
client.org.list_orgs()               # All accessible orgs
client.org.switch_org(               # Switch active org
    SwitchOrgRequest(org_name="Acme Corp")
)
```

### Accounts

```python theme={null}
from ampup.models import *

# List with search
client.accounts.list_accounts(
    ListAccountsRequest(search="Acme", limit=10)
)

# Create (optionally sync to CRM)
client.accounts.create_account(
    CreateAccountRequest(
        name="Acme Corp",
        industry="Technology",
        sync_to_crm=True,
    )
)

# Get details
client.accounts.get_account(
    GetAccountRequest(account_id="acc-uuid")
)

# Update
client.accounts.update_account(
    UpdateAccountRequest(account_id="acc-uuid", industry="SaaS")
)

# CRM actions
client.accounts.add_note_to_account(
    AddNoteToAccountRequest(account_id="acc-uuid", body="Spoke with VP of Sales")
)
client.accounts.add_task_to_account(
    AddTaskToAccountRequest(
        account_id="acc-uuid",
        subject="Send proposal",
        due_date="2025-01-15",
        priority="HIGH",
    )
)
client.accounts.sync_account_to_crm(
    SyncAccountToCrmRequest(account_id="acc-uuid")
)
```

### Opportunities (Deals)

```python theme={null}
# List deals
client.opportunities.list_opportunities(
    ListOpportunitiesRequest(search="Enterprise", stage="negotiation", limit=5)
)

# Create
client.opportunities.create_opportunity(
    CreateOpportunityRequest(
        name="Enterprise Deal",
        account_id="acc-uuid",
        amount=50000,
        close_date="2025-03-01",
        sync_to_crm=True,
    )
)

# Advance stage
client.opportunities.change_opportunity_stage(
    ChangeOpportunityStageRequest(
        opportunity_id="opp-uuid", stage="proposal"
    )
)

# Analysis across all meetings in a deal
client.opportunities.get_opportunity_analysis(
    GetOpportunityAnalysisRequest(opportunity_id="opp-uuid")
)

# CRM notes and tasks
client.opportunities.add_note_to_opportunity(
    AddNoteToOpportunityRequest(
        opportunity_id="opp-uuid", body="Ready to sign"
    )
)
client.opportunities.add_task_to_opportunity(
    AddTaskToOpportunityRequest(
        opportunity_id="opp-uuid",
        subject="Draft contract",
        due_date="2025-02-01",
    )
)
```

### Meetings

```python theme={null}
# Search meetings
client.meetings.list_meetings(
    ListMeetingsRequest(search="quarterly review", status="analyzed", limit=10)
)

# Get meeting details
client.meetings.get_meeting(
    GetMeetingRequest(meeting_id="mtg-uuid")
)

# Transcript
client.meetings.get_meeting_transcript(
    GetMeetingTranscriptRequest(meeting_id="mtg-uuid")
)

# Transcript excerpt (by time range or chapter)
client.meetings.get_transcript_excerpt(
    GetTranscriptExcerptRequest(
        meeting_id="mtg-uuid", start_time="00:05:00", end_time="00:10:00"
    )
)

# Briefs
client.meetings.get_pre_meeting_brief(
    GetPreMeetingBriefRequest(meeting_id="mtg-uuid")
)
client.meetings.get_post_meeting_brief(
    GetPostMeetingBriefRequest(meeting_id="mtg-uuid")
)

# Trigger analysis
client.meetings.run_analysis(
    RunAnalysisRequest(meeting_id="mtg-uuid", force=False)
)

# Bulk analysis results
client.meetings.list_meeting_analyses(
    ListMeetingAnalysesRequest(
        meeting_ids=["mtg-1", "mtg-2"],
        include_deal_intelligence=True,
        include_feedback=True,
    )
)
```

### Files

```python theme={null}
# Upload a recording (base64-encoded)
import base64

with open("call.mp4", "rb") as f:
    content = base64.b64encode(f.read()).decode()

client.files.upload_file(
    UploadFileRequest(
        file_name="call.mp4",
        file_content_base64=content,
        account_name="Acme Corp",
        opportunity_name="Enterprise Deal",
    )
)

# Check processing status
client.files.check_status(
    CheckStatusRequest(entity_id="mtg-uuid", entity_type="meeting")
)

# Deal file management
client.files.list_deal_files(
    ListDealFilesRequest(opportunity_id="opp-uuid")
)
```

### Metrics

```python theme={null}
# List metric groups and individual metrics
client.metrics.list_metric_groups()
client.metrics.list_metrics()

# Create a metric group
client.metrics.create_metric_group(
    CreateMetricGroupRequest(
        group_id="discovery",
        label="Discovery Quality",
        description="How well reps uncover needs",
    )
)

# Create a metric
client.metrics.create_metric(
    CreateMetricRequest(
        category_id="discovery",
        metric_name="Open-ended Questions",
        checklist=["Asked 3+ open-ended questions", "Explored pain points"],
        min_score=0,
        max_score=10,
    )
)
```

### Practice Scripts

```python theme={null}
# List scripts
client.practice_scripts.list_practice_scripts(
    ListPracticeScriptsRequest(search="cold call")
)

# Get a script
client.practice_scripts.get_practice_script(
    GetPracticeScriptRequest(script_id="script-uuid")
)

# Auto-generate from a meeting
client.practice_scripts.generate_practice_script(
    GeneratePracticeScriptRequest(
        meeting_id="mtg-uuid",
        custom_instructions="Focus on objection handling",
    )
)

# Create manually
client.practice_scripts.create_practice_script(
    CreatePracticeScriptRequest(
        name="Enterprise Discovery Call",
        scenario="You are meeting with a VP of Engineering...",
        session_script="Probe for pain points around...",
        tags=["discovery", "enterprise"],
        draft=True,
    )
)
```

### Configuration

```python theme={null}
# Get current analysis config
client.config.get_analysis_config()

# Update analysis config
client.config.update_analysis_config(
    UpdateAnalysisConfigRequest(config={...})
)
```

## Error Handling

The SDK raises standard HTTP exceptions for API errors. The response body includes error details:

```python theme={null}
from ampup.exceptions import ApiException

try:
    client.accounts.get_account(
        GetAccountRequest(account_id="nonexistent")
    )
except ApiException as e:
    print(f"Status {e.status}: {e.body}")
```

## Support

* **Email:** [support@ampup.ai](mailto:support@ampup.ai)
* **Contact:** [ampup.ai/contact](https://www.ampup.ai/contact)
