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

# Introduction

> DealMachine API for real estate data and automation

# DealMachine API

**Access real estate data, manage properties, and automate workflows through the DealMachine API.** Authenticate via API key or the DealMachine CLI and start building integrations.

```bash theme={null}
curl https://api.v2.dealmachine.com/v1/account \
  -H "Authorization: Bearer dm_sk_live_xxx"
```

## Key Features

<CardGroup cols={2}>
  <Card title="API Key Authentication" icon="key" href="/authentication">
    Secure API key authentication with SHA-256 hashed storage. No test keys needed.
  </Card>

  <Card title="DealMachine CLI" icon="terminal" href="/cli/overview">
    Command-line interface for quick access. Login with a single command.
  </Card>

  <Card title="OAuth 2.0" icon="lock" href="/api-reference/oauth/authorize">
    Full OAuth 2.0 authorization code flow for third-party integrations.
  </Card>

  <Card title="App APIs" icon="table-columns" href="/driving/introduction">
    Build against Driving and Mail app workflows from the Apps tab.
  </Card>

  <Card title="Device Auth Flow" icon="mobile" href="/api-reference/auth/device-code">
    RFC 8628 device authorization for CLI and MCP server login.
  </Card>
</CardGroup>

## Quick Start

### Using the CLI (Recommended)

```bash theme={null}
# Install and login
npm install -g dealmachine
dm login

# Check your account
dm account
```

### Using an API Key

<CodeGroup>
  ```bash cURL theme={null}
  curl https://api.v2.dealmachine.com/v1/account \
    -H "Authorization: Bearer dm_sk_live_xxx"
  ```

  ```typescript Node.js theme={null}
  const response = await fetch('https://api.v2.dealmachine.com/v1/account', {
    headers: {
      Authorization: 'Bearer dm_sk_live_xxx',
    },
  });

  const { data } = await response.json();
  console.log(data.organization.name);
  ```

  ```python Python theme={null}
  import requests

  response = requests.get(
      'https://api.v2.dealmachine.com/v1/account',
      headers={'Authorization': 'Bearer dm_sk_live_xxx'}
  )

  data = response.json()['data']
  print(data['organization']['name'])
  ```
</CodeGroup>

## Base URL

```
https://api.v2.dealmachine.com/v1
```

## Authentication

Include your API key in the `Authorization` header:

```
Authorization: Bearer dm_sk_live_xxx
```

Get your API key from [Developer Settings](https://dm-next.dealmachine.com/settings/developer) or by running `dm login`.

<Note>
  API keys are scoped to your organization. Keep them secure and never expose them in client-side
  code.
</Note>

## Response Format

All responses are JSON. Successful responses wrap their payload in a `data` envelope:

```json theme={null}
{
  "data": {
    "organization": {
      "id": 1,
      "name": "My Company",
      "createdAt": "2024-01-01T00:00:00.000Z"
    },
    "user": {
      "id": null,
      "authType": "api_key"
    },
    "plan": {
      "name": "Basic",
      "enrichment_credit_cap": 10000,
      "is_paid": true,
      "billing_cycle_start": "2024-01-01T00:00:00.000Z",
      "billing_cycle_end": "2024-02-01T00:00:00.000Z"
    }
  }
}
```

Error responses include a request ID for debugging:

```json theme={null}
{
  "error": {
    "code": "invalid_api_key",
    "message": "Invalid API key",
    "request_id": "req_abc123def456"
  }
}
```

## Next Steps

<CardGroup cols={2}>
  <Card title="Authentication" icon="key" href="/authentication">
    Learn about API key formats and security best practices
  </Card>

  <Card title="Quick Start" icon="rocket" href="/quickstart">
    Get up and running in 5 minutes
  </Card>

  <Card title="CLI Documentation" icon="terminal" href="/cli/overview">
    Install and use the DealMachine CLI
  </Card>

  <Card title="Apps" icon="table-columns" href="/driving/introduction">
    Explore Driving and Mail endpoints
  </Card>

  <Card title="API Reference" icon="code" href="/api-reference">
    Browse all available endpoints
  </Card>
</CardGroup>
