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

# Upload to Deal

Associate documents with specific deals for win-loss analysis. Audio and video files are automatically transcribed.

<Accordion title="Copy for AI context">
  ```text theme={null}
  POST https://app.usehindsight.com/api/v1/deals/documents
  Authorization: Bearer YOUR_API_KEY
  Content-Type: multipart/form-data

  Request fields (multipart/form-data):
    file_name: string (required)
    file_url: string (uri) — URL to fetch file from
    file: binary — binary file content (alternative to file_url)
    content_type: string (required) — MIME type, e.g. application/pdf, audio/mpeg, video/mp4
    deal_id: string — Hindsight deal ID
    salesforce_id: string — Salesforce Opportunity ID
    hubspot_id: string — HubSpot Deal ID
    source: gong | clari | fathom | fireflies | avoma | outreach | gmail | Salesforce | Hubspot | api
  Provide exactly one of: deal_id, salesforce_id, or hubspot_id.

  200 Response:
  {
    "document": {
      "id": "doc_abc123",
      "file_name": "Discovery Call Recording.mp3",
      "status": "processing | ready | failed",
      "type": "asset | intel",
      "url": "https://app.usehindsight.com/deals/deal_123/documents/viewer/doc_abc123",
      "created_at": "2026-02-10T12:00:00Z"
    },
    "run_id": "run_xyz789"
  }

  Rate limits: 10 req/min (Essentials), 60 req/min (Growth), 300 req/min (Enterprise)
             10,000/mo (Essentials), 30,000/mo (Growth), 100,000/mo (Enterprise)
  ```
</Accordion>

## Deal Identification

You can identify the deal using one of three methods:

| Parameter       | Description                                         |
| --------------- | --------------------------------------------------- |
| `deal_id`       | Hindsight's internal deal ID                        |
| `salesforce_id` | Salesforce Opportunity ID (e.g., `006xxxxxxxxxxxx`) |
| `hubspot_id`    | HubSpot Deal ID                                     |

## Source Options

The `source` field determines the icon displayed and helps with document organization:

| Source       | Description          |
| ------------ | -------------------- |
| `gong`       | Gong call recordings |
| `clari`      | Clari                |
| `fathom`     | Fathom AI            |
| `fireflies`  | Fireflies.ai         |
| `avoma`      | Avoma                |
| `outreach`   | Outreach             |
| `gmail`      | Gmail                |
| `Salesforce` | Salesforce           |
| `Hubspot`    | HubSpot              |
| `api`        | API upload           |

## Supported File Types

| Category  | Formats                        | Notes                                 |
| --------- | ------------------------------ | ------------------------------------- |
| Documents | PDF, DOCX, PPTX, XLSX, MD, TXT | Parsed and chunked for search         |
| Audio     | MP3, WAV, M4A                  | Automatically transcribed via Whisper |
| Video     | MP4                            | Automatically transcribed via Whisper |

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST https://app.usehindsight.com/api/v1/deals/documents \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "file_name": "Discovery Call Recording.mp3",
      "file_url": "https://example.com/recording.mp3",
      "content_type": "audio/mpeg",
      "salesforce_id": "006xxxxxxxxxxxx",
      "source": "gong"
    }'
  ```

  ```javascript Node.js theme={null}
  const response = await fetch('https://app.usehindsight.com/api/v1/deals/documents', {
    method: 'POST',
    headers: {
      'Authorization': `Bearer ${API_KEY}`,
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      file_name: 'Discovery Call Recording.mp3',
      file_url: 'https://example.com/recording.mp3',
      content_type: 'audio/mpeg',
      salesforce_id: '006xxxxxxxxxxxx',
      source: 'gong'
    })
  });

  const data = await response.json();
  console.log(`Document uploaded: ${data.document.id}`);
  console.log(`Processing run: ${data.run_id}`);
  ```

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

  response = requests.post(
      'https://app.usehindsight.com/api/v1/deals/documents',
      headers={
          'Authorization': f'Bearer {API_KEY}',
          'Content-Type': 'application/json'
      },
      json={
          'file_name': 'Discovery Call Recording.mp3',
          'file_url': 'https://example.com/recording.mp3',
          'content_type': 'audio/mpeg',
          'salesforce_id': '006xxxxxxxxxxxx',
          'source': 'gong'
      }
  )

  data = response.json()
  print(f"Document uploaded: {data['document']['id']}")
  print(f"Processing run: {data['run_id']}")
  ```
</RequestExample>
