# POST /api/v1/o2c/deals/bulk

> Bulk-create deals

- **Tag:** deals
- **Operation ID:** `bulk_create_deals_api_v1_o2c_deals_bulk_post`

## Description

Create up to 250 pipeline deals in one request — the import path behind the Pipeline page's Import button, for moving an existing pipeline spreadsheet in.

Rows are independent: one invalid row does not reject the rest. Every row comes back in `results` with its 1-based `row` number and, on failure, the reason — so a caller fixes and re-submits only what failed. Each row needs `prospect_name` or `customer_id`, and `expected_value_cents` is in CENTS.

## Authentication

Bearer token in `Authorization` header.
Required header: `x-business-id: <business uuid>`.

## Request body

Schema: `DealBulkCreateRequest`

- `deals` (array · DealBulkRow · required) → `DealBulkRow` — Deals to create (1-250).
  - `prospect_name` (string) — Free-text prospect/company name, used before a real customer record exists. Required unless customer_id is set.
  - `customer_id` (string) — Existing customer this deal is for (expansion deal). Required unless prospect_name is set.
  - `name` (string) — Deal name. Defaults to the prospect/customer name.
  - `contact_name` (string) — Sales contact.
  - `contact_email` (string) — Sales contact email. Never written to the customer record -- may later become the order signer.
  - `source` (string) — Validated per row; an unknown source fails that row.
  - `stage` (string) — Validated per row; an unknown stage fails that row.
  - `is_expansion` (boolean) — True if this is expansion revenue on an existing customer.
  - `expected_value_cents` (integer) — Estimated deal value in cents.
  - `expected_hours` (number | string) — Estimated hours.
  - `expected_term_months` (integer) — Estimated contract term in months.
  - `expected_start_date` (string · date) — Estimated start date.
  - `expected_close_date` (string · date) — Estimated close date.
  - `notes` (string) — Free-text notes.
  - `owner_name` (string) — Sales rep / deal owner. Free text (reps are often not DayZero users); the pipeline's owner filter matches on it exactly.
  - `deal_type` (string) — Business-defined deal category, e.g. 'Subcontractor', 'EPC', 'Developer'. Free text -- every business slices deals differently.
  - `revenue_type` (string) — Validated per row; an unknown value fails that row.

## Responses

### 201 — Successful Response

Schema: `SuccessEnvelope_DealBulkCreateResponse_`

- `success` (boolean)
- `message` (string)
- `code` (string)
- `data` (DealBulkCreateResponse)

### 400 — Bad Request - Invalid input

### 401 — Unauthorized - Authentication required

### 403 — Forbidden - Insufficient permissions

### 422 — Validation Error

Schema: `HTTPValidationError`

- `detail` (array · ValidationError) → `ValidationError`
  - `loc` (array · string | integer · required)
  - `msg` (string · required)
  - `type` (string · required)
  - `input` (object)
  - `ctx` (object)

## Code samples

### cURL

```bash
curl -X POST 'https://api.ondayzero.com/api/v1/o2c/deals/bulk' \
  -H 'Authorization: Bearer dz_your_token' \
  -H 'x-business-id: YOUR_BUSINESS_ID' \
  -H 'Content-Type: application/json' \
  -d '{
  "deals": []
}'
```

### JavaScript

```javascript
const response = await fetch('https://api.ondayzero.com/api/v1/o2c/deals/bulk', {
  method: 'POST',
  headers: {
    Authorization: 'Bearer dz_your_token',
    'x-business-id': 'YOUR_BUSINESS_ID',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
  "deals": []
}),
});
const data = await response.json();
```

### Python

```python
import httpx

headers = {
    "Authorization": "Bearer dz_your_token",
    "x-business-id": "YOUR_BUSINESS_ID",
}

payload = {
  "deals": []
}

response = httpx.post("https://api.ondayzero.com/api/v1/o2c/deals/bulk", headers=headers, json=payload)
data = response.json()
```

## See also

- HTML version: https://www.ondayzero.com/docs/reference/deals/bulk-create-deals
- OpenAPI slice: https://www.ondayzero.com/docs/reference/deals/bulk-create-deals/openapi.json
- Other endpoints in **deals**: https://www.ondayzero.com/docs/reference/deals
