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

# Authentication

> How to authenticate with the DealMachine API

# Authentication

The DealMachine Property Enrichment API uses API keys for authentication. All requests must include your API key in the `X-API-Key` header.

## Getting Your API Key

API keys are managed through your DealMachine dashboard. Only organization administrators can create and manage API keys.

<Steps>
  <Step title="Navigate to API Settings">
    Log in to your DealMachine account and go to **Settings > API Keys**
  </Step>

  <Step title="Create a New Key">
    Click **Create API Key** and provide a descriptive name (e.g., "Salesforce Integration")
  </Step>

  <Step title="Copy Your Key">
    Your API key will be displayed once. Copy it and store it securely - it cannot be retrieved later.
  </Step>
</Steps>

<Warning>
  **Keep your API key secret!** Never expose your API key in client-side code, public repositories, or share it with unauthorized parties.
</Warning>

## Using Your API Key

Include your API key in the `X-API-Key` header with every request:

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://dealmachine.com/api/property/lookup \
    -H "Content-Type: application/json" \
    -H "X-API-Key: dm_live_your_api_key_here" \
    -d '{"street": "123 Main St", "city": "Austin", "state": "TX", "zip": "78701"}'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch('https://dealmachine.com/api/property/lookup', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'X-API-Key': 'dm_live_your_api_key_here'
    },
    body: JSON.stringify({
      street: '123 Main St',
      city: 'Austin',
      state: 'TX',
      zip: '78701'
    })
  });
  ```

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

  response = requests.post(
      'https://dealmachine.com/api/property/lookup',
      headers={
          'Content-Type': 'application/json',
          'X-API-Key': 'dm_live_your_api_key_here'
      },
      json={
          'street': '123 Main St',
          'city': 'Austin',
          'state': 'TX',
          'zip': '78701'
      }
  )
  ```
</CodeGroup>

## API Key Format

DealMachine API keys follow the format:

```
dm_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
```

* Prefix: `dm_live_` (12 characters)
* Random suffix: 32 hexadecimal characters

## Key Management

### One Active Key Per Organization

Your organization can have only one active API key at a time. Creating a new key will automatically revoke any existing active keys.

### Regenerating Keys

If you suspect your API key has been compromised, regenerate it immediately through the dashboard. The old key will be revoked instantly.

### Revoking Keys

You can revoke an API key at any time through the dashboard. Revoked keys cannot be reactivated.

## Error Responses

| Status Code | Error                 | Description                           |
| ----------- | --------------------- | ------------------------------------- |
| `401`       | Unauthorized          | Missing or invalid `X-API-Key` header |
| `401`       | Unauthorized          | API key has been revoked              |
| `403`       | Subscription Required | No active subscription found          |
| `403`       | Subscription Required | Subscription is not active            |
| `429`       | Too Many Requests     | Monthly request limit exceeded        |

<Note>
  When you receive a `429` response, check the `X-RateLimit-Reset` header for the date your limit resets.
</Note>
