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

# Create a Deal

This recipe walks through the full lifecycle of submitting a loan tape as an originator — from initiating the upload to the deal being marked for review.

## Overview

```
1. POST /originator/loans          → create deal, get upload URL
2. PUT  <upload_url>               → upload your CSV/XLSX file
3. POST /originator/loans/complete → register file, mark deal IN_REVIEW
```

***

## Step 1 — Initiate the Deal

Call this endpoint with your loan type. The platform creates a new deal in `DRAFT` status and returns an upload URL valid for 1 hour.

```bash theme={null}
curl -X POST https://api.9squid.com/v1/api/originator/loans \
  -H "Authorization: Bearer <your_token>" \
  -H "Content-Type: application/json" \
  -d '{ "type": "Auto" }'
```

**Supported loan types:** `Auto`, `Personal`, `Mortgage`, `Student`, `Business`, `Credit Card`

**Response**

```json theme={null}
{
  "success": true,
  "data": {
    "deal_id": "clx1a2b3c4d5e6f7g8h9",
    "upload_url": "https://...",
    "file_name": "loan-tape-abc123.upload",
    "expires_in": 3600
  }
}
```

> If a `DRAFT` deal already exists for the same loan type, it will be reused and a fresh URL returned.

***

## Step 2 — Upload the File

Using the `upload_url` from Step 1, upload your CSV or XLSX file directly. No auth header needed — the URL is pre-authorized.

```bash theme={null}
curl -X PUT "<upload_url>" \
  -H "Content-Type: text/csv" \
  --data-binary @your-loan-tape.csv
```

For XLSX files use `Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`.

> The upload URL expires in **1 hour**. If it expires, call `PATCH /originator/loans/:dealId` to regenerate.

***

## Step 3 — Complete the Upload

After the file is uploaded, notify the platform. The gateway verifies the file is valid CSV or XLSX, registers it, and transitions the deal to `IN_REVIEW`.

```bash theme={null}
curl -X POST https://api.9squid.com/v1/api/originator/loans/complete \
  -H "Authorization: Bearer <your_token>" \
  -H "Content-Type: application/json" \
  -d '{
    "deal_id": "clx1a2b3c4d5e6f7g8h9",
    "file_name": "loan-tape-abc123.upload"
  }'
```

**Response**

```json theme={null}
{
  "success": true,
  "data": {
    "deal_id": "clx1a2b3c4d5e6f7g8h9",
    "deal_status": "IN_REVIEW"
  }
}
```

***

## Step 4 — Check Deal Status

Poll the deal to track its progress through the review pipeline.

```bash theme={null}
curl https://api.9squid.com/v1/api/originator/loans/clx1a2b3c4d5e6f7g8h9 \
  -H "Authorization: Bearer <your_token>"
```

**Deal status lifecycle:**

| Status         | Meaning                                   |
| -------------- | ----------------------------------------- |
| `DRAFT`        | Upload URL issued, file not yet submitted |
| `IN_REVIEW`    | File submitted, under platform review     |
| `QC_COMPLETED` | Quality check passed                      |
| `APPROVED`     | Deal approved for securitization          |
| `REJECTED`     | Deal rejected — check reason in response  |

***

## Regenerate an Expired URL

If your upload URL expired before you could upload, regenerate it:

```bash theme={null}
curl -X PATCH https://api.9squid.com/v1/api/originator/loans/clx1a2b3c4d5e6f7g8h9 \
  -H "Authorization: Bearer <your_token>"
```

Returns a fresh `upload_url` and `file_name`. The deal remains in `DRAFT`.

***

## What's Next

* [Run Selection Criteria](/workflows/run-selection-criteria) — validate your deal against eligibility rules
* [Bulk Upload](/workflows/bulk-loan-upload) — submit multiple loan tapes in one job
* [View Your Pool](/api-reference/originator-pools/poolscontroller_listpools) — inspect the securitization pool your deal belongs to
